Well-Architected Framework
Define your CI/CD infrastructure
Before you can automate your CI/CD processes, you need to clearly define what CI/CD systems and infrastructure you need. Using infrastructure as code to define your CI/CD infrastructure creates a consistent, version-controlled specification that can be reviewed, tested, and automated.
Define your CI/CD systems with Terraform
When you use Terraform to define your CI/CD infrastructure, you can manage the CI/CD system's configuration through version control and create a defined approval process for system modifications. This approach increases reliability and security by adding audit logs for configuration changes.
CI/CD systems use build agents to run jobs like building software or deploying infrastructure. CI/CD tools like GitHub and GitLab often offer build agents as a service, but you can also manage build agents yourself for greater control over hardware, operating system, and software tools. Use Packer to create machine images with pre-installed agents and software, then use Terraform to create the infrastructure for your build agents, including VMs or container clusters to host your build agents, networking and security for build agent access, and scaling and resource management for build capacity.
Define consistent CI/CD environments across your development, staging, and production workflows. For development, define build servers and agents for development builds, configure integration testing and validation, and set up development-specific security and access controls. For staging, define build infrastructure for staging deployments, configure staging-specific testing and validation, and set up staging environment promotion processes. For production, define production build and deployment infrastructure, configure production-specific security and compliance, and set up production deployment approval processes.
Next steps
In this section of Codify infrastructure and tools, you learned about using infrastructure as code to define your CI/CD infrastructure, and how Terraform can help you. Define your CI/CD infrastructure is part of the Define and automate processes pillar.
Refer to the following documents to learn more about infrastructure definition:
- Define infrastructure as code to understand infrastructure as code principles
- Implement CI/CD to implement CI/CD for continuous delivery of infrastructure and applications
If you are interested in learning more about CI/CD infrastructure, you can check out the following resources:
- List of CI/CD providers in the Terraform Registry
- Terraform GitLab and GitHub providers
- Terraform GitHub Actions - Automate Terraform with GitHub Actions