Skip to content

Commit c3f2f25

Browse files
Update use of variable
- Variable was originally inserted on main but was accidnetally removed during merge conflict - Add a default value to the variable to simplify local development
1 parent 8e4020a commit c3f2f25

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.github/workflows/deploy-infrastructure.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
required: false
2222
type: string
2323
git_ref_to_deploy:
24-
required: true
24+
required: false
2525
type: string
2626

2727
workflow_call:
@@ -48,6 +48,7 @@ env:
4848
|| 'arn:aws:iam::393416225559:role/GithubDeployMavisAndInfrastructure' }}
4949
aws_account_id: ${{ inputs.environment == 'production'
5050
&& '820242920762' || '393416225559' }}
51+
git_ref_to_deploy: ${{ inputs.git_ref_to_deploy || github.ref_name }}
5152

5253
defaults:
5354
run:
@@ -63,7 +64,7 @@ jobs:
6364
- name: Checkout code
6465
uses: actions/checkout@v4
6566
with:
66-
ref: ${{ inputs.image_tag || github.sha }}
67+
ref: ${{ env.git_ref_to_deploy }}
6768
- name: Configure AWS Credentials
6869
uses: aws-actions/configure-aws-credentials@v4
6970
with:
@@ -88,7 +89,7 @@ jobs:
8889
- name: Checkout code
8990
uses: actions/checkout@v4
9091
with:
91-
ref: ${{ inputs.image_tag || github.sha }}
92+
ref: ${{ env.git_ref_to_deploy }}
9293
- name: Configure AWS Credentials
9394
uses: aws-actions/configure-aws-credentials@v4
9495
with:
@@ -115,7 +116,7 @@ jobs:
115116
- name: Checkout code
116117
uses: actions/checkout@v4
117118
with:
118-
ref: ${{ inputs.image_tag || github.sha }}
119+
ref: ${{ env.git_ref_to_deploy }}
119120
- name: Configure AWS Credentials
120121
uses: aws-actions/configure-aws-credentials@v4
121122
with:
@@ -148,15 +149,13 @@ jobs:
148149
run: sudo snap install --classic aws-cli
149150
- name: Check if any deployments are running
150151
run: ../scripts/check-for-running-deployments.sh ${{ inputs.environment }}
151-
- name: Set Mavis app version
152-
run: |
153-
echo "APP_VERSION=${{ inputs.git_ref_to_deploy }}" >> $GITHUB_ENV
154152
- name: Terraform Plan
155153
id: plan
156154
run: |
157155
set -e
158156
terraform init -backend-config="env/${{ inputs.environment }}-backend.hcl" -upgrade
159-
terraform plan -var="image_digest=$DIGEST" -var-file="env/${{ inputs.environment }}.tfvars" \
157+
terraform plan -var="image_digest=$DIGEST" -var="app_version=${{ env.git_ref_to_deploy }}" \
158+
-var-file="env/${{ inputs.environment }}.tfvars" \
160159
-out ${{ runner.temp }}/tfplan &> ${{ runner.temp }}/tf_stdout
161160
TF_EXIT_CODE=$?
162161
cat ${{ runner.temp }}/tf_stdout
@@ -182,7 +181,7 @@ jobs:
182181
- name: Checkout code
183182
uses: actions/checkout@v4
184183
with:
185-
ref: ${{ inputs.image_tag || github.sha }}
184+
ref: ${{ env.git_ref_to_deploy }}
186185
- name: Configure AWS Credentials
187186
uses: aws-actions/configure-aws-credentials@v4
188187
with:

terraform/app/variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ variable "enable_splunk" {
160160
variable "app_version" {
161161
type = string
162162
description = "The version identifier for the MAVIS application deployment"
163+
default = "NA"
163164
nullable = false
164165
}
165166

0 commit comments

Comments
 (0)