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_emr_instance_group: Wait for RUNNING status on creation and various fixes to be region/partition agnostic #11688

Merged
merged 1 commit into from
Jan 29, 2020

Conversation

bflad
Copy link
Member

@bflad bflad commented Jan 21, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

* resource/aws_emr_instance_group: Wait for `RUNNING` status on creation

Previously in the acceptance testing:

--- FAIL: TestAccAWSEMRInstanceGroup_basic (74.42s)
    testing.go:640: Step 0 error: errors during apply:

        Error: Error waiting for EMR Cluster state to be "WAITING" or "RUNNING": TERMINATED_WITH_ERRORS: VALIDATION_ERROR: The requested instance type c4.large is not supported in the requested availability zone. Learn more at https://docs.aws.amazon.com/console/elasticmapreduce/ERROR_noinstancetype

--- FAIL: TestAccAWSEMRInstanceGroup_AutoScalingPolicy (560.19s)
    testing.go:635: Step 1 error: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.

        (map[string]string) (len=1) {
         (string) (len=6) "status": (string) (len=8) "RESIZING"
        }

        (map[string]string) (len=1) {
         (string) (len=6) "status": (string) (len=12) "PROVISIONING"
        }

In the resource logic, we ensure the EMR Instance Group enters the RUNNING state on creation to satisfy Terraform's usual stabilization guarantees and account for EMR Instance Groups that may have failed on startup.

In the testing, we apply the same Availability Zone blacklisting as the aws_emr_cluster resource testing since many instance types are not available in usw2-az4. We also switch to using the aws_partition data source and remove bootstrap actions since the functionality is not required for testing the resource and breaks outside AWS Commercial, e.g. in GovCloud:

--- FAIL: TestAccAWSEMRInstanceGroup_basic (182.35s)
    testing.go:640: Step 0 error: errors during apply:

        Error: Error waiting for EMR Cluster state to be "WAITING" or "RUNNING": TERMINATING: BOOTSTRAP_FAILURE: Master instance (i-0f179d71c1ed4d08e) failed attempting to download bootstrap action 1 file from S3

Output from acceptance testing in AWS Commercial:

--- PASS: TestAccAWSEMRInstanceGroup_EmrClusterDisappears (635.92s)
--- PASS: TestAccAWSEMRInstanceGroup_basic (839.34s)
--- PASS: TestAccAWSEMRInstanceGroup_AutoScalingPolicy (856.98s)
--- PASS: TestAccAWSEMRInstanceGroup_InstanceCount (860.39s)
--- PASS: TestAccAWSEMRInstanceGroup_ConfigurationsJson (924.79s)
--- PASS: TestAccAWSEMRInstanceGroup_EbsConfig_EbsOptimized (1138.23s)
--- PASS: TestAccAWSEMRInstanceGroup_BidPrice (1355.93s)

Output from acceptance testing in AWS GovCloud (US) (remaining test failure will require a PreCheck):

--- PASS: TestAccAWSEMRInstanceGroup_EmrClusterDisappears (617.03s)
--- PASS: TestAccAWSEMRInstanceGroup_basic (757.87s)
--- FAIL: TestAccAWSEMRInstanceGroup_BidPrice (796.55s)
    testing.go:640: Step 2 error: errors during apply:

        Error: ValidationException: Attempted to launch spot instance in an unsupported region.
        	status code: 400, request id: 537adc73-095f-4212-af9e-8f49f996d60c

          on /var/folders/w8/05f3x02n27x72g0mc2jy6_180000gp/T/tf-test595681403/main.tf line 283:
          (source code not available)

--- PASS: TestAccAWSEMRInstanceGroup_InstanceCount (824.20s)
--- PASS: TestAccAWSEMRInstanceGroup_AutoScalingPolicy (826.08s)
--- PASS: TestAccAWSEMRInstanceGroup_ConfigurationsJson (843.25s)
--- PASS: TestAccAWSEMRInstanceGroup_EbsConfig_EbsOptimized (1055.92s)

@bflad bflad requested a review from a team January 21, 2020 14:12
@ghost ghost added size/M Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. service/emr Issues and PRs that pertain to the emr service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jan 21, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Jan 21, 2020
…and various fixes to be region/partition agnostic

Previously in the acceptance testing:

```
--- FAIL: TestAccAWSEMRInstanceGroup_basic (74.42s)
    testing.go:640: Step 0 error: errors during apply:

        Error: Error waiting for EMR Cluster state to be "WAITING" or "RUNNING": TERMINATED_WITH_ERRORS: VALIDATION_ERROR: The requested instance type c4.large is not supported in the requested availability zone. Learn more at https://docs.aws.amazon.com/console/elasticmapreduce/ERROR_noinstancetype

--- FAIL: TestAccAWSEMRInstanceGroup_AutoScalingPolicy (560.19s)
    testing.go:635: Step 1 error: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.

        (map[string]string) (len=1) {
         (string) (len=6) "status": (string) (len=8) "RESIZING"
        }

        (map[string]string) (len=1) {
         (string) (len=6) "status": (string) (len=12) "PROVISIONING"
        }
```

In the resource logic, we ensure the EMR Instance Group enters the RUNNING state on creation to satisfy Terraform's usual stabilization guarantees and account for EMR Instance Groups that may have failed on startup.

