Skip to content
Permalink
Browse files

fix: improve idempotency of stack deletion

when partially deleted due to changing policies, manually deleting functions, etc
  • Loading branch information...
tj committed Mar 3, 2018
1 parent 8acdc99 commit 1d316663f80c7d0f70bddc15c5fe2e07a95d0aa2
Showing with 7 additions and 6 deletions.
  1. +7 −6 platform/lambda/lambda.go
@@ -246,13 +246,14 @@ func (p *Platform) CreateStack(region, version string) error {

// DeleteStack implementation.
func (p *Platform) DeleteStack(region string, wait bool) error {
if err := p.createRole(); err != nil {
return errors.Wrap(err, "creating iam role")
versions := resources.Versions{}

for _, s := range p.config.Stages {
versions[s.Name] = "1"
}

versions, err := p.getAliasVersions(region)
if err != nil {
return errors.Wrap(err, "fetching alias versions")
if err := p.createRole(); err != nil {
return errors.Wrap(err, "creating iam role")
}

log.Debug("deleting bucket objects")
@@ -261,7 +262,7 @@ func (p *Platform) DeleteStack(region string, wait bool) error {
}

log.Debug("deleting stack")
if err := stack.New(p.config, p.events, nil, region).Delete(versions, wait); err != nil {
if err := stack.New(p.config, p.events, nil, region).Delete(versions, wait); err != nil && !util.IsNotFound(err) {
return errors.Wrap(err, "deleting stack")
}

0 comments on commit 1d31666

Please sign in to comment.
You can’t perform that action at this time.