Commit 3e5582ce authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'feat-terraform-autodevops-script' into 'master'

Output terraform plan to JSON file

See merge request gitlab-org/gitlab!26830
parents 27309598 b0174461
......@@ -4,7 +4,7 @@
# Entrypoint is also needed as image by default set `terraform` binary as an
# entrypoint.
image:
name: hashicorp/terraform:light
name: registry.gitlab.com/gitlab-org/gitlab-build-images:terraform
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
......@@ -18,6 +18,7 @@ cache:
- .terraform
before_script:
- 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 --version
- terraform init
......@@ -36,6 +37,7 @@ plan:
stage: build
script:
- terraform plan -out=$PLAN
- "terraform show --json $PLAN | convert_report > tfplan.json"
artifacts:
name: plan
paths:
......
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