Skip to content

cd: debug

cd: debug #14

Workflow file for this run

name: Terraform Deployment
on:
push:
branches:
- develop
- main
jobs:
terraform:
runs-on: ubuntu-latest
# env:
# AWS_REGION: sa-east-1
# TERRAFORM_S3_STATEFILE_BUCKET: buildrun-sa-east-1-terraform-s3-statefile
# TERRAFORM_DYNAMODB_LOCK_TABLE: buildrun-terraform-state-lock
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.8.3
- name: debug
run: |

Check failure on line 32 in .github/workflows/terraform.yml

View workflow run for this annotation

GitHub Actions / Terraform Deployment

Invalid workflow file

The workflow is not valid. .github/workflows/terraform.yml (Line: 32, Col: 14): Unrecognized named-value: 'CONTEXT'. Located at position 1 within expression: CONTEXT.$AWS_REGION
pwd &&
ls &&
echo ${{ CONTEXT.$AWS_REGION }} &&
echo $AWS_REGION &&
echo $TERRAFORM_S3_STATEFILE_BUCKET &&
echo $TERRAFORM_DYNAMODB_LOCK_TABLE
- name: Terraform Init
run: |
env && cd infra && terraform init
- name: Terraform Validate
run: terraform validate
- name: Terraform Create/Select Dev Workspace
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
id: select-dev-workspace
run: |
terraform workspace list | grep -q "dev" || terraform workspace new dev
terraform workspace select dev
- name: Terraform Plan for Dev
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
id: terraform-plan-dev
run: terraform plan -var-file="./envs/dev/terraform.tfvars" -out=dev.plan
- name: Terraform Apply for Dev
id: terraform-apply-dev
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
run: terraform apply dev.plan --auto-approve
- name: Terraform Create/Select Prod Workspace
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
id: select-prod-workspace
run: |
terraform workspace list | grep -q "prod" || terraform workspace new prod
terraform workspace select prod
- name: Terraform Plan for Prod
id: terraform-plan-prod
run: pwd && ls && && terraform plan -var-file="./envs/prod/terraform.tfvars" -out=prod.plan
- name: Terraform Apply for Prod
id: terraform-apply-prod
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply prod.plan --auto-approve