Skip to content

petersumma is testing GitHub Actions πŸš€ #1

petersumma is testing GitHub Actions πŸš€

petersumma is testing GitHub Actions πŸš€ #1

Workflow file for this run

name: Terraform Github Actions
run-name: ${{ github.actor }} is testing GitHub Actions πŸš€
on: [push]
defaults:
run:
working-directory: ./terraform
env:
NSXT_MANAGER_HOST: ${{ secrets.NSXT_MANAGER_HOST }}
NSXT_USERNAME: ${{ secrets.NSXT_USERNAME }}
NSXT_PASSWORD: ${{ secrets.NSXT_PASSWORD }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
jobs:
Validate:
runs-on: [self-hosted]
container:
image: hashicorp/terraform
steps:
- name: clone repository
uses: actions/checkout@v2
- name: terraform init
id: init
run: terraform init -backend-config="access_key=${S3_ACCESS_KEY}" -backend-config="secret_key=${S3_SECRET_KEY}"
continue-on-error: false
- name: terraform fmt
id: fmt
run: terraform fmt -check -recursive -diff
continue-on-error: false
- name: terraform validate
id: validate
run: terraform validate
continue-on-error: false
Plan:
needs: [Validate]
runs-on: [self-hosted]
container:
image: hashicorp/terraform
steps:
- name: terraform init
id: init
run: terraform init -backend-config="access_key=${S3_ACCESS_KEY}" -backend-config="secret_key=${S3_SECRET_KEY}"
- name: terraform plan
id: plan
run: terraform plan -out=planfile
Apply:
needs: [Validate, Plan]
runs-on: [self-hosted]
if: ${{ github.ref == 'refs/heads/main' }}
container:
image: hashicorp/terraform
steps:
- name: terraform apply
id: apply
run: terraform apply -input=false "planfile"