-
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_emr_managed_scaling_policy: Ensure cluster_id attribute is saved during import and handle additional disappears cases #15541
Conversation
…is saved during import and handle additional disappears cases The Terraform Plugin SDK version 2.0.4 upgrade fixed something with `ImportStateVerify` testing, which now catches these arguments taht were not properly being set during `Read`. The EMR API behavior seems to have changed since the initial resource release where it will now return an error on `GetManagedScalingPolicy` when the Cluster is shutting down or finished and not returning an error when the policy has been removed. This change set updates the `Read` logic to handle these two new scenarios. The test configuration change to include `keep_job_flow_alive_when_no_steps` is to ensure the EMR Cluster shutting down is not because it has no pre-defined steps to execute and prevent any inconsistent behaviors because of that timing. Previously: ``` === CONT TestAccAwsEmrManagedScalingPolicy_basic TestAccAwsEmrManagedScalingPolicy_basic: resource_aws_emr_managed_scaling_policy_test.go:17: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected. (map[string]string) { } (map[string]string) (len=1) { (string) (len=10) "cluster_id": (string) (len=15) "j-16JIKGI1IWJ4W" } TestAccAwsEmrManagedScalingPolicy_basic: testing_new.go:62: Error running post-test destroy, there may be dangling resources: ValidationException: A job flow that is shutting down, terminated, or finished may not be modified. status code: 400, request id: d29fc848-2bcc-459c-ad4a-bb4b09f90060 --- FAIL: TestAccAwsEmrManagedScalingPolicy_basic (480.77s) === CONT TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumCoreCapacityUnits TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumCoreCapacityUnits: resource_aws_emr_managed_scaling_policy_test.go:41: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected. (map[string]string) { } (map[string]string) (len=1) { (string) (len=10) "cluster_id": (string) (len=15) "j-3Q9RF3NQJGV46" } TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumCoreCapacityUnits: testing_new.go:62: Error running post-test destroy, there may be dangling resources: ValidationException: A job flow that is shutting down, terminated, or finished may not be modified. status code: 400, request id: 3faa75d9-7536-4289-9684-4ea6a13f2bfa --- FAIL: TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumCoreCapacityUnits (457.36s) === CONT TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumOndemandCapacityUnits TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumOndemandCapacityUnits: resource_aws_emr_managed_scaling_policy_test.go:65: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected. (map[string]string) { } (map[string]string) (len=1) { (string) (len=10) "cluster_id": (string) (len=14) "j-9DEX7HNVJG1N" } TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumOndemandCapacityUnits: testing_new.go:62: Error running post-test destroy, there may be dangling resources: ValidationException: A job flow that is shutting down, terminated, or finished may not be modified. status code: 400, request id: 712836ec-ab7e-4f9f-95ed-413fd9a7729c --- FAIL: TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumOndemandCapacityUnits (474.25s) === CONT TestAccAwsEmrManagedScalingPolicy_disappears TestAccAwsEmrManagedScalingPolicy_disappears: resource_aws_emr_managed_scaling_policy_test.go:89: Step 1/1 error: Expected a non-empty plan, but got an empty plan! TestAccAwsEmrManagedScalingPolicy_disappears: testing_new.go:62: Error running post-test destroy, there may be dangling resources: ValidationException: A job flow that is shutting down, terminated, or finished may not be modified. status code: 400, request id: 98a29b6f-3c80-47ca-99ac-3f870426a93c --- FAIL: TestAccAwsEmrManagedScalingPolicy_disappears (483.72s) ``` Output from acceptance testing: ``` --- PASS: TestAccAwsEmrManagedScalingPolicy_disappears (453.77s) --- PASS: TestAccAwsEmrManagedScalingPolicy_basic (456.74s) --- PASS: TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumCoreCapacityUnits (467.67s) --- PASS: TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumOndemandCapacityUnits (490.01s) ```
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.
LGTM 🚀
--- PASS: TestAccAwsEmrManagedScalingPolicy_basic (457.13s)
--- PASS: TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumOndemandCapacityUnits (477.22s)
--- PASS: TestAccAwsEmrManagedScalingPolicy_disappears (480.92s)
--- PASS: TestAccAwsEmrManagedScalingPolicy_ComputeLimits_MaximumCoreCapacityUnits (534.14s)
This has been released in version 3.10.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
Release note for CHANGELOG:
The Terraform Plugin SDK version 2.0.4 upgrade fixed something with
ImportStateVerify
testing, which now catches these arguments that were not properly being set duringRead
.The EMR API behavior also seems to have changed since the initial resource release where it will now return an error on
GetManagedScalingPolicy
when the Cluster is shutting down or finished and not returning an error when the policy has been removed. This change set updates theRead
logic to handle these two new scenarios.The test configuration change to include
keep_job_flow_alive_when_no_steps
is to ensure the EMR Cluster shutting down is not because it has no pre-defined steps to execute and prevent any inconsistent behaviors because of that timing.Previously:
Output from acceptance testing: