-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
EMR Cluster Import Support #6498
Conversation
…undin/terraform-provider-aws into stefansundin-aws_emr_cluster-importer
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.
Oh, EMR. 😅 Feel free to ping me directly to discuss anything!
aws/resource_aws_emr_cluster.go
Outdated
@@ -202,14 +211,16 @@ func resourceAwsEMRCluster() *schema.Resource { | |||
Required: false, | |||
}, | |||
"ebs_config": { | |||
Type: schema.TypeSet, | |||
Type: schema.TypeList, |
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.
Was this change intentional? If so, we should also set MaxItems: 1
as well - otherwise we should undo this change as its not reliable to migrate a Terraform state and configuration from a multiple element TypeSet
to TypeList
.
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.
It was intentional because of another issue that cropped up. I've since fixed both of these issues and we're back to TypeSet on ebs_config
aws/resource_aws_emr_cluster.go
Outdated
@@ -238,6 +249,7 @@ func resourceAwsEMRCluster() *schema.Resource { | |||
Optional: true, | |||
DiffSuppressFunc: suppressEquivalentJsonDiffs, | |||
ValidateFunc: validation.ValidateJsonString, | |||
Computed: true, |
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.
I'm trying not to introduce too much further scope creep into this pull request, but can you please add acceptance testing that attempts to update autoscaling_policy
? I have a hunch that it will result in a permanent difference, especially with the new Set
function. I think the same problem also applies to bid_price
, instance_count
, and especially instance_role
. These attributes likely should be ForceNew: true
if I'm right, but maybe I'm wrong.
I'm also not opposed to updating the resource documentation to discourage the usage of instance_group
in preference of the (upcoming) aws_emr_instance_fleet
and aws_emr_instance_group
resources.
aws/resource_aws_emr_cluster.go
Outdated
|
||
ebsConfig = append(ebsConfig, ebsAttrs) | ||
if ig.EbsBlockDevices != nil { |
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.
range
automatically can handle nil
slices, so I don't believe this nil
check is necessary: https://play.golang.org/p/-9ZKxKImPFH
aws/resource_aws_emr_cluster.go
Outdated
autoscalingPolicyBytes, err := json.Marshal(ig.AutoScalingPolicy) | ||
autoscalingPolicyString := string(autoscalingPolicyBytes) | ||
if err != nil { | ||
return nil, err |
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.
Nit: We should probably provide some context about this error here:
return nil, err | |
return nil, fmt.Errorf("error parsing EMR Cluster Instance Groups AutoScalingPolicy: %s", err) |
aws/resource_aws_emr_cluster_test.go
Outdated
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{ | ||
"configurations", | ||
"core_instance_count", |
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.
Should this still be ignoring the core_instance_*
attributes?
aws/resource_aws_emr_cluster_test.go
Outdated
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{ | ||
"configurations", | ||
"core_instance_count", |
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.
Should this still be ignoring core_instance_*
attributes?
@bflad, this is ready for another pass. I've swapped everything back to Sets and added hashcodes to each one. Also, I'm doing a funky thing with CustomizeDiff that is preventing changing the autoscaling policy for an instance group to recreate the whole resource.
|
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.
Let's get this in. Thanks so much @mbfrahry and @tracypholmes for your dedication here! 🚀 🎉
--- PASS: TestAccAWSEMRCluster_Kerberos_ClusterDedicatedKdc (468.11s)
--- PASS: TestAccAWSEMRCluster_security_config (502.72s)
--- PASS: TestAccAWSEMRCluster_instance_group_EBSVolumeType_st1 (515.43s)
--- PASS: TestAccAWSEMRCluster_bootstrap_ordering (518.55s)
--- PASS: TestAccAWSEMRCluster_instance_group (523.49s)
--- PASS: TestAccAWSEMRCluster_keepJob (533.63s)
--- PASS: TestAccAWSEMRCluster_custom_ami_id (537.09s)
--- PASS: TestAccAWSEMRCluster_instance_group_update (551.88s)
--- PASS: TestAccAWSEMRCluster_Step_Basic (576.80s)
--- PASS: TestAccAWSEMRCluster_basic (577.48s)
--- PASS: TestAccAWSEMRCluster_configurationsJson (585.18s)
--- PASS: TestAccAWSEMRCluster_Step_Multiple (594.08s)
--- PASS: TestAccAWSEMRCluster_terminationProtected (658.88s)
--- PASS: TestAccAWSEMRCluster_s3Logging (688.12s)
--- PASS: TestAccAWSEMRCluster_updateAutoScalingPolicy (690.46s)
--- PASS: TestAccAWSEMRCluster_additionalInfo (823.56s)
--- PASS: TestAccAWSEMRCluster_visibleToAllUsers (902.38s)
--- PASS: TestAccAWSEMRCluster_root_volume_size (919.39s)
--- PASS: TestAccAWSEMRCluster_tags (989.43s)
This has been released in version 1.56.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I believe this may have introduced a bug when using the optional |
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! |
This PR finalizes adding support for Import on emr clusters #6498.
It fixes an issue where changing an optional value in a Set would force the recreation of the whole resource.
It removes all log errors in favor of returning an error message #3652.