This commit is contained in:
2024-05-05 08:37:35 -05:00
parent f1d097a01a
commit 70823bb3ed
10 changed files with 37 additions and 20 deletions

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Terraform validate
terraform apply -auto-approve $ARGUMENTS

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Terraform validate
terraform destroy -auto-approve $ARGUMENTS

4
scripts/terraform/fmt.sh Normal file
View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Terraform fmt
terraform fmt -diff -check -write=false

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Terraform init
terraform init -reconfigure -backend-config="address=${GITLAB_TF_ADDRESS}" -backend-config="lock_address=${GITLAB_TF_ADDRESS}/lock" -backend-config="unlock_address=${GITLAB_TF_ADDRESS}/lock" -backend-config="username=gitlab-ci-token" -backend-config="password=${CI_JOB_TOKEN}" -backend-config="lock_method=POST" -backend-config="unlock_method=DELETE" -backend-config="retry_wait_min=5"

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Terraform plan
apk add --update curl jq
alias convert_report="jq -r '([.resource_changes[].change.actions?]|flatten)|{\"create\":(map(select(.==\"create\"))|length),\"update\":(map(select(.==\"update\"))|length),\"delete\":(map(select(.==\"delete\"))|length)}'"
terraform plan -out=$PLAN $ARGUMENTS
terraform show --json $PLAN | convert_report > $JSON_PLAN_FILE

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Terraform validate
terraform validate