New GitHub workflows for Terragrunt deployment.
New GitHub workflows for Terragrunt deployment.
Change Summary
This commit introduces two new GitHub Actions workflows (deploy.yml and plan.yml) for automating the deployment and planning phases of a Terraform project using Terragrunt. Additionally, it updates a configuration file (kube.hcl) to use a more robust method for expanding the Kubernetes configuration path, and adds a mise.toml file to manage tool versions.
Technical Details
- deploy.yml:
- This workflow is triggered by pushes to the
mainbranch or manually viaworkflow_dispatch. - It performs a series of checks and deploys infrastructure using Terragrunt.
- Key steps include checking out the code, validating Terragrunt HCL, configuring AWS credentials, and running
terragrunt apply.
- This workflow is triggered by pushes to the
- plan.yml:
- This workflow is triggered by pull requests targeting the
mainbranch. - It performs checks and generates a Terraform plan using Terragrunt.
- Similar steps to
deploy.yml, but runsterragrunt planinstead ofapply.
- This workflow is triggered by pull requests targeting the
- kube.hcl:
- Updates the Kubernetes provider configuration to use
pathexpandfor the config path, ensuring compatibility across different environments.
- Updates the Kubernetes provider configuration to use
- mise.toml:
- Introduces version management for Terragrunt and OpenTofu using the
misetool. - Specifies versions
0.91.1for Terragrunt and1.11.1for OpenTofu.
- Introduces version management for Terragrunt and OpenTofu using the
Key Learnings & Insights
- Automation Benefits:
- Automating deployment and planning phases reduces manual errors and ensures consistency.
- Using GitHub Actions for CI/CD pipelines enhances collaboration and maintains up-to-date infrastructure.
- Path Management:
- Utilizing
pathexpandfor configuration paths improves cross-platform compatibility and robustness.
- Utilizing
- Version Management:
- Managing tool versions with
miseensures that the development environment remains consistent and up-to-date.
- Managing tool versions with
Impact Assessment
- Performance:
- Automation should lead to faster and more reliable deployments.
- Security:
- Using GitHub Secrets for sensitive information (e.g., AWS credentials, Tailscale auth key) enhances security.
- Maintainability:
- Clear separation of deployment and planning workflows improves maintainability and allows for easier troubleshooting.
Developer Notes
- Gotchas:
- Ensure that all required secrets are properly configured in the GitHub repository settings.
- Validate that the IAM role specified has the necessary permissions for Terraform operations.
- Future Improvements:
- Consider adding additional checks (e.g., linting, security scans) to the workflows.
- Explore integrating more comprehensive logging and monitoring for the deployment process.
This post is licensed under CC BY 4.0 by the author.