…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)
```