Change the place where we get vars from github #5
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: 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 GitHub Actions / IAC DeployInvalid workflow file
|
||
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 |