Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/aws_elastic_beanstalk_application: Retry DescribeApplication after creation #3064

Merged
merged 1 commit into from
Jan 19, 2018

Conversation

radeksimko
Copy link
Member

This is to address the following test failure:

=== RUN   TestAccAWSBeanstalkConfigurationTemplate_Setting
--- FAIL: TestAccAWSBeanstalkConfigurationTemplate_Setting (3.30s)
    testing.go:513: Step 0 error: Error applying: 1 error(s) occurred:
        
        * aws_elastic_beanstalk_configuration_template.tf_template: Resource 'aws_elastic_beanstalk_application.tftest' does not have attribute 'name' for variable 'aws_elastic_beanstalk_application.tftest.name'

Snippet from related debug log:

2018/01/19 06:01:38 [DEBUG] [aws-sdk-go] DEBUG: Response elasticbeanstalk/CreateApplication Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 1074
Content-Type: text/xml
Date: Fri, 19 Jan 2018 06:01:38 GMT
X-Amzn-Requestid: c6550632-5f63-4361-afd6-31fda2e949f9


<CreateApplicationResponse xmlns="http://elasticbeanstalk.amazonaws.com/docs/2010-12-01/">
  <CreateApplicationResult>
    <Application>
      <ConfigurationTemplates/>
      <DateCreated>2018-01-19T06:01:38.652Z</DateCreated>
      <ResourceLifecycleConfig>
        <VersionLifecycleConfig>
          <MaxAgeRule>
            <MaxAgeInDays>180</MaxAgeInDays>
            <DeleteSourceFromS3>false</DeleteSourceFromS3>
            <Enabled>false</Enabled>
          </MaxAgeRule>
          <MaxCountRule>
            <DeleteSourceFromS3>false</DeleteSourceFromS3>
            <MaxCount>200</MaxCount>
            <Enabled>false</Enabled>
          </MaxCountRule>
        </VersionLifecycleConfig>
      </ResourceLifecycleConfig>
      <Description>tf-test-desc</Description>
      <ApplicationName>tf-test-qvufh</ApplicationName>
      <DateUpdated>2018-01-19T06:01:38.652Z</DateUpdated>
    </Application>
  </CreateApplicationResult>
  <ResponseMetadata>
    <RequestId>c6550632-5f63-4361-afd6-31fda2e949f9</RequestId>
  </ResponseMetadata>
