From 5cfac84d26068012fb69eea4a0f73cf9e3a36e2e Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Sun, 28 Jan 2018 13:24:06 -0500 Subject: [PATCH] resource/aws_elastic_beanstalk_application: Prevent crash on reading missing application --- aws/resource_aws_elastic_beanstalk_application.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_elastic_beanstalk_application.go b/aws/resource_aws_elastic_beanstalk_application.go index cbc589db831..fdb6c199b32 100644 --- a/aws/resource_aws_elastic_beanstalk_application.go +++ b/aws/resource_aws_elastic_beanstalk_application.go @@ -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 }