MCPcopy Create free account
hub / github.com/dan-v/lambda-nat-proxy / DeleteStack

Method DeleteStack

internal/deploy/stack.go:60–83  ·  view source on GitHub ↗

DeleteStack deletes a CloudFormation stack

(ctx context.Context)

Source from the content-addressed store, hash-verified

58
59// DeleteStack deletes a CloudFormation stack
60func (s *StackDeployer) DeleteStack(ctx context.Context) error {
61 stackName := s.getFullStackName()
62
63 log.Printf("Deleting CloudFormation stack: %s", stackName)
64
65 input := &cloudformation.DeleteStackInput{
66 StackName: aws.String(stackName),
67 }
68
69 _, err := s.clients.CloudFormation.DeleteStackWithContext(ctx, input)
70 if err != nil {
71 return fmt.Errorf("failed to delete stack: %w", err)
72 }
73
74 // Wait for deletion to complete
75 log.Printf("Waiting for stack deletion to complete...")
76 err = s.waitForStackOperation(ctx, stackName, cloudformation.StackStatusDeleteComplete, 20*time.Minute)
77 if err != nil {
78 return fmt.Errorf("stack deletion failed: %w", err)
79 }
80
81 log.Printf("Stack deleted successfully")
82 return nil
83}
84
85// GetStackOutputs retrieves outputs from a CloudFormation stack
86func (s *StackDeployer) GetStackOutputs(ctx context.Context) (*StackOutput, error) {

Callers 1

runDestroyFunction · 0.95

Calls 3

getFullStackNameMethod · 0.95
waitForStackOperationMethod · 0.95

Tested by

no test coverage detected