I was expected the stack to remove the parameters from the method and integration resources.
Actual Behavior
Instead it is removing from method and failing to remove from integration resource causing a failure. But if I run the same apply command immediately, its executing properly as parameter and method id already removed.
Relevant Error/Panic Output Snippet
module.api_gateway_deployment_module.aws_wafv2_web_acl_association.api_gateway_waf_association: Destroying... [id=arn:aws:wafv2:us-west-2:134567476717:regional/webacl/spotter-data-api-de-dev-pub-waf/833a358a-ace6-4e12-b85e-bec7ad816ed3,arn:aws:apigateway:us-west-2::/restapis/oihadyzjnf/stages/dev]
module.api_gateway_deployment_module.aws_wafv2_web_acl_association.api_gateway_waf_association: Destruction complete after 1s
module.api_gateway_resources_module.aws_api_gateway_method.api_gateway_method: Modifying... [id=agm-oihadyzjnf-79r2xs-ANY]
╷
│ Error: updating API Gateway Integration: operation error API Gateway: UpdateIntegration, https response error StatusCode: 400, RequestID: 838b10d1-cbcf-49c7-9acb-cbbf98a7ff86, BadRequestException: Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression parameter specified: method.request.querystring.name]
│
│ with module.api_gateway_resources_module.aws_api_gateway_method.api_gateway_method,
│ on ../modules/api_gateway_proxy_resources/api_gateway_resource.tf line 18, in resource "aws_api_gateway_method" "api_gateway_method":
│ 18: resource "aws_api_gateway_method" "api_gateway_method" {
You can create an aws api reaource and have a proxy method integration with utmquery string parameters. Once parameters are added from TF you can try to remove one of the parameters from TF code then you will get hit with this error. I have shared the complete block of method and integration resources.
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
Terraform Core Version
v1.9.8
AWS Provider Version
registry.terraform.io/hashicorp/aws v5.72.1
Affected Resource(s)
module.api_gateway_resources_module.aws_api_gateway_integration.api_gateway_integration: Modifying... [id=agi-oihadyzjnf-79r2xs-ANY]
Expected Behavior
I was expected the stack to remove the parameters from the method and integration resources.
Actual Behavior
Instead it is removing from method and failing to remove from integration resource causing a failure. But if I run the same apply command immediately, its executing properly as parameter and method id already removed.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
resource "aws_api_gateway_method" "api_gateway_method" { rest_api_id = var.rest_api_id resource_id = aws_api_gateway_resource.api_gateway_resource.id http_method = "ANY" authorization = "NONE" request_parameters = merge( { "method.request.path.proxy" = true },
{ for _path_param in var.path_param : "method.request.path.${_path_param}" => true },
)
lifecycle { create_before_destroy = true }
depends_on = [ aws_api_gateway_resource.api_gateway_resource] }
resource "aws_api_gateway_integration" "api_gateway_integration" { rest_api_id = var.rest_api_id resource_id = aws_api_gateway_resource.api_gateway_resource.id http_method = aws_api_gateway_method.api_gateway_method.http_method integration_http_method = "ANY" type = "HTTP_PROXY" uri = "https://${var.uri}/{proxy}" connection_type = "VPC_LINK" connection_id = var.vpc_link_id cache_key_parameters = concat( ["method.request.path.proxy", "integration.request.path.proxy", "integration.request.header.Host"],
[for _path_param in var.path_param : "method.request.path.${_path_param}"],
) request_parameters = merge ({ "integration.request.path.proxy" = "method.request.path.proxy" "integration.request.header.Host" = "'${var.uri}'" }, { for param in var.utm_params : "integration.request.querystring.${param}" => "method.request.querystring.${param}" } )
lifecycle { create_before_destroy = true }
}
Steps to Reproduce
You can create an aws api reaource and have a proxy method integration with utmquery string parameters. Once parameters are added from TF you can try to remove one of the parameters from TF code then you will get hit with this error. I have shared the complete block of method and integration resources.
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None