Skip to content

Update grafana_provision.yml #3

Update grafana_provision.yml

Update grafana_provision.yml #3

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
provision:
runs-on: ubuntu-latest
steps:
- name: Checkout
- uses: actions/checkout@v4
- name: HashiCorp - Setup Terraform
- uses: hashicorp/setup-terraform@v2.0.3
#Initialize terraform project
- name: Terraform Init
run: terraform init
# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Format
run: terraform fmt -check
# Previews the changes that Terraform will make
- name: Plan Terraform
id: plan
continue-on-error: true
run: terraform plan -input=false -no-color
# Post the preview (terraform plan) from the previous step as a GitHub pull request comment
- name: Post Plan to GitHub PR
uses: mshick/add-pr-comment@v1
if: github.ref != 'refs/heads/main'
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
repo-token-user-login: 'github-actions[bot]'
message: |
Applying:
```
${{ steps.plan.outputs.stdout }}
```
- name: Apply Terraform
if: github.ref == 'refs/heads/main'
id: apply
continue-on-error: true
run: |
terraform apply -auto-approve