From 700fdcc9ed9f50ba078b74bbd88c2ef053f0af50 Mon Sep 17 00:00:00 2001 From: Timo Furrer <tfurrer@gitlab.com> Date: Fri, 26 Jan 2024 08:48:21 +0100 Subject: [PATCH] Introduce plan argument to destroy job --- templates/destroy.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/templates/destroy.yml b/templates/destroy.yml index 267a0d8..2cb2b73 100644 --- a/templates/destroy.yml +++ b/templates/destroy.yml @@ -45,6 +45,9 @@ spec: auto_destroy: default: 'false' description: 'Whether the destroy job is manual or automatically run.' + plan: + default: '' + description: 'Path to a previously generated destroy plan.' --- @@ -67,4 +70,11 @@ spec: image: name: '$[[ inputs.image_registry_base ]]/gitlab-opentofu:$[[ inputs.version ]]-opentofu$[[ inputs.opentofu_version ]]' script: - - gitlab-tofu destroy + - | + if [ -z '$[[ inputs.plan ]]' ]; then + echo 'gitlab-tofu destroy' + gitlab-tofu destroy + else + echo 'gitlab-tofu destroy "$[[ inputs.plan ]]"' + gitlab-tofu destroy "$[[ inputs.plan ]]" + fi -- GitLab