DeployStack deploys or updates a CloudFormation stack
(ctx context.Context, templateBody string)
| 38 | |
| 39 | // DeployStack deploys or updates a CloudFormation stack |
| 40 | func (s *StackDeployer) DeployStack(ctx context.Context, templateBody string) (*StackOutput, error) { |
| 41 | stackName := s.getFullStackName() |
| 42 | |
| 43 | log.Printf("Deploying CloudFormation stack: %s", stackName) |
| 44 | |
| 45 | exists, err := s.stackExists(ctx, stackName) |
| 46 | if err != nil { |
| 47 | return nil, fmt.Errorf("failed to check if stack exists: %w", err) |
| 48 | } |
| 49 | |
| 50 | parameters := s.buildStackParameters() |
| 51 | |
| 52 | if exists { |
| 53 | return s.updateStack(ctx, stackName, templateBody, parameters) |
| 54 | } |
| 55 | |
| 56 | return s.createStack(ctx, stackName, templateBody, parameters) |
| 57 | } |
| 58 | |
| 59 | // DeleteStack deletes a CloudFormation stack |
| 60 | func (s *StackDeployer) DeleteStack(ctx context.Context) error { |
no test coverage detected