Skip to content

Terraform Plan and Apply with Approval #32

Terraform Plan and Apply with Approval

Terraform Plan and Apply with Approval #32

Workflow file for this run

name: Terraform Plan and Apply with Approval
on:
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'qa'
type: choice
options:
- dev
- qa
pipeline_action:
description: 'Pipeline action (create or destroy)'
required: true
default: 'create'
type: choice
options:
- create
- destroy
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Tag
env:
TF_WORKSPACE: ${{ inputs.environment }}
GRAFANA_ANNOTATIONS_KEY: ${{ secrets.GRAFANA_ANNOTATIONS_KEY }}
REPOSITORY_NAME: ${{ github.repository }}
run: |
EPOCH=$(($(date +%s%N)/1000000))
curl -X POST "https://a2ops.grafana.net/api/annotations" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $GRAFANA_ANNOTATIONS_KEY" \
-d '{
"created": '"$EPOCH"',
"updated": '"$EPOCH"',
"time": '"$EPOCH"',
"timeEnd": '"$EPOCH"',
"text": "Deployment",
"tags": [
"kind:deployment",
"project:'"$REPOSITORY_NAME"'",
"env:${{ inputs.environment }}",
]
}'