Support non-us-east-1 regions for terminator#333
Support non-us-east-1 regions for terminator#333jonpspri wants to merge 3 commits intomattclay:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds configurability and regional flexibility to the AWS “terminator” Lambda and associated test/deploy infrastructure so integration tests can run outside us-east-1 while still handling global AWS endpoints correctly.
Changes:
- Make terminator region (
TEST_REGION) and SSM test bucket name (SSM_BUCKET_NAME) configurable via environment variables (with defaults). - Add
region_nameoverride support to_create()and forceus-east-1for CloudFront-scoped WAFv2 list operations. - Update IAM policy structure for global WAF/WAFv2 endpoints and add an Ansible step to ensure the persistent SSM test bucket exists; rename and ignore local
aws/config.yml.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
aws/terminator/storage_services.py |
Uses SSM_BUCKET_NAME constant for S3 ignore/cleanup behavior. |
aws/terminator/application_security.py |
Forces WAFv2 CloudFront scope discovery via us-east-1 client region override. |
aws/terminator/__init__.py |
Reads TEST_REGION/SSM_BUCKET_NAME from env and adds optional region_name to _create(). |
aws/terminator.yml |
Passes new env vars into the terminator Lambda configuration. |
aws/policy/application-security.yaml |
Splits global WAF Classic + WAFv2 read/list actions into non-region-restricted statements. |
aws/deploy-test-policy.yml |
Adds Ansible task to create the persistent encrypted S3 bucket for SSM plugin tests. |
aws/config.yml.example |
Provides example config including ssm_bucket_name. |
.gitignore |
Ignores local aws/config.yml (and .envrc). |
Comments suppressed due to low confidence (1)
aws/terminator/storage_services.py:66
paginate_objectsinitializesbucket_contentsas{}but returnslist_bucket_objects_result['Contents'](a list) when present. Returning a consistent list type (e.g.,[]when empty) avoids confusing callers and makes the behavior/type expectations clearer.
list_bucket_objects_result = client.get_paginator('list_objects_v2').paginate(Bucket=SSM_BUCKET_NAME).build_full_result()
bucket_contents = {}
if list_bucket_objects_result.get('Contents'):
bucket_contents = list_bucket_objects_result['Contents']
return bucket_contents
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a87d6aa to
4eec831
Compare
4eec831 to
2b6a3df
Compare
Add early assertion for ssm_bucket_name in both deploy-test-policy.yml and terminator.yml to surface a clear error if the variable is missing from config.yml.
|
@jonpspri Is there a PR that these changes are in support of? |
|
Not directly. I'm working in Biggest challenge was "global" services that always expect us-east-1 regardless of what region you're calling from (e.g. waf, part of waf2). |
Summary
TEST_REGIONenvironment variable (default:us-east-1)SSM_BUCKET_NAMEenvironment variable (default:ssm-encrypted-test-bucket)_create()region override for global AWS services (CloudFront-scoped WAFv2)deploy-test-policy.ymlconfig.ymltoconfig.yml.exampleand gitignore the real config (contains account IDs)Test plan
deploy-test-policy.yml