-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
r/aws_networkmanager_core_network_policy_attachment #29097
r/aws_networkmanager_core_network_policy_attachment #29097
Conversation
Community NoteVoting for Prioritization
For Submitters
|
Working on adding more tests for various scenarios like having a vpc_attachment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
$ make testacc TESTARGS='-run=TestAccNetworkManagerCoreNetwork' PKG=networkmanager ACCTEST_PARALLELISM=6
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/networkmanager/... -v -count 1 -parallel 6 -run=TestAccNetworkManagerCoreNetwork -timeout 180m
=== RUN TestAccNetworkManagerCoreNetworkPolicyAttachment_basic
=== PAUSE TestAccNetworkManagerCoreNetworkPolicyAttachment_basic
=== RUN TestAccNetworkManagerCoreNetworkPolicyAttachment_vpcAttachment
=== PAUSE TestAccNetworkManagerCoreNetworkPolicyAttachment_vpcAttachment
=== RUN TestAccNetworkManagerCoreNetworkPolicyDocumentDataSource_basic
=== PAUSE TestAccNetworkManagerCoreNetworkPolicyDocumentDataSource_basic
=== RUN TestAccNetworkManagerCoreNetwork_basic
=== PAUSE TestAccNetworkManagerCoreNetwork_basic
=== RUN TestAccNetworkManagerCoreNetwork_disappears
=== PAUSE TestAccNetworkManagerCoreNetwork_disappears
=== RUN TestAccNetworkManagerCoreNetwork_tags
=== PAUSE TestAccNetworkManagerCoreNetwork_tags
=== RUN TestAccNetworkManagerCoreNetwork_description
=== PAUSE TestAccNetworkManagerCoreNetwork_description
=== RUN TestAccNetworkManagerCoreNetwork_policyDocument
=== PAUSE TestAccNetworkManagerCoreNetwork_policyDocument
=== RUN TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithoutRegion
=== PAUSE TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithoutRegion
=== RUN TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithRegion
=== PAUSE TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithRegion
=== RUN TestAccNetworkManagerCoreNetwork_withoutPolicyDocumentUpdateToCreateBasePolicyDocument
=== PAUSE TestAccNetworkManagerCoreNetwork_withoutPolicyDocumentUpdateToCreateBasePolicyDocument
=== CONT TestAccNetworkManagerCoreNetworkPolicyAttachment_basic
=== CONT TestAccNetworkManagerCoreNetwork_description
=== CONT TestAccNetworkManagerCoreNetwork_basic
=== CONT TestAccNetworkManagerCoreNetworkPolicyDocumentDataSource_basic
=== CONT TestAccNetworkManagerCoreNetwork_tags
=== CONT TestAccNetworkManagerCoreNetworkPolicyAttachment_vpcAttachment
--- PASS: TestAccNetworkManagerCoreNetworkPolicyDocumentDataSource_basic (9.21s)
=== CONT TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithRegion
--- PASS: TestAccNetworkManagerCoreNetwork_description (54.62s)
=== CONT TestAccNetworkManagerCoreNetwork_withoutPolicyDocumentUpdateToCreateBasePolicyDocument
--- PASS: TestAccNetworkManagerCoreNetwork_basic (64.34s)
=== CONT TestAccNetworkManagerCoreNetwork_disappears
--- PASS: TestAccNetworkManagerCoreNetwork_tags (64.74s)
=== CONT TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithoutRegion
--- PASS: TestAccNetworkManagerCoreNetwork_disappears (23.30s)
=== CONT TestAccNetworkManagerCoreNetwork_policyDocument
--- PASS: TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithRegion (406.38s)
--- PASS: TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithoutRegion (480.38s)
--- PASS: TestAccNetworkManagerCoreNetwork_withoutPolicyDocumentUpdateToCreateBasePolicyDocument (504.74s)
--- PASS: TestAccNetworkManagerCoreNetworkPolicyAttachment_basic (726.05s)
--- PASS: TestAccNetworkManagerCoreNetwork_policyDocument (711.66s)
--- PASS: TestAccNetworkManagerCoreNetworkPolicyAttachment_vpcAttachment (1081.52s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/networkmanager 1084.660s
Thanks for your contribution, @GlennChia! |
This functionality has been released in v4.54.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
Creates a new resource that attaches a policy to an existing Core Network. When doing this, it sets the latest policy as the
LIVE
policy. Refer to the Core network policies documentation for more information.Clarifications and design choices
Since this resource modifies the
policy_document
, which is currently defined as an argument for theaws_networkmanager_core_network
resource, it will lead to diffs after refresh. This is solved by changing it tooptional
andcomputed
.optional
andcomputed
were also chosen becausepolicy_document
can also be updated since am optionalcreate_base_policy
was introduced to create a base Core Network policy document at create-time. This base policy will be set to theLIVE
state. It is important that the Core Network has aLIVE
policy because this is required if VPC attachments were to be attached to the Core Network at create-time. Hence, in the next plan or apply, thepolicy_document
needs to becomputed
to read the policy created from thecreate_base_policy
argument. This new argument is not returned by the read APIs and is added to ImportStateVerifyIgnore.The base policy requires a region. Hence, a
base_policy_region
argument was introduced for practitioners to pass in their own region. This is useful in scenarios where an organization may not permit resources to be deployed in certain regions and practitioners want to have the flexibility to deploy resources into an allow-listed region. This argument is optional and defaults to the region defined in theproviders
block. This new argument is not returned by the read APIs and is added to ImportStateVerifyIgnore.The core_network resource also has 2 computed attributes
segments
andedges
that are computed after the policy has been applied. With the newaws_networkmanager_core_network_policy_attachment
resource, the computed arguments are not computed immediately after the apply since customized_diff logic will not be triggered because the policy document is not managed by theaws_networkmanager_core_network
resource. This can potentially be solved by implementing a data source for core network just for reading the latest attributes.terraform-provider-aws/internal/service/networkmanager/core_network.go
Lines 340 to 349 in 88e1985
Relations
Closes #28867
References
Output from Acceptance Testing