terraform-aws-rds-aurora icon indicating copy to clipboard operation
terraform-aws-rds-aurora copied to clipboard

Autoscaling does not scale cluster to min capacity on creation

Open Neifn opened this issue 1 year ago β€’ 5 comments

Description

When creating a cluster with autoscaling enabled, cluster is not automatically scaled to autoscaling_min_capacity value and remains stuck with directly created instances.

  • [βœ…] βœ‹ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: 9.0.0

  • Terraform version: 1.7.2

  • Provider version(s): 5.35.0

Reproduction Code [Required]

module "aurora" {
  source  = "terraform-aws-modules/rds-aurora/aws"
  version = "9.0.0"

  name  = "test-aurora"

  engine         = "aurora-mysql"
  engine_version = "5.7.mysql_aurora.2.11.4"
  instance_class = "db.t3.medium"

  port    = 3306
  vpc_id  = module.vpc.vpc_id
  subnets = module.vpc-subnets.subnet_ids

  master_username                     = "admin"
  manage_master_user_password         = true
  iam_database_authentication_enabled = true

  instances                = { primary = {} }
  autoscaling_enabled      = true
  autoscaling_min_capacity = 2
  autoscaling_max_capacity = 3


  allow_major_version_upgrade = true
  apply_immediately           = true
  copy_tags_to_snapshot       = true
  skip_final_snapshot         = true
}

Steps to reproduce the behavior: terraform apply

Expected behavior

Reader nodes are scaled to the minimum capacity when cluster becomes available.

Actual behavior

Cluster will be created with only one instance. Autoscaling configuration will not add any reader nodes.

Additional context

If you set autoscaling_enabled to false and create aws_appautoscaling_target and aws_appautoscaling_policy outside the module with depends_on set to whole module reader nodes are created as expected.

Neifn avatar Feb 17 '24 14:02 Neifn

We have encountered the same issue recently, and found that the auto scaling policy is created, but seems to be inactive. By modifying the autoscaling policy, simply editing and saving, the auto scaler kicks in and creates the desired minimum instances.

NeoMopp avatar Mar 12 '24 11:03 NeoMopp

this appears to be related to an upstream issue https://github.com/hashicorp/terraform-provider-aws/issues/31329

bryantbiggs avatar Mar 12 '24 11:03 bryantbiggs

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] avatar Apr 12 '24 00:04 github-actions[bot]

@bryantbiggs I don't think it's directly related to the provider issue, given that it can be fixed by setting explicit dependency on whole module, as I described above.

Neifn avatar Apr 12 '24 07:04 Neifn

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] avatar May 13 '24 00:05 github-actions[bot]

This issue was automatically closed because of stale in 10 days

github-actions[bot] avatar May 24 '24 00:05 github-actions[bot]

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Jun 23 '24 02:06 github-actions[bot]