Skip to content
Snippets Groups Projects
Commit b0b5c970 authored by Timo Furrer's avatar Timo Furrer
Browse files

Merge branch 'use-variables-instead-of-direct-inputs' into 'main'

Proxy component inputs with variables to job

See merge request components/opentofu!37
parents 34763746 57a9e18a
No related merge requests found
......@@ -51,9 +51,9 @@ spec:
'$[[ inputs.as ]]':
stage: $[[ inputs.stage ]]
environment:
name: $[[ inputs.state_name ]]
name: $TF_STATE_NAME
action: start
resource_group: $[[ inputs.state_name ]]
resource_group: $TF_STATE_NAME
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_apply ]]" == "true"'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
......@@ -61,7 +61,7 @@ spec:
cache:
key: "$__CACHE_KEY_HACK"
paths:
- $[[ inputs.root_dir ]]/.terraform/
- $TF_ROOT/.terraform/
variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
......@@ -20,10 +20,12 @@ spec:
'$[[ inputs.as ]]':
stage: $[[ inputs.stage ]]
resource_group: $[[ inputs.state_name ]]
resource_group: $TF_STATE_NAME
image: curlimages/curl:latest
variables:
TF_STATE_NAME: $[[ inputs.state_name ]]
script:
- curl --request DELETE -u "gitlab-ci-token:$CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/terraform/state/$[[ inputs.state_name ]]"
- curl --request DELETE -u "gitlab-ci-token:$CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/terraform/state/$TF_STATE_NAME"
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- when: manual
......@@ -51,16 +51,16 @@ spec:
'$[[ inputs.as ]]':
stage: $[[ inputs.stage ]]
environment:
name: $[[ inputs.state_name ]]
name: $TF_STATE_NAME
action: stop
resource_group: $[[ inputs.state_name ]]
resource_group: $TF_STATE_NAME
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_destroy ]]" == "true"'
- when: manual
cache:
key: "$__CACHE_KEY_HACK"
paths:
- $[[ inputs.root_dir ]]/.terraform/
- $TF_ROOT/.terraform/
variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
......@@ -61,7 +61,7 @@ spec:
cache:
key: "$__CACHE_KEY_HACK"
paths:
- $[[ inputs.root_dir ]]/.terraform/
- $TF_ROOT/.terraform/
variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
......@@ -60,9 +60,9 @@ spec:
# See: https://docs.gitlab.com/ee/ci/yaml/#artifactspublic
public: false
paths:
- $[[ inputs.root_dir ]]/plan.cache
- $TF_ROOT/plan.cache
reports:
terraform: $[[ inputs.root_dir ]]/plan.json
terraform: $TF_ROOT/plan.json
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
......@@ -71,7 +71,7 @@ spec:
cache:
key: "$__CACHE_KEY_HACK"
paths:
- $[[ inputs.root_dir ]]/.terraform/
- $TF_ROOT/.terraform/
variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
......@@ -55,7 +55,7 @@ spec:
cache:
key: "$__CACHE_KEY_HACK"
paths:
- $[[ inputs.root_dir ]]/.terraform/
- $TF_ROOT/.terraform/
variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898
__CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
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