Skip to content

run the pipeline on this feature branch #5

run the pipeline on this feature branch

run the pipeline on this feature branch #5

Workflow file for this run

name: 'Terraform'
on:
workflow_dispatch:
inputs:
destroy:
description: 'Set to 1 to destroy the terraform architecture'
required: false
default: '0'
branch:
description: 'Provide the name of the branch to run the pipeline on'
required: false
push:
#branches: [ "main" ]
paths: ["infra/**", ".github/**"]
permissions:
contents: read
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
env:
# statefile environmental variables
TS_VAR_state_resource_group_name: ${{ startsWith(github.ref, 'refs/tags/release') && vars.STATE_RESOURCE_GROUP_NAME_PROD || github.ref == github.ref && vars.STATE_RESOURCE_GROUP_NAME_DEV }}
TS_VAR_state_storage_account_name: ${{ startsWith(github.ref, 'refs/tags/release') && vars.STATE_STORAGE_ACCOUNT_NAME_PROD || github.ref == github.ref && vars.STATE_STORAGE_ACCOUNT_NAME_DEV }}
TS_VAR_state_cotainer_name: ${{ startsWith(github.ref, 'refs/tags/release') && vars.STATE_CONTAINER_NAME_PROD || github.ref == github.ref && vars.STATE_CONTAINER_NAME_DEV }}
# infra environmental variables
TS_VAR_infra_resource_group_name: ${{ startsWith(github.ref, 'refs/tags/release') && vars.INFRA_RESOURCE_GROUP_NAME_PROD || github.ref == github.ref && vars.INFRA_RESOURCE_GROUP_NAME_DEV }}
TS_VAR_infra_subscription_id: ${{ startsWith(github.ref, 'refs/tags/release') && vars.INFRA_SUBSCRIPTION_ID_PROD || github.ref == github.ref && vars.INFRA_SUBSCRIPTION_ID_DEV }}
TS_VAR_infra_tenant_id: ${{ startsWith(github.ref, 'refs/tags/release') && vars.INFRA_TENANT_ID_PROD || github.ref == github.ref && vars.INFRA_TENANT_ID_DEV }}
# automatic terraform variables
ARM_CLIENT_ID: ${{ startsWith(github.ref, 'refs/tags/release') && secrets.ARM_CLIENT_ID_PROD || github.ref == github.ref && secrets.ARM_CLIENT_ID_DEV }}
ARM_CLIENT_SECRET: ${{ startsWith(github.ref, 'refs/tags/release') && secrets.ARM_CLIENT_SECRET_PROD || github.ref == github.ref && secrets.ARM_CLIENT_SECRET_DEV }}
ARM_SUBSCRIPTION_ID: ${{ startsWith(github.ref, 'refs/tags/release') && vars.INFRA_SUBSCRIPTION_ID_PROD || github.ref == github.ref && vars.INFRA_SUBSCRIPTION_ID_DEV }}
ARM_TENANT_ID: ${{ startsWith(github.ref, 'refs/tags/release') && vars.INFRA_TENANT_ID_PROD || github.ref == github.ref && vars.INFRA_TENANT_ID_DEV }}
TF_VERSION: 1.8.0
defaults:
run:
shell: bash
working-directory: ./infra
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.destroy && github.event.inputs.destroy || github.ref }}
- name: Verify the Environment
run: |

Check failure on line 55 in .github/workflows/tf_apply.yml

View workflow run for this annotation

GitHub Actions / Terraform

Invalid workflow file

The workflow is not valid. .github/workflows/tf_apply.yml (Line: 55, Col: 12): An expression was expected
echo TS_VAR_state_resource_group_name: ${{ env.TS_VAR_state_resource_group_name }}, $TS_VAR_state_resource_group_name
echo TS_VAR_state_storage_account_name: ${{ env.TS_VAR_state_storage_account_name }}
echo TS_VAR_state_cotainer_name: ${{ env.TS_VAR_state_cotainer_name }}
echo TS_VAR_infra_resource_group_name: ${{ env.TS_VAR_infra_resource_group_name }}
echo TS_VAR_infra_subscription_id: ${{ env.TS_VAR_infra_subscription_id }}
echo TS_VAR_infra_tenant_id: ${{ env.TS_VAR_infra_tenant_id }}
echo ARM_CLIENT_ID: ${{ env.ARM_CLIENT_ID }}
echo ARM_CLIENT_SECRET: ${{ env.ARM_CLIENT_SECRET }}
echo ARM_SUBSCRIPTION_ID: ${{ env.ARM_SUBSCRIPTION_ID }}
echo ARM_TENANT_ID: ${{ env.ARM_TENANT_ID }}
echo TF_VERSION: ${{ env.TF_VERSION }}
echo ${{ }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.TF_VERSION }}
- name: Terraform fmt
id: fmt
run: terraform fmt -check
- name: Terraform init
id: init
run: |
set -a
source ../.env.backend
terraform init \
-backend-config="resource_group_name=$TF_VAR_state_resource_group_name" \
-backend-config="storage_account_name=$TF_VAR_state_storage_account_name"
- name: Terraform validate
id: validate
run: terraform validate -no-color
- name: Terraform plan
id: plan
run: terraform plan -no-color
- name: Terraform apply
id: apply
run: terraform apply -auto-approve $DESTROY
env:
DESTROY: ${{ github.event.inputs.destroy == '1' && '-destroy' || '' }}