Skip to content

Commit

Permalink
feat: updated code for terraform setup
Browse files Browse the repository at this point in the history
  • Loading branch information
VishwajitNagulkar authored Aug 7, 2023
1 parent ac1e1fd commit 8ccc263
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions .github/workflows/tfdrift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 8ccc263

Please sign in to comment.