Best Practices for Configuration as Code
Start with a small setup, and add a practice when your setup needs it.
| Applies To | Practice |
|---|---|
| All setups | Keep the manifest and all resource files in Git. |
| All setups | Keep secret values out of Git. Use ${VAR} or vault://. |
| Staging and production | Use one Agent Mesh deployment and one manifest for each environment, on one branch. |
| Staging and production | Let only a pipeline apply to staging and production, with an API key that belongs to a system user. Keep the production API key in a protected CI/CD environment. |
| Staging and production | Run sam config plan for each pull request, and apply on merge. Release to production only a commit that the pipeline applied to staging. |
| Staging and production | Use --prune only when this repository is the only source of changes to the deployment and the manifest lists every resource of its kinds on the deployment, including the built-in agents. Otherwise, delete each removed resource yourself. |
| Several teams | Keep the resources of each team in its own repository, with a team prefix on each name. |
| Several teams | Keep the environment manifests and shared resources in a platform repository that administrators own. Store the API keys in the CI/CD environments of its pipeline. Import team resources with sources, pinned to full commit IDs. |
Further Reading
What Next?
To set up one team with several environments, see Promoting Changes Between Environments. To add more teams, see Scaling to Several Teams.