MCPcopy Index your code
hub / github.com/eksctl-io/eksctl / updateStack

Method updateStack

pkg/cfn/manager/api.go:336–383  ·  view source on GitHub ↗
(ctx context.Context, options UpdateStackOptions, ignoreNoChangeError bool)

Source from the content-addressed store, hash-verified

334}
335
336func (c *StackCollection) updateStack(ctx context.Context, options UpdateStackOptions, ignoreNoChangeError bool) error {
337 logger.Info(options.Description)
338 if options.Stack == nil {
339 i := &Stack{StackName: &options.StackName}
340 // Read existing tags and capabilities
341 s, err := c.DescribeStack(ctx, i)
342 if err != nil {
343 return err
344 }
345 options.Stack = s
346 } else {
347 options.StackName = *options.Stack.StackName
348 }
349 if err := c.doCreateChangeSetRequest(ctx,
350 options.StackName,
351 options.ChangeSetName,
352 options.Description,
353 options.TemplateData,
354 options.Parameters,
355 options.Stack.Capabilities,
356 options.Stack.Tags,
357 ); err != nil {
358 return err
359 }
360 if err := c.doWaitUntilChangeSetIsCreated(ctx, options.Stack, options.ChangeSetName); err != nil {
361 var noChangeErr *NoChangeError
362 if errors.As(err, &noChangeErr) {
363 if ignoreNoChangeError {
364 return nil
365 }
366 return err
367 }
368 return err
369 }
370 changeSet, err := c.DescribeStackChangeSet(ctx, options.Stack, options.ChangeSetName)
371 if err != nil {
372 return err
373 }
374 logger.Debug("changes = %#v", changeSet.Changes)
375 if err := c.doExecuteChangeSet(ctx, options.StackName, options.ChangeSetName); err != nil {
376 logger.Warning("error executing Cloudformation changeSet %s in stack %s. Check the Cloudformation console for further details", options.ChangeSetName, options.StackName)
377 return err
378 }
379 if options.Wait {
380 return c.doWaitUntilStackIsUpdated(ctx, options.Stack)
381 }
382 return nil
383}
384
385// MustUpdateStack is like UpdateStack but returns a NoChangeError if there are no changes to execute.
386func (c *StackCollection) MustUpdateStack(ctx context.Context, options UpdateStackOptions) error {

Callers 2

UpdateStackMethod · 0.95
MustUpdateStackMethod · 0.95

Calls 6

DescribeStackMethod · 0.95
doExecuteChangeSetMethod · 0.95

Tested by

no test coverage detected