Error when creating RDS MAZ cluster with custom parameter group #24721
Labels
bug
Addresses a defect in current functionality.
service/rds
Issues and PRs that pertain to the rds service.
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform core version: 1.1.8
Terraform provider version: ~>4.10
Affected Resource(s)
RDS MAZ cluster (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html#multi-az-db-clusters-concepts-overview)
Terraform Configuration Files
main.tf snippet:
Debug Output
Error: Error waiting for RDS Cluster state to be "available": unexpected state 'rebooting', wanted target 'available'. last error: %!s()
with aws_rds_cluster.RDS_MAZ_cluster-mysql,
on main.tf line 153, in resource "aws_rds_cluster" "RDS_MAZ_cluster-mysql":
153: resource "aws_rds_cluster" "RDS_MAZ_cluster-mysql" {
Panic Output
N/A
Expected Behavior
Terraform should recognise the
rebooting
state as an expected oneActual Behavior
Terraform apply breaks with the unexpected state.
Additional feedback
The reason why this happens is because when the RDS cluster's Parameter Group (PG) is set to a custom one the cluster needs to reboot for the change to be applied (static change). In this case (creating the RDS MAZ cluster with a custom PG) the cluster gets created and as soon as it becomes available it is rebooting, providing a different state back to terraform. Some might classify this as a race-condition. An easy fix would be to add additional logic to handle the rebooting state (additional timeout for waiting the reboot to be completed) and wait for the cluster to be set back to the
available
one, or add therebooting
state to the list of expected states.Steps to Reproduce
terraform apply
Important Factoids
N/A
References
Similar issues:
#2781 (hashicorp/terraform#4490) -> same resource, different target state
The text was updated successfully, but these errors were encountered: