Update Terraform CI/CD workflow to use 'ssot-runner' and adjust working directory for commands
Some checks failed
Terraform CI/CD / terraform (push) Has been cancelled
Some checks failed
Terraform CI/CD / terraform (push) Has been cancelled
This commit is contained in:
23
.github/workflows/terraform.yaml
vendored
23
.github/workflows/terraform.yaml
vendored
@@ -6,43 +6,38 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
terraform:
|
terraform:
|
||||||
runs-on: ssot
|
runs-on: ssot-runner
|
||||||
|
|
||||||
container:
|
container:
|
||||||
image: hashicorp/terraform:1.6.6
|
image: hashicorp/terraform:1.6.6
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: /workspace/${{ github.repository }}/terraform
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: apk add --no-cache nodejs npm git
|
||||||
apk add --no-cache nodejs npm git
|
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Terraform Init
|
- name: Terraform Init
|
||||||
run: terraform init -input=false
|
run: terraform -chdir=terraform init -input=false
|
||||||
|
|
||||||
- name: Terraform Validate
|
- name: Terraform Validate
|
||||||
run: terraform validate
|
run: terraform -chdir=terraform validate
|
||||||
|
|
||||||
- name: Terraform Plan
|
- name: Terraform Plan
|
||||||
run: terraform plan -input=false -out=tfplan
|
run: terraform -chdir=terraform plan -input=false -out=tfplan
|
||||||
|
|
||||||
- name: Show plan
|
- name: Show plan
|
||||||
run: terraform show -no-color tfplan > plan.txt
|
run: terraform -chdir=terraform show -no-color tfplan > terraform/plan.txt
|
||||||
|
|
||||||
- name: Upload plan artifact
|
- name: Upload plan artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: terraform-plan
|
name: terraform-plan
|
||||||
path: |
|
path: |
|
||||||
tfplan
|
terraform/tfplan
|
||||||
plan.txt
|
terraform/plan.txt
|
||||||
|
|
||||||
- name: Terraform Apply
|
- name: Terraform Apply
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
run: terraform apply -input=false -auto-approve tfplan
|
run: terraform -chdir=terraform apply -input=false -auto-approve tfplan
|
||||||
|
|||||||
Reference in New Issue
Block a user