Repository navigation
Fix the Terraform deploy and test both container APIs in CI - #14
Merged
Merged
Conversation
The private DNS namespace got the VPC ARN instead of its ID, so the Terraform job hung for 50 minutes and failed. Fix that and the JWT audience, wait for the CloudFormation stack, and replace the resource listing with a test that calls both APIs with and without a Cognito token. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
The CloudFormation template does not name its user pool. Temporarily enable debug logs to see why the ECS tasks are missing from Cloud Map. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
CloudFormation generates the cluster name. Temporary experiment: register a foodstore container with AWS_INSTANCE_PORT to see whether API Gateway then reaches it. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
The experiment showed API Gateway ignores AWS_INSTANCE_PORT, which is a LocalStack bug the sample cannot work around. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
…n URL" This reverts commit b277edd.
…74 fix" This reverts commit e0eaf76.
The CloudFormation template leaves the table names to CloudFormation (stack1-DynamoDBTableFoodstoreFo-<hex>), so the fixed FoodStoreFoods and PetStorePets names only matched the Terraform deploy. Both deploys pass the table to the containers as the DynamoDBTable environment variable, so take it from there. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
The API Gateway private integration fix (request path forwarded to the Cloud Map instance) is in localstack/localstack-pro:dev but not yet in latest (2026.10.0), so both jobs fail at the first API call on latest. Both jobs pass on dev (2026.11.0.dev156). Switch back to the default image once a release includes the fix. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI deployed the stack but only listed the API and user pool. The Terraform job also failed on every run since March, after hanging for about 50 minutes.
CI runs on the LocalStack dev image until a release includes the API Gateway fixes below. The deploy works with both Terraform and CloudFormation, and on a LocalStack build that has the fixes both jobs pass
make test.Terraform fixes:
aws_service_discovery_private_dns_namespacegotaws_vpc.vpc.arn. Cloud Map needs the VPC ID, so namespace creation failed withInvalidVPCId(returned as a 500, which the provider retried for 50 minutes). It now usesaws_vpc.vpc.id, matching the CloudFormation template's!Ref VPC. The apply now takes about 2 minutes.client_idmust match the audience.api_test_pageoutput passed the pool ARN and client secret where the web client expects the pool ID and client ID.Test:
test.sh(make test) waits for both ECS services to run tasks, signs up, confirms and logs in a Cognito user, then for the foodstore and petstore APIs:GETon an unknown item returns{}PUTwithout a token returns 401PUTwith the access token stores the itemGETand the DynamoDB table return the stored itemDynamoDBTablevariable in the task definitions, since the CloudFormation template does not name them.make cloudformation-setupand the CloudFormation job now wait forCREATE_COMPLETE.make test, time out after 30 minutes, and on failure print the Cloud Map instances, ECS tasks and LocalStack logs.make test.LocalStack bugs that blocked the API calls:
AWS_INSTANCE_PORTand sent requests to port 80, and ECS service registries registered tasks without the port (and not all of them).http://<task ip>:8080instead ofhttp://<task ip>:8080/foodstore/foods/<id>, and the containers returned 404.Both are fixed in LocalStack, but the path fix is not in
latest(2026.10.0) yet. Run locally againstlocalstack/localstack-pro:dev, the Terraform deploy passed everymake testcheck on 2026.11.0.dev116, and the CloudFormation deploy passed with thistest.shon 2026.11.0.dev119. Both jobs pass on 2026.11.0.dev156 as well, so until a release includes the fix both CI jobs run onlocalstack/localstack-pro:dev. Switch them back to the default image (lstk startwithout--image) once it ships.