Skip to content

Commit

Permalink
add Actions automation for running Terraform
Browse files Browse the repository at this point in the history
* does not store terraform state anywhere; just imports it on every run
  * would be nice if there was a bulk import feature! the internal API
    seems to support it. hashicorp/terraform#22219
* doesn't run apply yet - pushing this for a dry run first.

part of #4

Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
  • Loading branch information
vito committed Mar 10, 2021
1 parent f41297f commit 78e1e8e
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'Terraform'

on:
push:
branches: [master]

jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
environment: production

defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.14.7

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Terraform Init
run: terraform init

- name: Terraform Format
run: terraform fmt -check

- name: Setup Vars
run: |
cat > .auto.tfvars <<EOF
github_token = "${{ secrets.ORG_ADMIN_GITHUB_TOKEN}}"
EOF
- name: Terraform Import
run: go run cmd/import/*.go

- name: Terraform Plan
run: terraform plan -refresh=false

# - name: Terraform Apply
# run: terraform apply -auto-approve -refresh=false

0 comments on commit 78e1e8e

Please sign in to comment.