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

Integrate destroy plan job

parent 700fdcc9
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,21 @@ include:
root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]]
auto_apply: $[[ inputs.auto_apply ]]
- local: '/templates/plan.yml'
inputs:
as: 'destroy:plan'
stage: $[[ inputs.stage_cleanup ]]
version: $[[ inputs.version ]]
opentofu_version: $[[ inputs.opentofu_version ]]
image_registry_base: $[[ inputs.image_registry_base ]]
root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]]
plan: destroy-plan.cache
destroy_plan: true
rules:
- if: '"$[[ inputs.create_destroy_job ]]" == "true"'
when: always
- when: never
- local: '/templates/destroy.yml'
inputs:
as: 'destroy'
......@@ -112,6 +127,7 @@ include:
root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]]
auto_destroy: $[[ inputs.auto_apply ]]
plan: $[[ inputs.root_dir ]]/destroy-plan.cache
rules:
- if: '"$[[ inputs.create_destroy_job ]]" == "true"'
when: always
......
......@@ -42,6 +42,9 @@ spec:
state_name:
default: default
description: 'Remote OpenTofu state name.'
plan:
default: 'plan.cache'
description: 'Path for the generated plan relative to the root directory'
destroy_plan:
default: false
type: boolean
......@@ -64,7 +67,7 @@ spec:
# See: https://docs.gitlab.com/ee/ci/yaml/#artifactspublic
public: false
paths:
- $[[ inputs.root_dir ]]/plan.cache
- $[[ inputs.root_dir ]]/$[[ inputs.plan ]]
reports:
terraform: $[[ inputs.root_dir ]]/plan.json
rules:
......@@ -79,6 +82,7 @@ spec:
variables:
TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]]
TF_PLAN_CACHE: $[[ inputs.root_dir ]]/$[[ inputs.plan ]]
image:
name: '$[[ inputs.image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
script:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment