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

Remove `auto_apply` and `auto_destroy` inputs

This change sets removes support `auto_apply` and `auto_destroy` inputs
across the templates.
With the introduction of the `rules` inputs, an auto apply or auto
destroy behavior can easily implemented using it directly.

We can't easily keep the `auto_apply` and `auto_destroy` inputs because
having input references in input default values is not yet supported.
See https://gitlab.com/gitlab-org/gitlab/-/issues/438722.

I've left the input definitions commented out for now with the
possibility to easily bring it back if the issue is resolved.

Closes https://gitlab.com/components/opentofu/-/issues/80

Changelog: removed
parent 7cffa28c
Branches
Tags
No related merge requests found
......@@ -477,7 +477,7 @@ When migrating from the GitLab Terraform CI/CD templates you can use the followi
- Although the `TF_ROOT` variable is still used and maybe overwritten after the import on individual jobs.
- Migrate the `TF_STATE_NAME` variable to the `state_name` input.
- Although the `TF_STATE_NAME` variable is still used and maybe overwritten after the import on individual jobs.
- Migrate the `TF_AUTO_DEPLOY` variable to the `auto_apply` input.
- Migrate the `TF_AUTO_DEPLOY` variable to custom `rules` inputs.
- Used other variables -> Use the same variables with this component.
The same rules apply for the `latest` templates.
......
......@@ -491,7 +491,7 @@ When migrating from the GitLab Terraform CI/CD templates you can use the followi
- Although the `TF_ROOT` variable is still used and maybe overwritten after the import on individual jobs.
- Migrate the `TF_STATE_NAME` variable to the `state_name` input.
- Although the `TF_STATE_NAME` variable is still used and maybe overwritten after the import on individual jobs.
- Migrate the `TF_AUTO_DEPLOY` variable to the `auto_apply` input.
- Migrate the `TF_AUTO_DEPLOY` variable to custom `rules` inputs.
- Used other variables -> Use the same variables with this component.
The same rules apply for the `latest` templates.
......
......@@ -75,10 +75,6 @@ spec:
plan_name:
default: 'plan'
description: 'The name of the plan file to use. Will be used for TF_PLAN_CACHE and TF_PLAN_JSON.'
auto_apply:
default: false
type: boolean
description: 'Whether the apply job is manual or automatically run.'
var_file:
default: ''
type: string
......
......@@ -75,10 +75,6 @@ spec:
plan_name:
default: 'destroy-plan'
description: 'The name of the plan file to use. Will be used for TF_PLAN_CACHE and TF_PLAN_JSON.'
auto_destroy:
default: false
type: boolean
description: 'Whether the destroy job is manual or automatically run.'
var_file:
default: ''
type: string
......
......@@ -83,14 +83,20 @@ spec:
plan_name:
default: 'plan'
description: 'The name of the plan cache and plan json file.'
auto_apply:
default: false
type: boolean
description: 'Whether the apply job is manual or automatically run.'
auto_destroy:
default: false
type: boolean
description: 'Whether the destroy job is manual or automatically run.'
# FIXME: at the moment we cannot support this input
# because we cannot nest inputs: https://gitlab.com/gitlab-org/gitlab/-/issues/438722
# If you want to auto apply, please refer to the `rules` input.
#auto_apply:
# default: false
# type: boolean
# description: 'Whether the apply job is manual or automatically run.'
# FIXME: at the moment we cannot support this input
# because we cannot nest inputs: https://gitlab.com/gitlab-org/gitlab/-/issues/438722
# If you want to auto destroy, please refer to the `rules` input.
#auto_destroy:
# default: false
# type: boolean
# description: 'Whether the destroy job is manual or automatically run.'
plan_artifacts_access:
default: 'none'
description: 'Access level for the plan artifact. See https://docs.gitlab.com/ee/ci/yaml/#artifactsaccess for possible values.'
......@@ -132,14 +138,13 @@ spec:
description: 'Defines the `rules` of the `plan` job.'
apply_rules:
default:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_apply ]]" == "true"'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
type: array
description: 'Defines the `rules` of the `apply` job.'
destroy_rules:
default:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_destroy ]]" == "true"'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- when: manual
type: array
description: 'Defines the `rules` of the `destroy` job.'
......@@ -232,7 +237,6 @@ include:
root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]]
plan_name: $[[ inputs.plan_name ]]
auto_apply: $[[ inputs.auto_apply ]]
var_file: $[[ inputs.var_file ]]
rules: $[[ inputs.apply_rules ]]
- local: '/templates/destroy.yml'
......@@ -247,7 +251,6 @@ include:
image_digest: $[[ inputs.image_digest ]]
root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]]
auto_destroy: $[[ inputs.auto_destroy ]]
var_file: $[[ inputs.var_file ]]
rules: $[[ inputs.destroy_rules ]]
- local: '/templates/delete-state.yml'
......
......@@ -83,14 +83,6 @@ spec:
plan_name:
default: 'plan'
description: 'The name of the plan cache and plan json file.'
auto_apply:
default: false
type: boolean
description: 'Whether the apply job is manual or automatically run.'
auto_destroy:
default: false
type: boolean
description: 'Whether the destroy job is manual or automatically run.'
var_file:
default: ''
type: string
......@@ -179,7 +171,6 @@ include:
root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]]
plan_name: $[[ inputs.plan_name ]]
auto_apply: $[[ inputs.auto_apply ]]
var_file: $[[ inputs.var_file ]]
- local: '/templates/destroy.yml'
inputs:
......@@ -194,7 +185,6 @@ include:
root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]]
plan_name: $[[ inputs.plan_name ]]
auto_destroy: $[[ inputs.auto_destroy ]]
var_file: $[[ inputs.var_file ]]
- local: '/templates/delete-state.yml'
inputs:
......
......@@ -77,10 +77,13 @@ spec:
plan_name:
default: 'plan'
description: 'The name of the plan cache and plan json file.'
auto_apply:
default: false
type: boolean
description: 'Whether the apply job is manual or automatically run.'
# FIXME: at the moment we cannot support this input
# because we cannot nest inputs: https://gitlab.com/gitlab-org/gitlab/-/issues/438722
# If you want to auto apply, please refer to the `rules` input.
#auto_apply:
# default: false
# type: boolean
# description: 'Whether the apply job is manual or automatically run.'
plan_artifacts_access:
default: 'none'
description: 'Access level for the plan artifact. See https://docs.gitlab.com/ee/ci/yaml/#artifactsaccess for possible values.'
......@@ -114,7 +117,6 @@ spec:
description: 'Defines the `rules` of the `plan` job.'
apply_rules:
default:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_apply ]]" == "true"'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
type: array
......@@ -186,7 +188,6 @@ include:
root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]]
plan_name: $[[ inputs.plan_name ]]
auto_apply: $[[ inputs.auto_apply ]]
var_file: $[[ inputs.var_file ]]
rules: $[[ inputs.apply_rules ]]
cache_policy: pull
......@@ -80,10 +80,13 @@ spec:
plan_artifacts_access:
default: 'none'
description: 'Access level for the plan artifact. See https://docs.gitlab.com/ee/ci/yaml/#artifactsaccess for possible values.'
auto_destroy:
default: false
type: boolean
description: 'Whether the destroy job is manual or automatically run.'
# FIXME: at the moment we cannot support this input
# because we cannot nest inputs: https://gitlab.com/gitlab-org/gitlab/-/issues/438722
# If you want to auto destroy, please refer to the `rules` input.
#auto_destroy:
# default: false
# type: boolean
# description: 'Whether the destroy job is manual or automatically run.'
var_file:
default: ''
type: string
......@@ -114,7 +117,7 @@ spec:
description: 'Defines the `rules` of the `plan` job.'
destroy_rules:
default:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.auto_destroy ]]" == "true"'
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- when: manual
type: array
description: 'Defines the `rules` of the `destroy` job.'
......@@ -193,7 +196,6 @@ include:
state_name: $[[ inputs.state_name ]]
no_plan: false
plan_name: $[[ inputs.plan_name ]]
auto_destroy: $[[ inputs.auto_destroy ]]
var_file: $[[ inputs.var_file ]]
rules: $[[ inputs.destroy_rules ]]
cache_policy: pull
......
......@@ -9,7 +9,6 @@ include:
root_dir: $TEST_TF_ROOT
state_name: $TEST_TF_STATE_NAME
no_plan: true
auto_apply: true
# Required to run everything immediately, instead of manually.
rules: [{when: always}]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment