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: ...@@ -102,6 +102,21 @@ include:
root_dir: $[[ inputs.root_dir ]] root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]] state_name: $[[ inputs.state_name ]]
auto_apply: $[[ inputs.auto_apply ]] 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' - local: '/templates/destroy.yml'
inputs: inputs:
as: 'destroy' as: 'destroy'
...@@ -112,6 +127,7 @@ include: ...@@ -112,6 +127,7 @@ include:
root_dir: $[[ inputs.root_dir ]] root_dir: $[[ inputs.root_dir ]]
state_name: $[[ inputs.state_name ]] state_name: $[[ inputs.state_name ]]
auto_destroy: $[[ inputs.auto_apply ]] auto_destroy: $[[ inputs.auto_apply ]]
plan: $[[ inputs.root_dir ]]/destroy-plan.cache
rules: rules:
- if: '"$[[ inputs.create_destroy_job ]]" == "true"' - if: '"$[[ inputs.create_destroy_job ]]" == "true"'
when: always when: always
......
...@@ -42,6 +42,9 @@ spec: ...@@ -42,6 +42,9 @@ spec:
state_name: state_name:
default: default default: default
description: 'Remote OpenTofu state name.' description: 'Remote OpenTofu state name.'
plan:
default: 'plan.cache'
description: 'Path for the generated plan relative to the root directory'
destroy_plan: destroy_plan:
default: false default: false
type: boolean type: boolean
...@@ -64,7 +67,7 @@ spec: ...@@ -64,7 +67,7 @@ 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 - $[[ inputs.root_dir ]]/$[[ inputs.plan ]]
reports: reports:
terraform: $[[ inputs.root_dir ]]/plan.json terraform: $[[ inputs.root_dir ]]/plan.json
rules: rules:
...@@ -79,6 +82,7 @@ spec: ...@@ -79,6 +82,7 @@ spec:
variables: variables:
TF_ROOT: $[[ inputs.root_dir ]] TF_ROOT: $[[ inputs.root_dir ]]
TF_STATE_NAME: $[[ inputs.state_name ]] TF_STATE_NAME: $[[ inputs.state_name ]]
TF_PLAN_CACHE: $[[ inputs.root_dir ]]/$[[ inputs.plan ]]
image: image:
name: '$[[ inputs.image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]' name: '$[[ inputs.image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]'
script: script:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment