-
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
Order not retained for api_stages in aws_api_gateway_usage_plan #1675
Comments
We are also observing similar issue. We only have one stage but while applying the same, we see output similar to:
Question is if we are trying to set limits to "5" and "10" in:
, why does terraform try to reset them to 0 in the last 2 lines?
And then how does it set values correctly in the second apply run? |
Hi all, |
I got the same issue where I have to run terraform twice every time we released new changes even though that changes were not related to this |
@anonymint what I ended up doing to 'fix' this problem was removing the usage plan stages from terraform (but kept the resource so terraform can create the usage plan) and in every API resource (aws_api_gateway_deployment), I have a local-exec like so:
This ensures that everytime the API changes, the usage plan is associated again. |
@ricardosilveiraolx oh that's a legit idea I end up creating null_resource and apply script above to trigger based on aws_api_gateway_deployment id so far so good to me.
This ^ would keep me good for now, but only downside of this approach is our machine need to have aws command install and passing correct aws profiles during execution. |
I am getting hit by this bug also. A partial workaround is to use
By adding the stanza |
In my context, I have 2 APIs (v1 & v2) with one stage for each, associated with multiple usage plans. It seems the issue is at the API Gateway Service level. I managed to replicate the behaviour with AWS CLI, Go SDK and Terraform. On usage plan query, the api stages list is ordered alphabetically by api id, no matter the association order. The solution in my case was to make the association, in an order based on api id:
I haven't tested, but is possible that when there is one api with multiple stages, the api stages list received on usage plan query to be ordered not only by api id but also by stage name. |
This has been released in version 3.13.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! |
This issue was originally opened by @momania as hashicorp/terraform#15948. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
v0.9.11
[edit]
Just upgraded to v0.10.2 to validate, but problem still exists
Situation
I'm using an
aws_api_gateway_usage_plan
which applies to multiple stages, defined with theapi_stages
config blocks.So just as the example in the docs here I specify multiple:
Starting from a clean environment, terraform will create the following resource:
Problem
When all is applied, and after this I run a
terraform plan
, it will suggest the following changes:If I apply this and run
terraform plan
again, it suggests the following changes:Expected
I expect actually that after the initial apply, and without any changes to the config, terraform will not suggest any changes. After the first run, it leaves the
throttle_settings
for what it is, but theapi_stages
keep on re-ordering.The text was updated successfully, but these errors were encountered: