From 3d70eeeaeae146ad44d4986b47edf9ab0a3398ee Mon Sep 17 00:00:00 2001 From: Thomas Kula Date: Tue, 5 Sep 2023 13:15:02 -0400 Subject: [PATCH] IL-878 Fix GHA Variable name upcasing --- .github/workflows/infrastructure-tests.yml | 36 ++++++++++++---------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/.github/workflows/infrastructure-tests.yml b/.github/workflows/infrastructure-tests.yml index fc61ed49f..ecf386668 100644 --- a/.github/workflows/infrastructure-tests.yml +++ b/.github/workflows/infrastructure-tests.yml @@ -48,12 +48,13 @@ jobs: # e.g. .terraform/providers/registry.terraform.io/hashicorp/null/3.2.1/linux_amd64/terraform-provider-null_v3.2.1_x5 chmod +x .terraform/providers/*/*/*/*/*/terraform-provider-* - name: set TF vars if set + # GH upcases variable names, that's why this looks odd.... run: |- - if [ -n "${{ vars.TF_VAR_location }}" ]; then - echo "TF_VAR_location=${{ vars.TF_VAR_location}}" >> "${GITHUB_ENV}" + if [ -n "${{ vars.TF_VAR_LOCATION }}" ]; then + echo "TF_VAR_location=${{ vars.TF_VAR_LOCATION }}" >> "${GITHUB_ENV}" fi - if [ -n "${{ vars.TF_VAR_vm_size }}" ]; then - echo "TF_VAR_vm_size=${{ vars.TF_VAR_vm_size}}" >> "${GITHUB_ENV}" + if [ -n "${{ vars.TF_VAR_VM_SIZE }}" ]; then + echo "TF_VAR_vm_size=${{ vars.TF_VAR_VM_SIZE }}" >> "${GITHUB_ENV}" fi - name: check VMs run: |- @@ -100,12 +101,13 @@ jobs: # e.g. .terraform/providers/registry.terraform.io/hashicorp/null/3.2.1/linux_amd64/terraform-provider-null_v3.2.1_x5 chmod +x .terraform/providers/*/*/*/*/*/terraform-provider-* - name: set TF vars if set + # GH upcases variable names, that's why this looks odd.... run: |- - if [ -n "${{ vars.TF_VAR_location }}" ]; then - echo "TF_VAR_location=${{ vars.TF_VAR_location}}" >> "${GITHUB_ENV}" + if [ -n "${{ vars.TF_VAR_LOCATION }}" ]; then + echo "TF_VAR_location=${{ vars.TF_VAR_LOCATION }}" >> "${GITHUB_ENV}" fi - if [ -n "${{ vars.TF_VAR_vm_size }}" ]; then - echo "TF_VAR_vm_size=${{ vars.TF_VAR_vm_size}}" >> "${GITHUB_ENV}" + if [ -n "${{ vars.TF_VAR_VM_SIZE }}" ]; then + echo "TF_VAR_vm_size=${{ vars.TF_VAR_VM_SIZE }}" >> "${GITHUB_ENV}" fi - name: Terraform Plan run: terraform plan -out=gha-infrastructure-tests-${{ github.run_id }}-${{ github.run_number }}.plan @@ -131,12 +133,13 @@ jobs: # e.g. .terraform/providers/registry.terraform.io/hashicorp/null/3.2.1/linux_amd64/terraform-provider-null_v3.2.1_x5 chmod +x .terraform/providers/*/*/*/*/*/terraform-provider-* - name: set TF vars if set + # GH upcases variable names, that's why this looks odd.... run: |- - if [ -n "${{ vars.TF_VAR_location }}" ]; then - echo "TF_VAR_location=${{ vars.TF_VAR_location}}" >> "${GITHUB_ENV}" + if [ -n "${{ vars.TF_VAR_LOCATION }}" ]; then + echo "TF_VAR_location=${{ vars.TF_VAR_LOCATION }}" >> "${GITHUB_ENV}" fi - if [ -n "${{ vars.TF_VAR_vm_size }}" ]; then - echo "TF_VAR_vm_size=${{ vars.TF_VAR_vm_size}}" >> "${GITHUB_ENV}" + if [ -n "${{ vars.TF_VAR_VM_SIZE }}" ]; then + echo "TF_VAR_vm_size=${{ vars.TF_VAR_VM_SIZE }}" >> "${GITHUB_ENV}" fi - name: Terraform Apply run: terraform apply -auto-approve gha-infrastructure-tests-${{ github.run_id }}-${{ github.run_number }}.plan @@ -162,12 +165,13 @@ jobs: # e.g. .terraform/providers/registry.terraform.io/hashicorp/null/3.2.1/linux_amd64/terraform-provider-null_v3.2.1_x5 chmod +x .terraform/providers/*/*/*/*/*/terraform-provider-* - name: set TF vars if set + # GH upcases variable names, that's why this looks odd.... run: |- - if [ -n "${{ vars.TF_VAR_location }}" ]; then - echo "TF_VAR_location=${{ vars.TF_VAR_location}}" >> "${GITHUB_ENV}" + if [ -n "${{ vars.TF_VAR_LOCATION }}" ]; then + echo "TF_VAR_location=${{ vars.TF_VAR_LOCATION }}" >> "${GITHUB_ENV}" fi - if [ -n "${{ vars.TF_VAR_vm_size }}" ]; then - echo "TF_VAR_vm_size=${{ vars.TF_VAR_vm_size}}" >> "${GITHUB_ENV}" + if [ -n "${{ vars.TF_VAR_VM_SIZE }}" ]; then + echo "TF_VAR_vm_size=${{ vars.TF_VAR_VM_SIZE }}" >> "${GITHUB_ENV}" fi - name: Terraform Destroy run: terraform destroy -auto-approve