-
Notifications
You must be signed in to change notification settings - Fork 2
61 lines (49 loc) · 1.93 KB
/
terraform-taint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: 'Terraform Taint'
on:
workflow_dispatch:
inputs:
resource:
description: 'Resource Address'
required: true
env:
GITHUB_OWNER: condime
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }} # Personal Access Token, contact @bencord0 to rotate
CONSUL_HTTP_TOKEN: ${{ secrets.CONSUL_HTTP_TOKEN }} # Repository specific, contact @bencord0 to rotate
jobs:
terraform-import:
name: 'Terraform Import'
environment: production
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v2
# Install the latest version of Terraform CLI
- name: Setup Terraform
run: |
if command -v terraform 2> /dev/null; then
terraform --version
else
TERRAFORM_RELEASE_TEMP_DIR="$(mktemp -d)"
TERRAFORM_RELEASE_BIN_DIR="${TF_TEMP_DIR}/$(uuidgen)"
wget -P "${TERRAFORM_RELEASE_TEMP_DIR}" \
"https://releases.hashicorp.com/terraform/${TERRAFORM_RELEASE}/terraform_${TERRAFORM_RELEASE}_linux_amd64.zip"
mkdir -v "${TERRAFORM_RELEASE_BIN_DIR}"
cd "${TERRAFORM_RELEASE_BIN_DIR}"
unzip ../terraform_${TERRAFORM_RELEASE}_linux_amd64.zip
export PATH="${TERRAFORM_RELEASE_BIN_DIR}:${PATH}"
terraform --version
fi
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init
# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Format
run: terraform fmt -check
# Taint a terraform resource
- name: Terraform Taint
run: |
terraform taint "${{ github.event.inputs.resource }}"