Skip to content

Commit

Permalink
use var.STAGE instead of env.STAGE
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Varner committed May 17, 2024
1 parent bff9af0 commit 673b540
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
echo ' encrypt = true' >> config.s3.backend.tf
echo " bucket = \"${{ secrets.TF_STATE_BUCKET }}\"" >> config.s3.backend.tf
echo " dynamodb_table = \"${{ secrets.TF_STATE_LOCK_TABLE }}\"" >> config.s3.backend.tf
echo " key = \"${{ env.project-name }}-${{ env.stage }}.tfstate\"" >> config.s3.backend.tf
echo " key = \"${{ env.project-name }}-${{ var.STAGE }}.tfstate\"" >> config.s3.backend.tf
echo " region = \"${{ secrets.AWS_REGION }}\"" >> config.s3.backend.tf
echo ' }' >> config.s3.backend.tf
echo '}' >> config.s3.backend.tf
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:

- name: Terraform Plan
id: tf_plan
run: terraform plan -var-file="${{ env.stage }}.tfvars" -out ${{ env.stage }}.tfplan -lock=false
run: terraform plan -var-file="${{ var.STAGE }}.tfvars" -out ${{ var.STAGE }}.tfplan -lock=false

- name: Configure Terraform Apply Credentials
id: apply_creds
Expand All @@ -81,7 +81,7 @@ jobs:

- name: Terraform Apply
id: tf_apply
run: terraform apply -lock=false -input=false ${{ env.stage }}.tfplan
run: terraform apply -lock=false -input=false ${{ var.STAGE }}.tfplan

- name: Post status to Slack channel
id: tf_apply_successs
Expand All @@ -90,7 +90,7 @@ jobs:
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: ":badger_dance: ${{ env.project-name }}-${{ env.stage }}-titiler ${{ github.ref_name }} terraform apply job has succeeded!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
slack-message: ":badger_dance: ${{ env.project-name }}-${{ var.STAGE }}-titiler ${{ github.ref_name }} terraform apply job has succeeded!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

Expand All @@ -101,7 +101,7 @@ jobs:
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: ":sadpanda: ${{ env.project-name }}-${{ env.stage }}-titiler ${{ github.ref_name }} terraform apply has failed!\n:alert: make sure cleanup job deletes all AWS resources!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
slack-message: ":sadpanda: ${{ env.project-name }}-${{ var.STAGE }}-titiler ${{ github.ref_name }} terraform apply has failed!\n:alert: make sure cleanup job deletes all AWS resources!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
echo ' encrypt = true' >> config.s3.backend.tf
echo " bucket = \"${{ secrets.TF_STATE_BUCKET }}\"" >> config.s3.backend.tf
echo " dynamodb_table = \"${{ secrets.TF_STATE_LOCK_TABLE }}\"" >> config.s3.backend.tf
echo " key = \"${{ env.project-name }}-${{ env.stage }}.tfstate\"" >> config.s3.backend.tf
echo " key = \"${{ env.project-name }}-${{ var.STAGE }}.tfstate\"" >> config.s3.backend.tf
echo " region = \"${{ secrets.AWS_REGION }}\"" >> config.s3.backend.tf
echo ' }' >> config.s3.backend.tf
echo '}' >> config.s3.backend.tf
Expand Down Expand Up @@ -164,7 +164,7 @@ jobs:

- name: Terraform Plan
id: tf_plan
run: terraform plan -var-file="${{ env.stage }}.tfvars" -out ${{ env.stage }}.tfplan -lock=false
run: terraform plan -var-file="${{ var.STAGE }}.tfvars" -out ${{ var.STAGE }}.tfplan -lock=false

- name: Configure Terraform Apply Credentials
id: apply_creds
Expand All @@ -176,7 +176,7 @@ jobs:

- name: Terraform Apply
id: tf_apply
run: terraform apply -lock=false -input=false ${{ env.stage }}.tfplan
run: terraform apply -lock=false -input=false ${{ var.STAGE }}.tfplan

- name: Post status to Slack channel
id: tf_apply_successs
Expand All @@ -185,7 +185,7 @@ jobs:
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: ":badger_dance: ${{ env.project-name }}-${{ env.stage }}-titiler ${{ github.ref_name }} terraform apply job has succeeded!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
slack-message: ":badger_dance: ${{ env.project-name }}-${{ var.STAGE }}-titiler ${{ github.ref_name }} terraform apply job has succeeded!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

Expand All @@ -196,6 +196,6 @@ jobs:
uses: slackapi/slack-github-action@v1.26.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: ":sadpanda: ${{ env.project-name }}-${{ env.stage }}-titiler ${{ github.ref_name }} terraform apply has failed!\n:alert: make sure cleanup job deletes all AWS resources!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
slack-message: ":sadpanda: ${{ env.project-name }}-${{ var.STAGE }}-titiler ${{ github.ref_name }} terraform apply has failed!\n:alert: make sure cleanup job deletes all AWS resources!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 comments on commit 673b540

Please sign in to comment.