-
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
Added remove_current_attachment_association attribute to ec2_transit_gateway_route_table_association #31452
Conversation
…gateway_route_table_association Allows for disassociating the currently linked route table for the gateway attachment before associating our new route table.
Community NoteVoting for Prioritization
For Submitters
|
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.
Welcome @Snappey 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
Bump +1 |
…ation-disassociate-current
@Snappey Thanks for the contribution 🎉 👏. |
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=TestAccTransitGateway_serial/RouteTableAssociation' PKG=ec2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 20 -run=TestAccTransitGateway_serial/RouteTableAssociation -timeout 180m
=== RUN TestAccTransitGateway_serial
=== PAUSE TestAccTransitGateway_serial
=== CONT TestAccTransitGateway_serial
=== RUN TestAccTransitGateway_serial/RouteTableAssociation
=== RUN TestAccTransitGateway_serial/RouteTableAssociation/ReplaceExistingAssociation
=== RUN TestAccTransitGateway_serial/RouteTableAssociation/basic
=== RUN TestAccTransitGateway_serial/RouteTableAssociation/disappears
--- PASS: TestAccTransitGateway_serial (1334.62s)
--- PASS: TestAccTransitGateway_serial/RouteTableAssociation (1334.62s)
--- PASS: TestAccTransitGateway_serial/RouteTableAssociation/ReplaceExistingAssociation (420.73s)
--- PASS: TestAccTransitGateway_serial/RouteTableAssociation/basic (438.45s)
--- PASS: TestAccTransitGateway_serial/RouteTableAssociation/disappears (475.44s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/ec2 1340.164s
This functionality has been released in v5.2.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
Allows for disassociating the currently linked Transit Gateway route table for the gateway attachment before associating our new route table by setting the
remove_current_attachment_assoication
attribute totrue
(defaults tofalse
).Currently if you attempt to create a new
ec2_transit_gateway_route_table_association
with a Gateway Attachment that is already attached to a route table the association resource will fail withResource.AlreadyExists
error code, as far as I can tell this can only be fixed by manually disassociating via console / API and rerunning to bring it into the state or by setting thedefault_route_table_association
attribute tofalse
on the Transit Gateway and manage each attachment manually to prevent automatic association which feels like a lot of overhead for handling edge cases.I'm not sure if this is the best approach but was suggested as a solution in #16452 and was pretty straight forwards to implement and opt-in, if there is an alternative that is better suited I'm more than happy to take it on. Would very much like to see this solved to allow for easy updating of gateway attachment route tables.
At the moment it does not do any checks to see if the Route Table ID we're associating to is also the target and short circuit in that case, I'm not sure if there is any benefit in doing so? I'm leaning towards a no since each of the attributes are marked to force recreation.
Also I've added the field to the tests, but I'm not sure if that's all I need to do on that front or if any new acceptance tests need to be created for the situation where the attribute is set to
true
?Example
Relations
Closes #16452
References
N/A
Output from Acceptance Testing
I've attempted to run the Acceptance Tests a couple of times and it kept blowing up my machine then crashing mid tests, leaving some dangling resource, if they could be ran for me that'd be much appreciated, thanks.