GitHub Actions for Terragrunt with OpenTofu.
GitHub Actions for Terragrunt with OpenTofu.
Change Summary
This update introduces new GitHub Actions workflows for deploying and planning infrastructure changes using Terragrunt and OpenTofu. Additionally, it configures specific tool versions in the mise.toml file.
Technical Details
- deploy.yml:
- Triggers: Activated on
workflow_dispatchandpushevents to themainbranch. - Jobs:
- checks:
- Checks out the repository.
- Verifies the HCL format of Terragrunt files.
- deploy:
- Depends on the
checksjob. - Configures AWS credentials.
- Sets up Tailscale.
- Installs Terragrunt and OpenTofu.
- Executes
terragrunt applyin the specified working directory.
- Depends on the
- checks:
- Triggers: Activated on
- plan.yml:
- Triggers: Activated on
workflow_dispatchand variouspull_requestevents on themainbranch. - Jobs:
- checks:
- Similar to
deploy.yml, it checks out the repository and verifies HCL format.
- Similar to
- plan:
- Depends on the
checksjob. - Installs Terragrunt and OpenTofu.
- Configures AWS credentials.
- Sets up Tailscale.
- Uses
kubectlto interact with Kubernetes. - Executes
terragrunt planin the specified working directory.
- Depends on the
- checks:
- Triggers: Activated on
- mise.toml:
- Specifies versions for
terragrunt(0.91.1) andopentofu(1.11.1).
- Specifies versions for
Key Learnings & Insights
- Automation: The workflows automate the deployment and planning processes, reducing manual intervention and potential errors.
- Consistency: Using GitHub Actions ensures consistent environment setup and execution across different runs.
- Security: The workflows securely manage AWS credentials and Tailscale configuration using GitHub Secrets.
- Tool Management:
mise.tomlensures that specific tool versions are used, promoting reproducibility and stability.
Impact Assessment
- Efficiency: Automates repetitive tasks, speeding up the deployment and planning processes.
- Reliability: Reduces the risk of human error in infrastructure management.
- Maintainability: Clear separation of concerns between deployment and planning workflows makes future modifications easier.
Developer Notes
- Dependencies: Ensure that the specified versions of Terragrunt and OpenTofu are compatible with your infrastructure setup.
- Secrets Management: Regularly review and update the secrets used in the workflows to maintain security.
- Error Handling: Consider adding error handling and notifications to the workflows for better monitoring and alerting.
This post is licensed under CC BY 4.0 by the author.