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.88k stars 9.22k forks source link

[Bug]: rds/aurora disable_scale_in doesn't work #33284

Open edgan opened 1 year ago

edgan commented 1 year ago

Terraform Core Version

1.5.6

AWS Provider Version

5.15.0

Affected Resource(s)

aws_appautoscaling_policy

Expected Behavior

Scale-in is enabled by default

Actual Behavior

Scale-in is disabled in the console

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_appautoscaling_policy" "autoscaling_read_replica_count" {
  depends_on         = [aws_appautoscaling_target.read_replica_count]
  name               = "target-metric"
  policy_type        = "TargetTrackingScaling"
  resource_id        = "cluster:${element(concat(aws_rds_cluster.postgresql.*.cluster_identifier, [""]), 0)}"
  scalable_dimension = "rds:cluster:ReadReplicaCount"
  service_namespace  = "rds"

  target_tracking_scaling_policy_configuration {
    predefined_metric_specification {
      predefined_metric_type = var.predefined_metric_type
    }

    scale_in_cooldown  = var.replica_scale_in_cooldown
    scale_out_cooldown = var.replica_scale_out_cooldown
    target_value       = var.predefined_metric_type == "RDSReaderAverageCPUUtilization" ? var.replica_scale_cpu : var.replica_scale_connections
  }
}

Steps to Reproduce

  1. Create a policy on an RDS/Aurora cluster

Debug Output

No response

Panic Output

No response

Important Factoids

I have tried using disable_scale_in = true, disable_scale_in = false, and enabling it manually in the console. It has no effect on what terraform says. Technically scale_in_cooldown is also being ignored but set it in the code. It shows up as greyed out in the console.

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

edgan commented 1 year ago

I started on 4.67.0, but upgrading to 5.15.0 didn't help.

I am seeing this on multiple Aurora clusters.

edgan commented 1 year ago

This seems like an intermittent or per cluster bug. I saw it with one cluster, but then it worked normally on the next one.