Skip to content

initial version

initial version #1

Workflow file for this run

name: Plan and Apply Terraform
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
environment: production
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
- name: Terraform Init
run: terraform init
- name: Terraform Plan
run: terraform plan -out=plan.raw
- name: Convert the plan to JSON
id: planToJson
run: terraform show -json plan.raw
- name: Save JSON to a file
uses: fishcharlie/[email protected]
with:
data: ${{ steps.planToJson.outputs.stdout }}
output: plan.json
- name: Upload Terraform Plan Output
uses: actions/upload-artifact@v2
with:
name: plan-file
path: plan.json
# - name: Terraform Apply
# if: github.ref == 'refs/heads/main' && github.event_name == 'push'
# run: terraform apply -auto-approve -input=false
resourcely-ci:
needs: terraform
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Terraform Plan Output
uses: actions/download-artifact@v2
with:
name: plan-file
path: tf-plan-files/
- name: Resourcely CI
uses: Resourcely-Inc/resourcely-action@v1
with:
resourcely_api_token: ${{ secrets.RESOURCELY_API_TOKEN }}
resourcely_api_host: "https://api.dev.resourcely.io"
tf_plan_directory: "tf-plan-files"