-
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_vpc_security_group_association: new resource #40069
r/aws_vpc_security_group_association: new resource #40069
Conversation
Community NoteVoting for Prioritization
For Submitters
|
088c9a1
to
2e6227d
Compare
This replaces the previously hardcoded 5 minute timeout used on the create and delete waiters. The default create and delete timeouts are now 5 minutes and will be passed into the waiter functions, allowing practitioners to optionally configure longer timeouts, if desired.
This changes the resource name to `aws_vpc_security_group_vpc_association`, along with renaming many associated functions and structs. The reasoning behind this is to match the typical conventions used throughout the provider. Namely - using `vpc` as the service identifier for EC2 APIs which are scoped to VPC-based actions, and deriving the resource name by noun-ifying the corresponding AWS API. In this case the `AssociateSecurityGroupVpc` API maps to a suffix of `_security_group_vpc_association`. Combining these conventions together results in the complete name `aws_vpc_security_group_vpc_association`. ```console % make testacc PKG=ec2 TESTS=TestAccVPCSecurityGroupVPCAssociation_basic make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... --- PASS: TestAccVPCSecurityGroupVPCAssociation_basic (75.12s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 80.366s ```
This attribute will track the state of the security group VPC association. ```console % make testacc PKG=ec2 TESTS=TestAccVPCSecurityGroupVPCAssociation_basic make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.23.2 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCSecurityGroupVPCAssociation_basic' -timeout 360m 2024/11/13 14:45:52 Initializing Terraform AWS Provider... --- PASS: TestAccVPCSecurityGroupVPCAssociation_basic (34.74s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 39.954s ```
Adds additional logic to the delete method to handle cases where the VPC association and security group are deleted out of band. ```console % make testacc PKG=ec2 TESTS=TestAccVPCSecurityGroupVPCAssociation_disappears_SecurityGroup make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.23.2 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCSecurityGroupVPCAssociation_disappears_SecurityGroup' -timeout 360m 2024/11/13 15:34:21 Initializing Terraform AWS Provider... --- PASS: TestAccVPCSecurityGroupVPCAssociation_disappears_SecurityGroup (23.92s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 29.764s ```
…tion Adds additional logic to the delete method to handle cases where the VPC association and target VPC are deleted out of band. ```console % make testacc PKG=ec2 TESTS=TestAccVPCSecurityGroupVPCAssociation_disappears_VPC make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.23.2 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCSecurityGroupVPCAssociation_disappears_VPC' -timeout 360m 2024/11/13 16:31:22 Initializing Terraform AWS Provider... --- PASS: TestAccVPCSecurityGroupVPCAssociation_disappears_VPC (64.64s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 69.898s ```
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 PKG=ec2 TESTS=TestAccVPCSecurityGroupVPCAssociation_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCSecurityGroupVPCAssociation_' -timeout 360m
2024/11/13 16:36:02 Initializing Terraform AWS Provider...
--- PASS: TestAccVPCSecurityGroupVPCAssociation_disappears (23.04s)
--- PASS: TestAccVPCSecurityGroupVPCAssociation_basic (24.74s)
--- PASS: TestAccVPCSecurityGroupVPCAssociation_disappears_SecurityGroup (63.93s)
--- PASS: TestAccVPCSecurityGroupVPCAssociation_disappears_VPC (64.58s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 71.166s
Thanks for your contribution, @alexbacchin! 👍 👏 |
This functionality has been released in v5.76.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! |
Description
This resource will allow practitioners associate EC2 Security Groups with other VPCs in the same account.
Relations
Closes #39999
References
https://docs.aws.amazon.com/vpc/latest/userguide/security-group-assoc.html
Output from Acceptance Testing