In the testing, we apply the same Availability Zone blacklisting as the `aws_emr_cluster` resource testing since many instance types are not available in usw2-az4. We also switch to using the aws_partition data source and remove bootstrap actions since the functionality is not required for testing the resource and breaks outside AWS Commercial, e.g. in GovCloud:

```
--- FAIL: TestAccAWSEMRInstanceGroup_basic (182.35s)
    testing.go:640: Step 0 error: errors during apply:

        Error: Error waiting for EMR Cluster state to be "WAITING" or "RUNNING": TERMINATING: BOOTSTRAP_FAILURE: Master instance (i-0f179d71c1ed4d08e) failed attempting to download bootstrap action 1 file from S3
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSEMRInstanceGroup_EmrClusterDisappears (635.92s)
--- PASS: TestAccAWSEMRInstanceGroup_basic (839.34s)
--- PASS: TestAccAWSEMRInstanceGroup_AutoScalingPolicy (856.98s)
--- PASS: TestAccAWSEMRInstanceGroup_InstanceCount (860.39s)
--- PASS: TestAccAWSEMRInstanceGroup_ConfigurationsJson (924.79s)
--- PASS: TestAccAWSEMRInstanceGroup_EbsConfig_EbsOptimized (1138.23s)
--- PASS: TestAccAWSEMRInstanceGroup_BidPrice (1355.93s)
```

Output from acceptance testing in AWS GovCloud (US) (remaining test failure will require a `PreCheck`):

```
--- PASS: TestAccAWSEMRInstanceGroup_EmrClusterDisappears (617.03s)
--- PASS: TestAccAWSEMRInstanceGroup_basic (757.87s)
--- FAIL: TestAccAWSEMRInstanceGroup_BidPrice (796.55s)
    testing.go:640: Step 2 error: errors during apply:

        Error: ValidationException: Attempted to launch spot instance in an unsupported region.
        	status code: 400, request id: 537adc73-095f-4212-af9e-8f49f996d60c

          on /var/folders/w8/05f3x02n27x72g0mc2jy6_180000gp/T/tf-test595681403/main.tf line 283:
          (source code not available)

--- PASS: TestAccAWSEMRInstanceGroup_InstanceCount (824.20s)
--- PASS: TestAccAWSEMRInstanceGroup_AutoScalingPolicy (826.08s)
--- PASS: TestAccAWSEMRInstanceGroup_ConfigurationsJson (843.25s)
--- PASS: TestAccAWSEMRInstanceGroup_EbsConfig_EbsOptimized (1055.92s)
```
@bflad bflad force-pushed the t-aws_emr_instance_group-test-config-fixes branch from bc995f2 to ce68dc5 Compare January 21, 2020 14:45
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Jan 21, 2020
@aeschright aeschright self-assigned this Jan 22, 2020
Copy link
Contributor

@aeschright aeschright left a comment

Choose a reason for hiding this comment

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

🚀

AWS Commercial

--- PASS: TestAccAWSEMRInstanceGroup_EmrClusterDisappears (625.30s)
--- PASS: TestAccAWSEMRInstanceGroup_basic (821.07s)
--- PASS: TestAccAWSEMRInstanceGroup_AutoScalingPolicy (856.61s)
--- PASS: TestAccAWSEMRInstanceGroup_ConfigurationsJson (861.34s)
--- PASS: TestAccAWSEMRInstanceGroup_InstanceCount (880.06s)
--- PASS: TestAccAWSEMRInstanceGroup_EbsConfig_EbsOptimized (1038.06s)
--- PASS: TestAccAWSEMRInstanceGroup_BidPrice (1267.92s)

AWS GovCloud

--- PASS: TestAccAWSEMRInstanceGroup_EmrClusterDisappears (572.86s)
--- PASS: TestAccAWSEMRInstanceGroup_basic (719.57s)
--- PASS: TestAccAWSEMRInstanceGroup_AutoScalingPolicy (752.50s)
--- FAIL: TestAccAWSEMRInstanceGroup_BidPrice (755.91s)
    testing.go:640: Step 2 error: errors during apply:
        
        Error: ValidationException: Attempted to launch spot instance in an unsupported region.
        	status code: 400, request id: bcf4e73f-ac2d-4b90-8591-f6657b5b72a8
        
          on /opt/teamcity-agent/temp/buildTmp/tf-test136962213/main.tf line 283:
          (source code not available)
        
        
--- PASS: TestAccAWSEMRInstanceGroup_EmrClusterDisappears (572.86s)
--- PASS: TestAccAWSEMRInstanceGroup_basic (719.57s)
--- PASS: TestAccAWSEMRInstanceGroup_AutoScalingPolicy (752.50s)

@bflad bflad added this to the v2.47.0 milestone Jan 29, 2020
@bflad bflad merged commit 45026b9 into master Jan 29, 2020
@bflad bflad deleted the t-aws_emr_instance_group-test-config-fixes branch January 29, 2020 16:50
bflad added a commit that referenced this pull request Jan 29, 2020
@ghost
Copy link

ghost commented Jan 30, 2020

This has been released in version 2.47.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!

@ghost
Copy link

ghost commented Mar 27, 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 Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/emr Issues and PRs that pertain to the emr service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants