sebastian
sebastian

Reputation: 2348

Terraform aws_api_gateway_integration_response keeps wanting to change attribute

Terraform aws_api_gateway_integration_response keeps wanting to change selection_pattern attribute. Any guidance would be appreciated.


resource "aws_api_gateway_integration_response" "api_gateway_integration_response_e1_default" {
  rest_api_id       = "${aws_api_gateway_rest_api.api_gateway_rest_api.id}"
  resource_id       = "${aws_api_gateway_resource.e1_api_gateway_resource.id}"
  http_method       = "${aws_api_gateway_method.e1_api_gateway_method.http_method}"
  status_code       = "${aws_api_gateway_method_response.api_gateway_method_response_e1_202.status_code}"
  selection_pattern = "-"
}

resource "aws_api_gateway_integration_response" "api_gateway_integration_response_e2_default" {
  rest_api_id       = "${aws_api_gateway_rest_api.api_gateway_rest_api.id}"
  resource_id       = "${aws_api_gateway_resource.e2_api_gateway_resource.id}"
  http_method       = "${aws_api_gateway_method.e2_api_gateway_method.http_method}"
  status_code       = "${aws_api_gateway_method_response.api_gateway_method_response_e2_202.status_code}"
  selection_pattern = "-"
}

My terraform apply output that keeps wanting to update.

terraform apply
...
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  ~ module.gateway.aws_api_gateway_integration_response.api_gateway_integration_response_e1_default
      selection_pattern: "" => "-"

  ~ module.gateway.aws_api_gateway_integration_response.api_gateway_integration_response_e2_default
      selection_pattern: "" => "-"


Plan: 0 to add, 2 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

See terraform version

$ terraform version
Terraform v0.11.14
+ provider.aws v2.32.0
...

Upvotes: 6

Views: 1413

Answers (1)

Carlo Mencarelli
Carlo Mencarelli

Reputation: 718

Looks like this could be a bug. In the AWS console, before expanding an intergration response, an empty value for the selection pattern is displayed as a single dash -. However after expanding the integration response, the pattern is empty and the text default is displayed.

In the AWS API Documents for the Selection Pattern paramter there's no mention of being able to pass in a - to reset the pattern to default.

Setting selection_pattern = "" should get what you need. I tested it with Terraform 0.12.9. I confirmed this also works on Terraform 0.11.14

Upvotes: 5

Related Questions