include: - template: Terraform/Base.latest.gitlab-ci.yml - template: Workflows/MergeRequest-Pipelines.gitlab-ci.yml variables: TF_ROOT: terraform stages: - build - plan_json - infracost build: extends: .terraform:build plan_json: stage: plan_json dependencies: - build before_script: - cd ${TF_ROOT} - gitlab-terraform init script: - gitlab-terraform show -json plan.cache > full-plan.json artifacts: paths: - ${TF_ROOT}/full-plan.json infracost: stage: infracost image: name: infracost/infracost:ci-0.10 entrypoint: - '' dependencies: - plan_json script: - >- find terraform -type f -name '*.tf' -o -name '*.hcl' -o -name '*.tfvars' | xargs sed -i 's/m5.4xlarge/m5.8xlarge/g' - >- find terraform -type f -name '*.tf' -o -name '*.hcl' -o -name '*.tfvars' | xargs sed -i 's/t2.micro/t2.medium/g' - | infracost diff --path=${TF_ROOT}/full-plan.json \ --format=json \ --out-file=infracost.json variables: INFRACOST_API_KEY: $INFRACOST_API_KEY GITLAB_TOKEN: $GITLAB_TOKEN artifacts: paths: - infracost.json