Skip to content

Commit

Permalink
Merge pull request #3171 from terraform-providers/b-aws_elastic_beans…
Browse files Browse the repository at this point in the history
…talk_application-missing-app-crash

resource/aws_elastic_beanstalk_application: Prevent crash on reading missing application
  • Loading branch information
bflad authored Jan 29, 2018
2 parents 451472b + 5cfac84 commit 1c4ea52
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion aws/resource_aws_elastic_beanstalk_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,20 @@ func resourceAwsElasticBeanstalkApplicationRead(d *schema.ResourceData, meta int
}

if app == nil {
err = fmt.Errorf("Elastic Beanstalk Application %q not found", d.Id())
if d.IsNewResource() {
return resource.RetryableError(fmt.Errorf("Elastic Beanstalk Application %q not found.", d.Id()))
return resource.RetryableError(err)
}
return resource.NonRetryableError(err)
}
return nil
})
if err != nil {
if app == nil {
log.Printf("[WARN] %s, removing from state", err)
d.SetId("")
return nil
}
return err
}

Expand Down

0 comments on commit 1c4ea52

Please sign in to comment.