Skip to content

Add IAC

Add IAC #1

Workflow file for this run

name: Test terraform
env:
STAGE: prod
ENV: -prod
AWS_DEFAULT_REGION: ${{ env.AWS_DEFAULT_REGION }}

Check failure on line 6 in .github/workflows/iactest.yaml

View workflow run for this annotation

GitHub Actions / Test terraform

Invalid workflow file

The workflow is not valid. .github/workflows/iactest.yaml (Line: 6, Col: 23): Unrecognized named-value: 'env'. Located at position 1 within expression: env.AWS_DEFAULT_REGION
AWS_ACCESS_KEY_ID: ${{ secrets.CI_CD_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_CD_AWS_SECRET_ACCESS_KEY }}
on:
pull_request:
branches:
- main
paths:
- "iac/**"
- ".github/workflows/iactest.yaml"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hashicorp/setup-terraform@v2
- name: Replace bucket name
run: |
sed -i "s|bucket = \"NON-EXISTING-BUCKET\"|bucket = \"${{ env.IAC_BUCKET_NAME }}\"|g" iac/main.tf
- run: terraform init
- name: Change workspace
run: |
terraform workspace select $STAGE || terraform workspace new $STAGE
- name: Plan
run: |
terraform plan -out tfapply