From 276153e561e5e71503c41c92a25f3d856994235b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juho=20M=C3=A4kinen?= Date: Thu, 31 Oct 2024 13:36:26 +1100 Subject: [PATCH] fix: support deleting all resources from a stack (#3252) We want to still keep the stack around, as it contains history of infra changes --- cmd/ftl-provisioner-cloudformation/provisioner.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/ftl-provisioner-cloudformation/provisioner.go b/cmd/ftl-provisioner-cloudformation/provisioner.go index 79e3f4c3f4..c7260316d7 100644 --- a/cmd/ftl-provisioner-cloudformation/provisioner.go +++ b/cmd/ftl-provisioner-cloudformation/provisioner.go @@ -11,6 +11,7 @@ import ( "connectrpc.com/connect" "github.com/aws/aws-sdk-go-v2/service/cloudformation" goformation "github.com/awslabs/goformation/v7/cloudformation" + cf "github.com/awslabs/goformation/v7/cloudformation/cloudformation" "github.com/awslabs/goformation/v7/cloudformation/rds" "github.com/awslabs/goformation/v7/cloudformation/tags" "golang.org/x/text/cases" @@ -118,6 +119,10 @@ func (c *CloudformationProvisioner) createTemplate(req *provisioner.ProvisionReq return "", err } } + // Stack can not be empty, insert a null resource to keep the stack around + if len(req.DesiredResources) == 0 { + template.Resources["NullResource"] = &cf.WaitConditionHandle{} + } bytes, err := template.JSON() if err != nil {