This week, we’re focusing on building CI/CD pipelines to automate infrastructure and application deployments. Get ready to master:
- Cloud cost optimization with cost estimation tools like InfraCost.
- GitOps workflows for seamless automation.
- Terraform + Ansible integration for infrastructure management and monitoring stack setup.
- Git branching strategies for streamlined CI/CD pipelines.
- Use Terraform to provision the cloud infrastructure required for the application.
- Automatically trigger Ansible to set up the monitoring stack (Prometheus, Grafana, Loki, etc.).
- Continue working with the three-tier application stack from Week 1.
You’ll work with the following branches:
-
Infrastructure Pipelines:
infra_features
: Used for writing and testing Terraform changes.infra_main
: Main branch for infrastructure.
-
Application Pipelines:
integration
: Contains the CI pipeline for building and tagging images.deployment
: Contains the CD pipeline for deploying the application stack.
Branches: infra_features
→ infra_main
- Push to
infra_features
:- Run
terraform validate
to check the correctness of configurations.
- Run
- PR to
infra_main
:- Trigger
terraform plan
, output the plan as a comment in the PR, including cost estimation (e.g., using InfraCost).
- Trigger
- Merge to
infra_main
:- Run
terraform apply
with auto-approval to provision resources. - Trigger Ansible to deploy the monitoring stack on the provisioned infrastructure.
- Run
Branches: integration
→ deployment
-
Push to
integration
:- Build and tag Docker images for the application.
- Push images to a public Docker Hub repository.
- Update
docker-compose.yml
with the new image tags and commit the changes.
-
Merge from
integration
todeployment
:- Deploy the application stack to the provisioned infrastructure.
- Use Terraform to automate:
- Validation, planning (with PR comments), and applying configurations.
- Include cost estimation in the PR plan output as a required component.
- Trigger Ansible to deploy the monitoring stack after Terraform apply.
- CI Pipeline (Integration Branch):
- Build and push Docker images to Docker Hub.
- Update
docker-compose.yml
with the new image tags and commit the change to the Integration Branch.
- CD Pipeline (Deployment Branch):
- Deploy the application stack to the cloud infrastructure.
-
Infrastructure Pipeline:
- Validation, planning (with PR comments, including cost estimation), and application workflows are functional.
- Ansible playbook is triggered to set up the monitoring stack after Terraform apply.
-
Application Pipeline:
- CI pipeline builds images, pushes to Docker Hub, updates
docker-compose.yml
and commits the change. - CD pipeline deploys the application stack to the cloud.
- CI pipeline builds images, pushes to Docker Hub, updates
-
Workflow Organization:
- Separate
.yml
files for each pipeline.- terraform-validate.yml
- terraform-plan.yml
- terraform-apply.yml
- ansible-monitoring.yml
- ci-application.yml
- cd-application.yml
- Separate
Submit your work via the GitHub repository link, including:
- Link to your github repo containing both the infrastructure and application workflows.
- Terraform and Ansible configurations.
- Screenshots of successful execution for all pipelines.
- A detailed blog post documenting your process, including an architectural diagram.
Here’s the updated README file with the link hidden behind text:
⏰ Deadline: Submit on or before Tuesday 11:59 PM. Submit Here.