Skip to content

Commit

Permalink
Include terraform in action
Browse files Browse the repository at this point in the history
  • Loading branch information
anacalva committed Mar 21, 2024
1 parent 51a9515 commit 2f517bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
37 changes: 15 additions & 22 deletions .github/workflows/vm-creation-terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,14 @@ env:
jobs:

build-terraform-file:
runs-on: ghr-proxmox-vm-sthings-cicd
container:
image: hashicorp/terraform:1.7.0
environment: k8s

runs-on: ghr-proxmox-vm-sthings-cicd
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
env:
AGENT_TOOLSDIRECTORY: /home/runner/_work/_tool

- name: Install dependencies
run: |
Expand All @@ -47,27 +43,23 @@ jobs:
with:
name: terraform_main
path: main.tf

- name: DEBUG
shell: bash
run: |
echo "/home/runner/_work/_tool/"
ls -la /home/runner/_work/_tool/

test-terraform-apply:
needs: build-terraform-file
runs-on: ghr-proxmox-vm-sthings-cicd
container:
image: hashicorp/terraform:1.7.0
environment: k8s
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/[email protected]

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.7.0"

- name: Install dependencies
run: |
python -m pip install github-action-utils python-terraform
Expand Down Expand Up @@ -96,17 +88,18 @@ jobs:
if: ${{ always() }}
needs: test-terraform-apply
runs-on: ghr-proxmox-vm-sthings-cicd
container:
image: hashicorp/terraform:1.7.0
environment: k8s
steps:
- uses: actions/checkout@v4

- name: Checkout code
uses: actions/[email protected]
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.7.0"

- name: Install dependencies
run: |
python -m pip install github-action-utils python-terraform
Expand Down
2 changes: 1 addition & 1 deletion tests/terraform_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def main():

# Initialize the Terraform working directory
global tf
tf = python_terraform.Terraform(working_dir='.', variables=tfvars) #, terraform_bin_path='/home/runner/k8s')
tf = python_terraform.Terraform(working_dir='.', variables=tfvars)
tf.init()

# Run terraform Apply and Terraform Destroy
Expand Down

0 comments on commit 2f517bd

Please sign in to comment.