action #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform Terragrunt Action | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: # Triggered manually from GitHub UI | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Print HOME directory | |
run: | | |
echo "The HOME directory is: $HOME" | |
ls -la $HOME | |
- name: Set up Terraform CLI | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: 1.8.0 | |
terraform_wrapper: true | |
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | |
- name: Set up Terragrunt CLI | |
run: | | |
wget -qO /tmp/terragrunt https://github.com/gruntwork-io/terragrunt/releases/download/v0.57.0/terragrunt_linux_amd64 | |
sudo chmod +x /tmp/terragrunt | |
sudo mv /tmp/terragrunt /usr/local/bin/terragrunt | |
echo "✅ Terragrunt CLI setup completed!" | |
- name: Run symlink-modules.sh | |
run: | | |
./symlink-modules.sh | |
echo "🔗 Symlink modules and workspace selection completed!" | |
- name: Terragrunt init | |
run: | | |
cd ./environment/stage | |
terragrunt init | |
echo "🔧 Terragrunt init completed!" | |
- name: Terragrunt plan | |
run: | | |
cd ./environment/stage | |
terragrunt plan | |
echo "📝 Terragrunt plan completed!" | |
- name: Display success message | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "🚀 Terraform Terragrunt Action triggered manually!" |