Terraform for mock AMAPI for loading testing#48919
Conversation
There was a problem hiding this comment.
Pull request overview
Adds Terraform infrastructure to support Android MDM load testing by deploying an internal Android AMAPI mock service and wiring loadtest Fleet to use it as a proxy endpoint (optionally forwarding real-device traffic to Google via a Secrets Manager credential).
Changes:
- Add a shared Secrets Manager secret for Android Google service account credentials and expose it via remote state output.
- Set
FLEET_DEV_ANDROID_PROXY_ENDPOINTin loadtest infra to point at the internal ALB. - Introduce a new
android_amapi_mockTerraform stack + Dockerfile to build/push/runcmd/android-amapi-mockbehind the internal ALB with/v1/*and/mock/*routing.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| infrastructure/loadtesting/terraform/shared/output.tf | Exports the Android Google credentials secret via shared remote state. |
| infrastructure/loadtesting/terraform/shared/enroll.tf | Adds a Secrets Manager secret resource intended for Android Google credentials. |
| infrastructure/loadtesting/terraform/infra/locals.tf | Sets FLEET_DEV_ANDROID_PROXY_ENDPOINT for the loadtest Fleet deployment. |
| infrastructure/loadtesting/terraform/docker/android-amapi-mock.Dockerfile | Builds android-amapi-mock from the Fleet repo for ECS deployment. |
| infrastructure/loadtesting/terraform/android_amapi_mock/variables.tf | Adds module inputs for git tag and forwarding toggle. |
| infrastructure/loadtesting/terraform/android_amapi_mock/outputs.tf | Outputs the internal URL to reach the mock via the internal ALB. |
| infrastructure/loadtesting/terraform/android_amapi_mock/main.tf | Provisions ECR image build/push, IAM policy for secrets, ECS service, and ALB routing rules for the mock. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| FLEET_MDM_SSO_RATE_LIMIT_PER_MINUTE = "500" | ||
| FLEET_SERVER_GZIP_RESPONSES = "true" | ||
|
|
||
| FLEET_DEV_ANDROID_PROXY_ENDPOINT = "http://${resource.aws_lb.internal.dns_name}/" |
There was a problem hiding this comment.
If Android MDM isn't configured in the DB, Fleet never makes AMAPI calls.
If Android MDM IS configured but the mock isn't deployed, the ALB returns a 404 or routes to Fleet which returns a 404 on /v1/*. Fleet's profile reconciliation cron retries every 30 seconds, no crash
Related issue: Resolves #26225
Testing