Skip to content
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

[Bug]: aws_rds_cluster times out when creating servelessV2 cluster from snapshot #37154

Closed
jjpzt87 opened this issue Apr 29, 2024 · 5 comments
Closed
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.

Comments

@jjpzt87
Copy link

jjpzt87 commented Apr 29, 2024

Terraform Core Version

1.5.6

AWS Provider Version

4.45.0

Affected Resource(s)

aws_rds_cluster

Expected Behavior

i am setting timeouts values greater that 120m (default value), the creation should timeout when the new custom value is reached.

Actual Behavior

i am setting timeouts as:

timeouts {
    create = try(var.cluster_timeouts.create, "360m")
    update = try(var.cluster_timeouts.update, "360m")
    delete = try(var.cluster_timeouts.delete, "120m")
}

The creation is timing out after 2h (120m default value)

Relevant Error/Panic Output Snippet

module.db-databases-data-analytics-nprd-serverless.aws_rds_cluster.this: Still creating... [1h58m10s elapsed]

------------ System Message ------------

WARNING: This apply has timed out and will now terminate!

A 2h0m0s maximum run time for this operation is enforced. Please review the
logs above to determine why the apply has exceeded its timeout.

----------------------------------------

Interrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...

Stopping operation...
╷
│ Warning: Argument is deprecated
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on provider.tf line 14, in provider "aws":
│   14:   shared_credentials_file = "./credentials"
│ 
│ Use shared_credentials_files instead.
╵
╷
│ Warning: Attribute Deprecated
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on provider.tf line 14, in provider "aws":
│   14:   shared_credentials_file = "./credentials"
│ 
│ Use shared_credentials_files instead.
╵
╷
│ Error: execution halted
│ 
│ 
╵
╷
│ Error: execution halted
│ 
│ 
╵
╷
│ Error: waiting for RDS Cluster (db-data-analytics-nprd-serverless) create: context canceled
│ 
│   with module.db-databases-data-analytics-nprd-serverless.aws_rds_cluster.this,
│   on .terraform/modules/db-databases-data-analytics-nprd-serverless/cluster.tf line 96, in resource "aws_rds_cluster" "this":
│   96: resource "aws_rds_cluster" "this" {
│ 
╵
Operation failed: failed running terraform apply (exit 1)

Terraform Configuration Files

# Cluster
resource "aws_rds_cluster" "this" {
  cluster_identifier              = var.cluster_name
  **snapshot_identifier             = local.cluster_snapshot_identifier**
  engine                          = var.engine
  engine_mode                     = var.engine_mode
  engine_version                  = var.engine_version
  database_name                   = var.database_name
  port                            = var.database_port
  master_username                 = var.snapshot_identifier == "" ? var.cluster_master_username : null
  master_password                 = var.snapshot_identifier == "" ? random_password.cluster_admin_password.result : null
  storage_type                    = var.storage_type
  iops                            = var.iops
  allocated_storage               = var.allocated_storage
  storage_encrypted               = var.storage_encrypted
  kms_key_id                      = var.storage_encrypted && var.custom_storage_key ? aws_kms_key.storage_kms_key[0].arn : var.storage_encrypted ? data.aws_kms_key.aws_managed_for_rds.arn : null
  vpc_security_group_ids          = [aws_security_group.database_internal.id, aws_security_group.database_icmp.id]
  db_subnet_group_name            = var.create_db_subnet_group ? aws_db_subnet_group.this[0].id : var.db_subnet_group_name
  db_cluster_parameter_group_name = var.create_db_cluster_parameter_group ? aws_rds_cluster_parameter_group.this[0].id : var.db_cluster_parameter_group_name
  availability_zones              = local.azs
  apply_immediately               = var.apply_immediately
  copy_tags_to_snapshot           = var.copy_tags_to_snapshot
  skip_final_snapshot             = var.skip_final_snapshot
  deletion_protection             = var.deletion_protection
  preferred_backup_window         = try(var.preferred_backup_window, null)
  backup_retention_period         = var.backup_retention_period
  preferred_maintenance_window    = try(var.preferred_maintenance_window, null)
  dynamic "serverlessv2_scaling_configuration" {
    for_each = length(var.serverlessv2_scaling_configuration) > 0 && var.engine_mode == "provisioned" ? [var.serverlessv2_scaling_configuration] : []
    content {
      max_capacity = serverlessv2_scaling_configuration.value.max_capacity
      min_capacity = serverlessv2_scaling_configuration.value.min_capacity
    }
  }
  timeouts {
    create = try(var.cluster_timeouts.create, "360m")
    update = try(var.cluster_timeouts.update, "360m")
    delete = try(var.cluster_timeouts.delete, "120m")
  }
  enabled_cloudwatch_logs_exports = var.enabled_cloudwatch_logs_exports
  tags = merge({ "Name" = var.cluster_name }, var.default_tags)
}

Steps to Reproduce

base RDS:

  • postgres rds instance
  • version 12.17
  • storage 1500GB

Migration:

  • stop instance with snapshot: dataanalytics-nprd-serveless-migration
  • restore snapshot in new instance: dataanalytics-nprd-psql13
  • upgrade psql version to 13.13
  • stop instance [dataanalytics-nprd-psql13] (with snapshot): dataanalytics-nprd-serveless-migration-psqlv13
  • apply TF module with snapshot_identifier = dataanalytics-nprd-serveless-migration-psqlv13
resource "aws_rds_cluster" "this" {
  cluster_identifier              = var.cluster_name
  snapshot_identifier          = "dataanalytics-nprd-serveless-migration-psqlv13"

Debug Output

module.db-databases-data-analytics-nprd-serverless.aws_rds_cluster.this: Still creating... [1h58m10s elapsed]

------------ System Message ------------

WARNING: This apply has timed out and will now terminate!

A 2h0m0s maximum run time for this operation is enforced. Please review the
logs above to determine why the apply has exceeded its timeout.

----------------------------------------

Interrupt received.
Please wait for Terraform to exit or data loss may occur.
Gracefully shutting down...

Stopping operation...
╷
│ Warning: Argument is deprecated
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on provider.tf line 14, in provider "aws":
│   14:   shared_credentials_file = "./credentials"
│ 
│ Use shared_credentials_files instead.
╵
╷
│ Warning: Attribute Deprecated
│ 
│   with provider["registry.terraform.io/hashicorp/aws"],
│   on provider.tf line 14, in provider "aws":
│   14:   shared_credentials_file = "./credentials"
│ 
│ Use shared_credentials_files instead.
╵
╷
│ Error: execution halted
│ 
│ 
╵
╷
│ Error: execution halted
│ 
│ 
╵
╷
│ Error: waiting for RDS Cluster (db-data-analytics-nprd-serverless) create: context canceled
│ 
│   with module.db-databases-data-analytics-nprd-serverless.aws_rds_cluster.this,
│   on .terraform/modules/db-databases-data-analytics-nprd-serverless/cluster.tf line 96, in resource "aws_rds_cluster" "this":
│   96: resource "aws_rds_cluster" "this" {
│ 
╵
Operation failed: failed running terraform apply (exit 1)

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@jjpzt87 jjpzt87 added the bug Addresses a defect in current functionality. label Apr 29, 2024
@github-actions github-actions bot added the service/rds Issues and PRs that pertain to the rds service. label Apr 29, 2024
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 29, 2024
@justinretzolk
Copy link
Member

Hey @jjpzt87 👋 Thank you for taking the time to raise this! Are you using Terraform Enterprise by chance? This looks a lot like Terraform Enterprise's default runner timeout.

@justinretzolk justinretzolk added the waiting-response Maintainers are waiting on response from community or contributor. label Apr 30, 2024
@jjpzt87
Copy link
Author

jjpzt87 commented May 1, 2024

hey @justinretzolk! yes i am using TerraformCloud (TFC) for my backend, but the apply timeout is supposed to be 24h on TFC. I will try creating it locally and see if the timeout is from TFC or the resource. Thanks!

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label May 1, 2024
@jjpzt87
Copy link
Author

jjpzt87 commented May 2, 2024

hey @justinretzolk! you were right, the timeout was coming from TFC. running it locally worked and then i just imported. Thanks a lot

@jjpzt87 jjpzt87 closed this as completed May 2, 2024
Copy link

github-actions bot commented May 2, 2024

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@terraform-aws-provider terraform-aws-provider bot removed the needs-triage Waiting for first response or review from a maintainer. label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

No branches or pull requests

2 participants