Skip to content

Commit

Permalink
check if stack output map is empty before accessing
Browse files Browse the repository at this point in the history
  • Loading branch information
anjannath committed Nov 11, 2024
1 parent 7db5d30 commit c7644fd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/provider/aws/modules/spot/stack.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit c7644fd

Please sign in to comment.