</CreateApplicationResponse>
-----------------------------------------------------
2018/01/19 06:01:38 [DEBUG] [aws-sdk-go] DEBUG: Request elasticbeanstalk/DescribeApplications Details:
---[ REQUEST POST-SIGN ]-----------------------------
POST / HTTP/1.1
Host: elasticbeanstalk.us-west-2.amazonaws.com
User-Agent: aws-sdk-go/1.12.62 (go1.9.2; linux; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.11.2
Content-Length: 86
Authorization: AWS4-HMAC-SHA256 Credential=*REDACTED*/20180119/us-west-2/elasticbeanstalk/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date, Signature=*REDACTED*
Content-Type: application/x-www-form-urlencoded; charset=utf-8
X-Amz-Date: 20180119T060138Z
Accept-Encoding: gzip

Action=DescribeApplications&ApplicationNames.member.1=tf-test-qvufh&Version=2010-12-01
-----------------------------------------------------
2018/01/19 06:01:38 [DEBUG] [aws-sdk-go] DEBUG: Response elasticbeanstalk/DescribeApplications Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 200 OK
Connection: close
Content-Length: 316
Content-Type: text/xml
Date: Fri, 19 Jan 2018 06:01:38 GMT
X-Amzn-Requestid: d81365e0-3fc5-42b7-b6f5-39ea236658b4

<DescribeApplicationsResponse xmlns="http://elasticbeanstalk.amazonaws.com/docs/2010-12-01/">
  <DescribeApplicationsResult>
    <Applications/>
  </DescribeApplicationsResult>
  <ResponseMetadata>
    <RequestId>d81365e0-3fc5-42b7-b6f5-39ea236658b4</RequestId>
  </ResponseMetadata>
</DescribeApplicationsResponse>
-----------------------------------------------------

Test results

=== RUN   TestAccAWSBeanstalkAppVersion_basic
--- PASS: TestAccAWSBeanstalkAppVersion_basic (24.43s)
=== RUN   TestAccAWSBeanstalkApp_basic
--- PASS: TestAccAWSBeanstalkApp_basic (26.20s)
=== RUN   TestAccAWSBeanstalkAppVersion_duplicateLabels
--- PASS: TestAccAWSBeanstalkAppVersion_duplicateLabels (26.21s)
=== RUN   TestAccAWSBeanstalkConfigurationTemplate_Setting
--- PASS: TestAccAWSBeanstalkConfigurationTemplate_Setting (33.73s)
=== RUN   TestAccAWSBeanstalkConfigurationTemplate_basic
--- PASS: TestAccAWSBeanstalkConfigurationTemplate_basic (44.31s)
=== RUN   TestAccAWSBeanstalkConfigurationTemplate_VPC
--- PASS: TestAccAWSBeanstalkConfigurationTemplate_VPC (60.89s)
=== RUN   TestAccAWSBeanstalkEnv_cname_prefix
--- PASS: TestAccAWSBeanstalkEnv_cname_prefix (378.22s)
=== RUN   TestAccAWSBeanstalkEnv_resource
--- PASS: TestAccAWSBeanstalkEnv_resource (461.59s)
=== RUN   TestAccAWSBeanstalkEnv_basic
--- PASS: TestAccAWSBeanstalkEnv_basic (481.40s)
=== RUN   TestAccAWSBeanstalkEnv_template_change
--- PASS: TestAccAWSBeanstalkEnv_template_change (520.16s)
=== RUN   TestAccAWSBeanstalkEnv_outputs
--- PASS: TestAccAWSBeanstalkEnv_outputs (525.34s)
=== RUN   TestAccAWSBeanstalkEnv_vpc
--- PASS: TestAccAWSBeanstalkEnv_vpc (559.63s)
=== RUN   TestAccAWSBeanstalkEnv_config
--- PASS: TestAccAWSBeanstalkEnv_config (639.16s)
=== RUN   TestAccAWSBeanstalkEnv_tier
--- PASS: TestAccAWSBeanstalkEnv_tier (686.40s)
=== RUN   TestAccAWSBeanstalkEnv_basic_settings_update
--- PASS: TestAccAWSBeanstalkEnv_basic_settings_update (796.62s)
=== RUN   TestAccAWSBeanstalkEnv_version_label
--- PASS: TestAccAWSBeanstalkEnv_version_label (901.47s)
=== RUN   TestAccAWSBeanstalkEnv_settingWithJsonValue
--- PASS: TestAccAWSBeanstalkEnv_settingWithJsonValue (977.73s)

@radeksimko radeksimko added bug Addresses a defect in current functionality. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service. labels Jan 19, 2018
@radeksimko radeksimko requested a review from bflad January 19, 2018 11:08
return err
}
_, err = beanstalkConn.DeleteApplication(&elasticbeanstalk.DeleteApplicationInput{
_, err := beanstalkConn.DeleteApplication(&elasticbeanstalk.DeleteApplicationInput{
ApplicationName: aws.String(d.Id()),
})
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future note: we should add if isAWSErr(err, "InvalidBeanstalkAppID.NotFound", "") { here if necessary to immediately return nil

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can add that 👌

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this error will never be returned from that method, per docs and my own experiments. You get 200 OK if you try to delete an application which doesn't exist.

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Retry logic looks good, left 2 comments, which probably should be addressed now while we're in here, but not complete blockers.


if app == nil {
if d.IsNewResource() {
return resource.RetryableError(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: err will be nil for both of these app == nil error messages. Maybe should return something like fmt.Errorf("Reading Elastic Beanstalk application %s not found.", d.Id())?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point. 👍

@radeksimko radeksimko force-pushed the b-beanstalk-retry-after-creation branch from 521bba0 to 4c03876 Compare January 19, 2018 15:24
@radeksimko radeksimko merged commit fbc1514 into master Jan 19, 2018
@radeksimko radeksimko deleted the b-beanstalk-retry-after-creation branch January 19, 2018 15:28
@bflad
Copy link
Contributor

bflad commented Jan 22, 2018

This has been released in terraform-provider-aws version 1.7.1. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 8, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elasticbeanstalk Issues and PRs that pertain to the elasticbeanstalk service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants