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

Proxy component inputs with variables to job

Even though it is against the CI/CD component best practices this always
for a smoother transition from the Terraform CI/CD templates.
We can remove that proxy again in a later major version.
parent 34763746
Branches
Tags
No related merge requests found
...@@ -51,9 +51,9 @@ spec: ...@@ -51,9 +51,9 @@ spec:
'$[[ inputs.as ]]': '$[[ inputs.as ]]':
stage: $[[ inputs.stage ]] stage: $[[ inputs.stage ]]
environment: environment:
name: $[[ inputs.state_name ]] name: $TF_STATE_NAME
action: start action: start
resource_group: $[[ inputs.state_name ]] resource_group: $TF_STATE_NAME
rules: rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_apply ]]" == "true"' - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_apply ]]" == "true"'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
...@@ -61,7 +61,7 @@ spec: ...@@ -61,7 +61,7 @@ spec:
cache: cache:
key: "$__CACHE_KEY_HACK" key: "$__CACHE_KEY_HACK"
paths: paths:
- $[[ inputs.root_dir ]]/.terraform/ - $TF_ROOT/.terraform/
variables: variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898 # 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 ]]" __CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
...@@ -20,10 +20,12 @@ spec: ...@@ -20,10 +20,12 @@ spec:
'$[[ inputs.as ]]': '$[[ inputs.as ]]':
stage: $[[ inputs.stage ]] stage: $[[ inputs.stage ]]
resource_group: $[[ inputs.state_name ]] resource_group: $TF_STATE_NAME
image: curlimages/curl:latest image: curlimages/curl:latest
variables:
TF_STATE_NAME: $[[ inputs.state_name ]]
script: 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: rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- when: manual - when: manual
...@@ -51,16 +51,16 @@ spec: ...@@ -51,16 +51,16 @@ spec:
'$[[ inputs.as ]]': '$[[ inputs.as ]]':
stage: $[[ inputs.stage ]] stage: $[[ inputs.stage ]]
environment: environment:
name: $[[ inputs.state_name ]] name: $TF_STATE_NAME
action: stop action: stop
resource_group: $[[ inputs.state_name ]] resource_group: $TF_STATE_NAME
rules: rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_destroy ]]" == "true"' - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_destroy ]]" == "true"'
- when: manual - when: manual
cache: cache:
key: "$__CACHE_KEY_HACK" key: "$__CACHE_KEY_HACK"
paths: paths:
- $[[ inputs.root_dir ]]/.terraform/ - $TF_ROOT/.terraform/
variables: variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898 # 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 ]]" __CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
...@@ -61,7 +61,7 @@ spec: ...@@ -61,7 +61,7 @@ spec:
cache: cache:
key: "$__CACHE_KEY_HACK" key: "$__CACHE_KEY_HACK"
paths: paths:
- $[[ inputs.root_dir ]]/.terraform/ - $TF_ROOT/.terraform/
variables: variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898 # 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 ]]" __CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
...@@ -60,9 +60,9 @@ spec: ...@@ -60,9 +60,9 @@ spec:
# See: https://docs.gitlab.com/ee/ci/yaml/#artifactspublic # See: https://docs.gitlab.com/ee/ci/yaml/#artifactspublic
public: false public: false
paths: paths:
- $[[ inputs.root_dir ]]/plan.cache - $TF_ROOT/plan.cache
reports: reports:
terraform: $[[ inputs.root_dir ]]/plan.json terraform: $TF_ROOT/plan.json
rules: rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - 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. - 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: ...@@ -71,7 +71,7 @@ spec:
cache: cache:
key: "$__CACHE_KEY_HACK" key: "$__CACHE_KEY_HACK"
paths: paths:
- $[[ inputs.root_dir ]]/.terraform/ - $TF_ROOT/.terraform/
variables: variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898 # 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 ]]" __CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
...@@ -55,7 +55,7 @@ spec: ...@@ -55,7 +55,7 @@ spec:
cache: cache:
key: "$__CACHE_KEY_HACK" key: "$__CACHE_KEY_HACK"
paths: paths:
- $[[ inputs.root_dir ]]/.terraform/ - $TF_ROOT/.terraform/
variables: variables:
# FIXME: work around to make slashes work in `cache:key`. see https://gitlab.com/gitlab-org/gitlab/-/issues/439898 # 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 ]]" __CACHE_KEY_HACK: "$[[ inputs.root_dir ]]"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment