-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/aws: Fix issue upgrading to Terraform v0.9+ with AWS OpsWorks Stacks #13024
Conversation
Fix an issue when upgrading from Terraform < 0.9 to 0.9+, when we added support for the regional endpoints in OpsWorks Stacks. OpsWorks Stacks can only be managed via the endpoint with which they were created, not where the stack resides.
LGTM! Thanks for the fix :)
|
Fix an issue when upgrading from Terraform < 0.9 to 0.9+, when we added support for the regional endpoints in OpsWorks Stacks. OpsWorks Stacks can only be managed via the endpoint with which they were created, not where the stack resides.
I'm facing this issue right now! Thanks for the fix. If this fix is in 0.9.2, I might have a closely related issue that affects module.phobos.aws_opsworks_custom_layer and aws_opsworks_instance. It appears that Terraform can't see layers and instances created with classic endpoint using a version of Terraform older than 0.9. It will attempt to recreate them and fail. Let me know if you'd like me to fill a new issue or if this is supposed to be fixed by this @catsby ! Thanks! |
This fix should apply to
It's entirely possible things that belong to this stack also have that limitation? If you discover this is the case, please open a new GitHub issue. Thanks! |
For the record, this does not fix the problem with existing stacks. It continues to think my stack doesn't exist, but won't allow me to import saying that the stack already exists. |
Judging by @rafaelmagu 's last comment, I think that #12842 is not resolved and should be reopened. |
@catsby I think Actually, All API requests should go to regional endpoint, which means all TF opsworks resources should contact to it. |
… to real Terraform version Reference: hashicorp/terraform#13024 Reference: #9570 This migration is required for migrating to the standalone Terraform Plugin SDK and removing our dependency on github.com/hashicorp/terraform in the future. Output from acceptance testing: ``` --- PASS: TestAccAWSOpsWorksStack_classic_endpoints (28.89s) ``` User-Agent from testing above: ``` User-Agent: aws-sdk-go/1.24.4 (go1.13; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.12.7 ```
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Fix an issue when upgrading from Terraform < 0.9 to 0.9+, when we added
support for the regional endpoints in OpsWorks Stacks. OpsWorks Stacks
can only be managed via the endpoint with which they were created, not
where the stack resides:
Prior to #12688, all OpsWorks stacks were created via
us-east-1
endpoint, which was the only way to create them until very recent. Amazon has since added regional endpoints, and deprecated the approach of all-stacks-go-thru-us-east.When we removed the default of
us-east-1
in Terraform v0.9.0, anyopsworks_stack
resources created in a version of Terraform < 0.9 began querying the API with whatever region the Provider had been configured, not necessarilyus-east-1
, the region they were created with.Any user in this situation would be presented with Terraform trying to create a new opsworks stack, because it was unable to find it due to the region diff. See #12842 .
Here, we add a
stack_endpoint
computed attribute, where we'll store the region in which the stack is found. On the next UPDATE or REFRESH action, Terraform will attempt to find the stack in the default Provider region. If not found, it will attempt to find it inus-east-1
. If it's found in east, we'll save that as thestack_endpoint
.Future UPDATE, REFRESH, and DELETE operations will check this computed attribute and get the connection needed, if the
stack_endpoint
is found.The acceptance test
TestAccAWSOpsWorksStack_classic_endpoints
should cover this. It first creates a stack inus-east-1
, using us-east-1 region. In the second step, we switch tous-west-2
and preform a plan-only check of the configuration. Without the ability to checkus-east-1
after checking the updated Provider region, this test step would fail to find the stack created and offer to create it, failing the step because it produces a non-empty plan.