hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.86k stars 9.2k forks source link

[Bug]: EMR scaling policy in state for old manually terminated cluster causes plan to fail #32248

Open silentchills opened 1 year ago

silentchills commented 1 year ago

Terraform Core Version

0.12.31

AWS Provider Version

3.76.1

Affected Resource(s)

aws_emr_managed_scaling_policy

Expected Behavior

The EMR cluster and thus it's associated scaling policy had been manually deleted months ago, so we expected it to be created with the new cluster.

Actual Behavior

There was an error on the scaling policy during the plan, complaining that the associated EMR cluster could not be found. Seems to be similar to this resolved issue on the cluster resource.

We were able to work around this by removing the resource from the statefile. On the next apply the EMR cluster and this resource were created successfully.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_emr_cluster" "emr_cluster" {
  name          = "spark-cluster"
  release_label = "emr-6.4.0"
  applications  = ["Spark"]
...
}

resource "aws_emr_managed_scaling_policy" "autoscaling_policy" {
  cluster_id = aws_emr_cluster.emr_cluster.id
  compute_limits {
    unit_type                       = "Instances"
    minimum_capacity_units          = 2
    maximum_capacity_units          = 32
    maximum_ondemand_capacity_units = 32
    maximum_core_capacity_units     = 2
  }
}

Steps to Reproduce

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

Seems to be similar to this resolved issue on the cluster resource.

Also saw this issue with EMR instance groups, but I see that was fixed in TF provider 4.26.

Would you like to implement a fix?

No

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue