-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.32 KB
/
apply.terraform.yml
File metadata and controls
51 lines (45 loc) · 1.32 KB
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
name: Apply terraform to provision the infrastructure described in the target repository
on:
workflow_call:
inputs:
infrastructure-repository:
required: true
type: string
workspace-name:
required: true
type: string
json-base-64-tf-vars:
type: string
secrets:
TF_API_TOKEN:
required: true
jobs:
create-environment:
runs-on: ubuntu-latest
steps:
- name: Checkout client infrastructure repository
uses: actions/checkout@v3
with:
repository: ${{ inputs.infrastructure-repository }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Create Terraform variables file
run: |
if [ -n "${{ inputs.json-base-64-tf-vars }}" ]; then
echo ${{ inputs.json-base-64-tf-vars }} | base64 --decode > terraform.tfvars.json
cat terraform.tfvars.json
fi
- name: Terraform Init
env:
TF_WORKSPACE: ${{ inputs.workspace-name }}
run: |
terraform init
- name: Terraform Apply
env:
TF_WORKSPACE: ${{ inputs.workspace-name }}
run: >-
terraform apply
-auto-approve
-input=false