Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform aws_api_gateway_integration_response keeps wanting to change attribute

Tags:

terraform

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
...
like image 922
sebastian Avatar asked Oct 29 '19 03:10

sebastian


People also ask

What is Aws_api_gateway_deployment?

Resource: aws_api_gateway_deployment. Manages an API Gateway REST Deployment. A deployment is a snapshot of the REST API configuration.

What is Aws_api_gateway_integration?

Resource: aws_api_gateway_integration. Provides an HTTP Method Integration for an API Gateway Integration.

What is Aws_api_gateway_method_response?

Resource: aws_api_gateway_method_response Provides an HTTP Method Response for an API Gateway Resource.


1 Answers

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

like image 113
Carlo Mencarelli Avatar answered Sep 29 '22 18:09

Carlo Mencarelli