Skip to content

Change the place where we get vars from github #5

Change the place where we get vars from github

Change the place where we get vars from github #5

Workflow file for this run

name: IAC Deploy
on:
push:
branches:
- main
paths:
- "iac/**"
- ".github/workflows/iacdeploy.yaml"
env:
STAGE: prod
AWS_DEFAULT_REGION: ${{ secrets.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 }}
IAC_BUCKET_NAME: ${{ env.IAC_BUCKET_NAME }}

Check failure on line 16 in .github/workflows/iacdeploy.yaml

View workflow run for this annotation

GitHub Actions / IAC Deploy

Invalid workflow file

The workflow is not valid. .github/workflows/iacdeploy.yaml (Line: 16, Col: 20): Unrecognized named-value: 'env'. Located at position 1 within expression: env.IAC_BUCKET_NAME
defaults:
run:
working-directory: iac
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
- name: Replace bucket name
run: |
sed -i "s|bucket = \"NON-EXISTING-BUCKET\"|bucket = \"$IAC_BUCKET_NAME\"|g" main.tf
cat main.tf
- run: terraform init
- name: Select workspace and apply app
run: |
terraform workspace select $STAGE || terraform workspace new $STAGE
terraform apply --auto-approve