-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Allow forced replacement of route table associated with subnet #6999
Conversation
dd4a184
to
4146155
Compare
Here is a usage example. Assume that
However, with this PR, you can set the resource "aws_route_table_association" "new_assoc" {
route_table_id = "${aws_route_table.new_guy.id}"
subnet_id = "subnet-04ff24b9b39f3822b"
force_replace = true
} $ terraform apply
aws_route_table.new_guy: Creation complete after 0s (ID: rtb-0833a30c3ba11dc03)
aws_route_table_association.new_assoc: Creating...
force_replace: "" => "true"
route_table_id: "" => "rtb-0833a30c3ba11dc03"
subnet_id: "" => "subnet-04ff24b9b39f3822b"
aws_route_table_association.new_assoc: Creation complete after 1s (ID: rtbassoc-08cbb18f6a3d7a975)
Apply complete! Resources: 2 added, 0 changed, 0 destroyed. |
4146155
to
d6545d7
Compare
I'm hitting this issue too and would like to thank you for this patch. |
Please, merge. |
Please merge! We are hitting a major blocker with this issue. |
Please merge -- need this as well. |
Waiting for merge also! My case is importing existing resources into terraform state. And it's not possible to import aws_route_table_association (#561) and not possible to force old route table recreation. |
Anything we can do to promote this patch? Keep having to pop into the console to deal with this one, when people re-associate a route table improperly, since terraform fails to override this association. :( |
Any good soul out there that could merge this? ^^ |
2ad5c27
to
2dab22f
Compare
@bflad As discussed, I've implemented import for route table associations and taken out the exampleA simplified example of using this. Environment 1: resource "aws_subnet" "client-network" {
...
}
resource "aws_route_table" "client-routes" {
...
}
resource "aws_route_table_association" "client-routes" {
route_table_id = aws_route_table.client-routes.id
subnet_id = aws_subnet.client-network.id
} $ terraform apply Environment 2: resource "aws_subnet" "new_sn" {
...
}
resource "aws_route_table_association" "replace" {
route_table_id = var.route_table_id
subnet_id = aws_subnet. new_sn.id
} $ terraform import aws_route_table_association.assoc subnet-6777656e646f6c796e/rtb-656c65616e6f72
$ terraform apply Voilà. Association updated. acceptance tests$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSRouteTableAssociation_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSRouteTableAssociation_ -timeout 120m
=== RUN TestAccAWSRouteTableAssociation_basic
=== PAUSE TestAccAWSRouteTableAssociation_basic
=== RUN TestAccAWSRouteTableAssociation_replace
=== PAUSE TestAccAWSRouteTableAssociation_replace
=== CONT TestAccAWSRouteTableAssociation_basic
=== CONT TestAccAWSRouteTableAssociation_replace
--- PASS: TestAccAWSRouteTableAssociation_basic (84.47s)
--- PASS: TestAccAWSRouteTableAssociation_replace (87.10s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 87.162s |
2dab22f
to
9e0f878
Compare
@aleksap @lorengordon @pit @ibehren1 @janjur @yves-vogl Please speak up if there are scenarios where import -> modify won't work and where you'd still need to force replace an association. My thinking is that having import capability (this PR) should cover most/all scenarios. |
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.
Hi @YakDriver 👋 Thanks so much for the updates and sticking through this one. Overall looking really good, just a few minor things. Please reach out with any questions or if you do not have time to implement the feedback. 👍
9cd1fe0
to
880448a
Compare
@bflad I made the changes you requested. Let me know if there is anything else you see. $ make testacc TESTARGS='-run=TestAccAWSRouteTableAssociation_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAWSRouteTableAssociation_ -timeout 120m
? github.com/terraform-providers/terraform-provider-aws [no test files]
=== RUN TestAccAWSRouteTableAssociation_basic
=== PAUSE TestAccAWSRouteTableAssociation_basic
=== RUN TestAccAWSRouteTableAssociation_replace
=== PAUSE TestAccAWSRouteTableAssociation_replace
=== CONT TestAccAWSRouteTableAssociation_basic
=== CONT TestAccAWSRouteTableAssociation_replace
--- PASS: TestAccAWSRouteTableAssociation_basic (69.87s)
--- PASS: TestAccAWSRouteTableAssociation_replace (70.10s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 70.190s |
880448a
to
07a1091
Compare
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.
Looks great, @YakDriver, thanks! 🚀
--- PASS: TestAccAWSRouteTableAssociation_replace (27.43s)
--- PASS: TestAccAWSRouteTableAssociation_basic (27.60s)
This has been released in version 2.22.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 for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Fixes #73
UPDATE 7/19/19: Rather than force replacement, allow the import of route table associations allows the associations to be updated. See below.
Changes proposed in this pull request:
Add corresponding docs & tests.r/aws_route_table_association
: Add new argumentforce_replace
allowing a route table to be associated with a subnet even if another route table is already associated.r/aws_route_table_association
: Implement import so that associations can be updated after they are imported.Output from acceptance testing: