Commit cbd69c20 authored by Fábio Matavelli's avatar Fábio Matavelli Committed by Fábio Matavelli

apply @alexives suggestions

parent d1d459e1
...@@ -18,6 +18,8 @@ cache: ...@@ -18,6 +18,8 @@ cache:
- .terraform - .terraform
before_script: before_script:
- apk update && apk add jq
- alias convert_report="jq '([.resource_changes[].change.actions] | flatten) | {\"create\": (map(select(. == \"create\")) | length),\"update\":(map(select(. == \"update\")) | length),\"delete\": (map(select(. == \"delete\")) | length)}'"
- terraform --version - terraform --version
- terraform init - terraform init
...@@ -35,15 +37,12 @@ validate: ...@@ -35,15 +37,12 @@ validate:
plan: plan:
stage: build stage: build
script: script:
- apk update && apk add jq
- terraform plan -out=$PLAN - terraform plan -out=$PLAN
- "terraform show --json $PLAN | jq '([.resource_changes[].change.actions] | flatten) | {\"create\": (map(select(. == \"create\")) | length),\"update\":(map(select(. == \"update\")) | length),\"delete\": (map(select(. == \"delete\")) | length)}' > tfplan.json" - "terraform show --json $PLAN | convert_report > tfplan.json"
artifacts: artifacts:
name: plan name: plan
paths: paths:
- $PLAN - $PLAN
reports:
terraform: tfplan.json
# Separate apply job for manual launching Terraform as it can be destructive # Separate apply job for manual launching Terraform as it can be destructive
# action. # action.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment