Skip to content
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 #15948

Closed
momania opened this issue Aug 29, 2017 · 2 comments
Closed

Order not retained for api_stages in aws_api_gateway_usage_plan #15948

momania opened this issue Aug 29, 2017 · 2 comments

Comments

@momania
Copy link

momania commented Aug 29, 2017

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 the api_stages config blocks.
So just as the example in the docs here I specify multiple:

resource "aws_api_gateway_usage_plan" "example_api_usage_plan" {
  name         = "my-usage-plan"
  description  = "my description"

  api_stages {
    api_id = "${aws_api_gateway_rest_api.example_api.id}"
    stage  = "${aws_api_gateway_deployment.example_deployment_dev.stage_name}"
  }

  api_stages {
    api_id = "${aws_api_gateway_rest_api.example_api.id}"
    stage  = "${aws_api_gateway_deployment.example_deployment_prod.stage_name}"
  }

  quota_settings {
    limit  = 1000
    offset = 50
    period = "WEEK"
  }

  throttle_settings {
    burst_limit = 5
    rate_limit  = 10
  }
}

Starting from a clean environment, terraform will create the following resource:

+ aws_api_gateway_usage_plan.example_api_usage_plan
    api_stages.#:                             "2"
    api_stages.0.api_id:                      "${aws_api_gateway_rest_api.example_api.id}"
    api_stages.0.stage:                       "dev"
    api_stages.1.api_id:                      "${aws_api_gateway_rest_api.example_api.id}"
    api_stages.1.stage:                       "api"
    description:                              "my description"
    name:                                     "my-usage-plan"
    quota_settings.#:                         "1"
    quota_settings.2630697536.limit:          "1000"
    quota_settings.2630697536.offset:         "50"
    quota_settings.2630697536.period:         "WEEK"
    throttle_settings.#:                      "1"
    throttle_settings.1161842669.burst_limit: "5"
    throttle_settings.1161842669.rate_limit:  "10"

Problem

When all is applied, and after this I run a terraform plan, it will suggest the following changes:

~ aws_api_gateway_usage_plan.example_api_usage_plan
    api_stages.0.stage:                       "api" => "dev"
    api_stages.1.stage:                       "dev" => "api"
    throttle_settings.1161842669.burst_limit: "" => "5"
    throttle_settings.1161842669.rate_limit:  "" => "10"
    throttle_settings.514851065.burst_limit:  "5" => "0"
    throttle_settings.514851065.rate_limit:   "0" => "0"

If I apply this and run terraform plan again, it suggests the following changes:

~ aws_api_gateway_usage_plan.example_api_usage_plan
    api_stages.0.stage: "api" => "dev"
    api_stages.1.stage: "dev" => "api"

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 the api_stages keep on re-ordering.

@hashibot
Copy link
Contributor

This issue has been automatically migrated to hashicorp/terraform-provider-aws#1675 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.

@ghost
Copy link

ghost commented Apr 7, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants