Loading templates/terraform.yml +16 −14 Original line number Diff line number Diff line Loading @@ -5,51 +5,53 @@ include: variables: TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/default TF_ROOT: ${CI_PROJECT_DIR} TF_INPUT: !!str 0 TF_IN_AUTOMATION: !!str 1 TF_CLI_ARGS: "" TF_WORKSPACE: default .tf_template: image: registry.gitlab.com/gitlab-org/terraform-images/stable:latest before_script: - cd ${TF_ROOT} cache: paths: - ${TF_ROOT}/.terraform .tf_validate: extends: .tf_template stage: test image: &tf_image registry.gitlab.com/gitlab-org/terraform-images/stable:latest before_script: &tf_before_script - |- [ -z "${TF_ROOT:-}" ] || cd "${TF_ROOT}" script: - gitlab-terraform validate .tf_fmt: extends: .tf_template stage: test image: *tf_image before_script: *tf_before_script script: - gitlab-terraform fmt .tf_validate_fmt: extends: .tf_template stage: test image: *tf_image before_script: *tf_before_script script: - gitlab-terraform validate - gitlab-terraform fmt .tf_plan: image: *tf_image before_script: &tf_before_script - cd "${TF_ROOT}" extends: .tf_template script: - gitlab-terraform plan - gitlab-terraform plan-json artifacts: name: plan paths: - plan.cache - ${TF_ROOT}/plan.cache reports: terraform: plan.json terraform: ${TF_ROOT}/plan.json .tf_apply: image: *tf_image extends: .tf_template script: - gitlab-terraform apply when: manual Loading
templates/terraform.yml +16 −14 Original line number Diff line number Diff line Loading @@ -5,51 +5,53 @@ include: variables: TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/default TF_ROOT: ${CI_PROJECT_DIR} TF_INPUT: !!str 0 TF_IN_AUTOMATION: !!str 1 TF_CLI_ARGS: "" TF_WORKSPACE: default .tf_template: image: registry.gitlab.com/gitlab-org/terraform-images/stable:latest before_script: - cd ${TF_ROOT} cache: paths: - ${TF_ROOT}/.terraform .tf_validate: extends: .tf_template stage: test image: &tf_image registry.gitlab.com/gitlab-org/terraform-images/stable:latest before_script: &tf_before_script - |- [ -z "${TF_ROOT:-}" ] || cd "${TF_ROOT}" script: - gitlab-terraform validate .tf_fmt: extends: .tf_template stage: test image: *tf_image before_script: *tf_before_script script: - gitlab-terraform fmt .tf_validate_fmt: extends: .tf_template stage: test image: *tf_image before_script: *tf_before_script script: - gitlab-terraform validate - gitlab-terraform fmt .tf_plan: image: *tf_image before_script: &tf_before_script - cd "${TF_ROOT}" extends: .tf_template script: - gitlab-terraform plan - gitlab-terraform plan-json artifacts: name: plan paths: - plan.cache - ${TF_ROOT}/plan.cache reports: terraform: plan.json terraform: ${TF_ROOT}/plan.json .tf_apply: image: *tf_image extends: .tf_template script: - gitlab-terraform apply when: manual