-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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_environment: Handle Terminated status on deletion, use IAM Instance Profile and custom service role in testing #15158
Conversation
…on deletion, use IAM Instance Profile and custom service role in testing Reference: #15155 Previously: ``` === CONT TestAccAWSBeanstalkEnv_basic TestAccAWSBeanstalkEnv_basic: resource_aws_elastic_beanstalk_environment_test.go:81: Step 1/2 error: terraform failed: exit status 1 stderr: Error: Error waiting for Elastic Beanstalk Environment (e-scpzxse7ei) to become ready: 2 errors occurred: * 2020-09-15 07:48:42.231 +0000 UTC (e-scpzxse7ei) : Environment must have instance profile associated with it. * 2020-09-15 07:48:42.343 +0000 UTC (e-scpzxse7ei) : Failed to launch environment. TestAccAWSBeanstalkEnv_basic: testing_new.go:22: WARNING: destroy failed, so remote objects may still exist and be subject to billing TestAccAWSBeanstalkEnv_basic: testing_new.go:22: failed to destroy: terraform failed: exit status 1 stderr: Error: error waiting for Elastic Beanstalk Environment "e-scpzxse7ei" to be ready before terminating: unexpected state 'Terminated', wanted target 'Ready'. last error: %!s(<nil>) --- FAIL: TestAccAWSBeanstalkEnv_basic (31.41s) ``` After fixing the IAM Instance Profile error, received these two types of failures still: ``` === CONT TestAccAWSBeanstalkEnv_tier resource_aws_elastic_beanstalk_environment_test.go:118: Step 1/2 error: terraform failed: exit status 1 stderr: Error: Error waiting for Elastic Beanstalk Environment (e-3tebzj5j3h) to become ready: 1 error occurred: * 2020-09-15 17:10:28.142 +0000 UTC (e-3tebzj5j3h) : Failed to launch environment. testing_new.go:22: WARNING: destroy failed, so remote objects may still exist and be subject to billing testing_new.go:22: failed to destroy: terraform failed: exit status 1 stderr: Error: error waiting for Elastic Beanstalk Environment "e-3tebzj5j3h" to be ready before terminating: unexpected state 'Terminated', wanted target 'Ready'. last error: %!s(<nil>) ``` To handle the destroy error, added the `Terminating` and `Terminated` handling to the resource deletion polling. Looking in the console, the opaque `Failed to launch environment.` error details were found in this other `INFO` level event: ``` Operation failed because the environment needs a service role. You made the call without one, and you're missing the permission to create a service-linked role for this account. Repeat the call and provide a service role. Alternatively, ask your account administrator to create the account's service-linked role, and then repeat the call. ``` These test configurations were dependent on the Elastic Beanstalk IAM Service-Linked Role since they did not declare a custom IAM Role for the service role. While the credentials in use did have permissions, there was a delay before the EB created SLR was ready, introducing a few test failures until the rest would succeed once the SLR was propagated. This SLR is also challenging because the `TestAccAWSIAMServiceLinkedRole_basic` testing explicitly deletes it. Rather than keep reliance on this flaky shared resource, instead opted to customize the service role. Output from acceptance testing: ``` --- PASS: TestAccAWSBeanstalkEnv_basic (462.19s) --- PASS: TestAccAWSBeanstalkEnv_cname_prefix (632.10s) --- PASS: TestAccAWSBeanstalkEnv_config (519.50s) --- PASS: TestAccAWSBeanstalkEnv_platformArn (465.62s) --- PASS: TestAccAWSBeanstalkEnv_resource (502.50s) --- PASS: TestAccAWSBeanstalkEnv_settingWithJsonValue (381.12s) --- PASS: TestAccAWSBeanstalkEnv_settings_update (716.57s) --- PASS: TestAccAWSBeanstalkEnv_tags (694.50s) --- PASS: TestAccAWSBeanstalkEnv_template_change (612.67s) --- PASS: TestAccAWSBeanstalkEnv_tier (726.73s) --- PASS: TestAccAWSBeanstalkEnv_version_label (534.55s) ```
038e650
to
7694c1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 🙌 , LGTM.
Output of acceptance tests:
--- PASS: TestAccAWSBeanstalkEnv_resource (357.80s)
--- PASS: TestAccAWSBeanstalkEnv_settingWithJsonValue (395.57s)
--- PASS: TestAccAWSBeanstalkEnv_config (488.91s)
--- PASS: TestAccAWSBeanstalkEnv_basic (496.17s)
--- PASS: TestAccAWSBeanstalkEnv_cname_prefix (543.40s)
--- PASS: TestAccAWSBeanstalkEnv_platformArn (597.47s)
--- PASS: TestAccAWSBeanstalkEnv_template_change (598.45s)
--- PASS: TestAccAWSBeanstalkEnv_tier (627.33s)
--- PASS: TestAccAWSBeanstalkEnv_settings_update (677.82s)
--- PASS: TestAccAWSBeanstalkEnv_tags (749.96s)
--- PASS: TestAccAWSBeanstalkEnv_version_label (802.65s)
This has been released in version 3.8.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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! |
Community Note
Closes #15155
Release note for CHANGELOG:
Previously:
After fixing the IAM Instance Profile error, received these two types of failures still:
To handle the destroy error, added the
Terminating
andTerminated
handling to the resource deletion polling. Looking in the console, the opaqueFailed to launch environment.
error details were found in this otherINFO
level event:These test configurations were dependent on the Elastic Beanstalk IAM Service-Linked Role since they did not declare a custom IAM Role for the service role. While the credentials in use did have permissions, there was a delay before the EB created SLR was ready, introducing a few test failures until the rest would succeed once the SLR was propagated. This SLR is also challenging because the
TestAccAWSIAMServiceLinkedRole_basic
testing explicitly deletes it. Rather than keep reliance on this flaky shared resource, instead opted to customize the service role.Output from acceptance testing: