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

Introduce destroy input for plan job

parent 3b5f6e73
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,10 @@ spec: ...@@ -50,6 +50,10 @@ spec:
state_name: state_name:
default: default default: default
description: 'Remote OpenTofu state name.' description: 'Remote OpenTofu state name.'
destroy:
default: false
type: boolean
description: 'Indicate if the plan should be a destroy plan'
--- ---
...@@ -88,5 +92,11 @@ spec: ...@@ -88,5 +92,11 @@ spec:
image: image:
name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]' name: '$[[ inputs.image_registry_base ]]/$[[ inputs.image_name ]]:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
script: script:
- gitlab-tofu plan - |
args=""
if [ "$[[ inputs.destroy ]]" == "true" ]; then
echo "Planning for a destroy"
args="-destroy"
fi
- gitlab-tofu plan $args
- gitlab-tofu plan-json - gitlab-tofu plan-json
include:
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/plan@$CI_COMMIT_SHA
inputs:
image_registry_base: $GITLAB_OPENTOFU_IMAGE_BASE
version: $CI_COMMIT_SHA
opentofu_version: $OPENTOFU_VERSION
root_dir: $TEST_TF_ROOT
state_name: $TEST_TF_STATE_NAME
destroy: true
stages: [build]
# Required to run everything immediately, instead of manually.
plan:
rules: [{when: always}]
...@@ -12,3 +12,4 @@ component: ...@@ -12,3 +12,4 @@ component:
- PIPELINE_NAME: [Defaults] - PIPELINE_NAME: [Defaults]
- PIPELINE_NAME: [JobTemplates] - PIPELINE_NAME: [JobTemplates]
- PIPELINE_NAME: [TestJob] - PIPELINE_NAME: [TestJob]
- PIPELINE_NAME: [Destroy]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment