Skip to content

Conversation

@HVbajoria
Copy link

Summary

This PR migrates all usages of the deprecated LOCALSTACK_API_KEY environment variable to the new LOCALSTACK_AUTH_TOKEN to ensure continued authentication with LocalStack Pro services.

Background

The LOCALSTACK_API_KEY has been sunset and will no longer work for authentication. Without this migration, sample tests will fail due to authentication errors since the API key mechanism is deprecated. FIXES #262

Changes Made

Core Migration

  • .github/workflows/makefile.yml: Updated CI workflow to use LOCALSTACK_AUTH_TOKEN instead of LOCALSTACK_API_KEY
  • emr-serverless-python-dependencies/docker-compose.yml: Removed deprecated LOCALSTACK_API_KEY environment variable

Documentation Updates

  • testcontainers-java-sample/LocalStackTestcontainers/src/test/java/TestRDS.java: Updated variable name from api_key to authToken for consistency
  • sample-archive/spring-cloud-function-microservice/.env.example: Updated placeholder format from <your-pro=api-key> to <your-auth-token>
  • java-notification-app/README.md: Updated documentation to use <your-auth-token> format
  • route53-dns-failover/README.md: Updated documentation to use <your-auth-token> format

Testing Steps

1. Verification of Migration

# Confirmed no LOCALSTACK_API_KEY references remain
grep -r "LOCALSTACK_API_KEY" . --exclude-dir=.git
# Result: No matches found ✅

# Verified LOCALSTACK_AUTH_TOKEN is properly used
grep -r "LOCALSTACK_AUTH_TOKEN" . --exclude-dir=.git | wc -l
# Result: 40+ references found ✅

2. Local Testing

# Set up environment
export LOCALSTACK_AUTH_TOKEN=<auth-token>
pip install localstack[pro] awscli-local

# Test basic functionality
localstack start -d
localstack wait -t 30
awslocal s3 mb s3://test-migration
awslocal s3 ls
localstack stop
# Result: No authentication errors ✅

3. Sample Testing

# Test terraform sample
cd terraform-resources
export LOCALSTACK_AUTH_TOKEN=<auth-token>
make start && make ready && make run && make stop
# Result: Sample completed successfully ✅

# Test serverless sample  
cd serverless-lambda-layers
make test-ci
# Result: Lambda deployment and invocation successful ✅

4. Docker Compose Testing

# Test docker-compose integration
cd java-notification-app
export LOCALSTACK_AUTH_TOKEN=<auth-token>
docker-compose up -d
docker-compose logs localstack | grep -i error
# Result: No authentication errors in logs ✅

5. CI Workflow Validation

  • Verified GitHub workflow uses LOCALSTACK_AUTH_TOKEN: ${{ secrets.TEST_LOCALSTACK_AUTH_TOKEN }}
  • Confirmed secret name change from TEST_LOCALSTACK_API_KEY to TEST_LOCALSTACK_AUTH_TOKEN

Impact

  • ✅ All sample tests will continue to work with LocalStack Pro
  • ✅ No breaking changes for users (they just need to use the new environment variable)
  • ✅ Consistent authentication mechanism across all samples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from API Key to Auth Token for sample tests

2 participants