choudharyrahul
20 days agoNew Contributor
OpenApi Spec for AWS ApiGateway doesn't allow 1 attribute to read its value dynamically
We opened a Ticket for AWS but they mention its related to OpenApi Spec so adding details here of that ticket:
We follow doc and found issue
Under "x-amazon-apigateway-integration" doc mentions "integration-target" or "integrationTarget"
If we replace integrationTarget from hardcoded ALB Arn and try to use dynamic ex using Stage Variable like ${stageVariables.ALB_ARN} :
Terraform Plan shows: resource "aws_api_gateway_rest_api" "rest_api" { ~ body = jsonencode( ~ { ~ paths = { ~ "/prx/version" = { ~ get = { ~ x-amazon-apigateway-integration = { ~ integrationTarget = "arn:aws:elasticloadbalancing:eu-west-1:590184133945:loadbalancer/app/legacy-service-priv-dev/69014ccf971cb582" -> "${stageVariables.legacyServiceAlbArn}"
Terrafom Apply gives error: module.api_gateway_all_private.aws_api_gateway_rest_api.rest_api: Modifying... [id=889jk5o63f] ╷ │ Error: updating API Gateway REST API (889jk5o63f) specification: operation error API Gateway: PutRestApi, https response error StatusCode: 400, RequestID: 9ebcf1c5-688e-4b19-8935-40d436904592, BadRequestException: Errors found during import: │ Unable to put integration on 'GET' for resource at path '/prx/version': ${stageVariables.legacyServiceAlbArn} is not a valid ALB or NLB arn
So basically open api spec doesn't support integrationTarget to read dynamically which is a issue, where as uri & connectionId are allowed to read value dynamically.