From c7644fdcbed747fbcafc6a69528e58e93e5f6aa9 Mon Sep 17 00:00:00 2001 From: Anjan Nath Date: Mon, 11 Nov 2024 13:37:10 +0530 Subject: [PATCH] check if stack output map is empty before accessing --- pkg/provider/aws/modules/spot/stack.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/provider/aws/modules/spot/stack.go b/pkg/provider/aws/modules/spot/stack.go index 5de306fb9..8704d70a1 100644 --- a/pkg/provider/aws/modules/spot/stack.go +++ b/pkg/provider/aws/modules/spot/stack.go @@ -1,6 +1,8 @@ package spot import ( + "errors" + "github.com/pulumi/pulumi/sdk/v3/go/auto" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/redhat-developer/mapt/pkg/manager" @@ -133,6 +135,9 @@ func getOutputs(stack *auto.Stack) (*SpotOptionResult, error) { if err != nil { return nil, err } + if len(outputs) == 0 { + return nil, errors.New("Stack outputs are empty please destroy and re-create") + } return &SpotOptionResult{ Region: outputs["region"].Value.(string), AvailabilityZone: outputs["az"].Value.(string),