diff --git a/.github/workflows/tfdrift.yml b/.github/workflows/tfdrift.yml index c253c65a..ff3d07be 100644 --- a/.github/workflows/tfdrift.yml +++ b/.github/workflows/tfdrift.yml @@ -23,6 +23,10 @@ on: default: "" type: string description: 'Terraform var file directory. e.g. vars/dev.tfvars' + terraform_version: + required: false + type: string + description: 'Terraform version.' secrets: AZURE_CREDENTIALS: required: false @@ -76,25 +80,35 @@ jobs: creds: ${{ secrets.AZURE_CREDENTIALS }} # Install the latest version of the Terraform CLI - - name: Setup Terraform - uses: hashicorp/setup-terraform@v2 - with: - terraform_wrapper: false + # - name: Setup Terraform + # uses: hashicorp/setup-terraform@v2 + # with: + # terraform_wrapper: false # Run some scripts - name: Run shell commands run: ls -la - # Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. - - name: "Terraform Init" - uses: hashicorp/terraform-github-actions@master + # # Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. + # - name: "Terraform Init" + # uses: hashicorp/terraform-github-actions@master + # with: + # tf_actions_subcommand: "init" + # tf_actions_version: 1.3.6 + # tf_actions_working_dir: ${{ inputs.working_directory }} + # env: + # GITHUB_TOKEN: '${{ secrets.GITHUB }}' + # TF_CLI_ARGS: "-backend-config=token=${{ secrets.TF_API_TOKEN }}" + + - name: Set up Terraform + uses: hashicorp/setup-terraform@v2 with: - tf_actions_subcommand: "init" - tf_actions_version: 1.3.6 - tf_actions_working_dir: ${{ inputs.working_directory }} - env: - GITHUB_TOKEN: '${{ secrets.GITHUB }}' - TF_CLI_ARGS: "-backend-config=token=${{ secrets.TF_API_TOKEN }}" + terraform_version: ${{ inputs.terraform_version }} + + - name: terraform init + run: | + cd ${{ inputs.working_directory }} + terraform init # Generates an execution plan for Terraform # An exit code of 0 indicated no changes, 1 a terraform failure, 2 there are pending changes.