Added GitHub workflows for deploy and plan.
Added GitHub workflows for deploy and plan.
Change Summary
This update introduces two new GitHub Actions workflows for deploying and planning infrastructure using Terragrunt, along with the addition of a mise.toml configuration file specifying tool versions.
Technical Details
- Workflows Added:
.github/workflows/deploy.yml: Automates the deployment of infrastructure using Terragrunt..github/workflows/plan.yml: Automates the planning phase of infrastructure changes using Terragrunt.
- Workflow Triggers:
deploy.ymlis triggered onworkflow_dispatchandpushto themainbranch.plan.ymlis triggered onworkflow_dispatchand specificpull_requestevents on themainbranch.
- Environment Configuration:
- Both workflows set an environment variable
working_dirtoIaC/production/homelab.
- Both workflows set an environment variable
- Jobs and Steps:
- Both workflows include a
checksjob to verify Terragrunt HCL formatting. - The
deployjob indeploy.ymland theplanjob inplan.ymlconfigure AWS credentials and execute Terragrunt commands (applyfor deployment andplanfor planning).
- Both workflows include a
- mise.toml:
- Specifies versions for
terragrunt(0.91.1) andopentofu(1.11.1).
- Specifies versions for
Key Learnings & Insights
- Automation of Infrastructure Management:
- The introduction of these workflows streamlines the deployment and planning processes, ensuring consistency and reducing manual errors.
- Version Management:
- Using
mise.tomlto pin tool versions enhances reproducibility and maintains a stable development environment.
- Using
- CI/CD Best Practices:
- Implementing checks before deployment or planning ensures that only valid configurations are applied, adhering to CI/CD best practices.
Impact Assessment
- Efficiency:
- Automates repetitive tasks, saving time and reducing the potential for human error.
- Consistency:
- Ensures that infrastructure changes are applied consistently across environments.
- Security:
- Uses role-based AWS credentials to enhance security by limiting access.
Developer Notes
- Gotchas:
- Ensure that secrets (
TS_OAUTH_CLIENT_ID,TS_OAUTH_SECRET) are properly configured in the GitHub repository settings.
- Ensure that secrets (
- Future Improvements:
- Consider adding additional checks or steps to further validate configurations before deployment.
- Explore integrating more comprehensive logging or notifications for workflow statuses.
This post is licensed under CC BY 4.0 by the author.