[Bug]: RDS Cluster Members incorrectly surfaced as an argument #40227
Labels
bug
Addresses a defect in current functionality.
needs-triage
Waiting for first response or review from a maintainer.
Terraform Core Version
1.6.6
AWS Provider Version
5.76.0
Affected Resource(s)
aws_rds_cluster
aws_rds_cluster_instance
Expected Behavior
RDS Cluster resource should output the cluster members. It should be invalid to provide cluster members to the resource. The cluster members are already defined as part of the rds cluster instances referencing the cluster. I came across the issue updating a colleagues existing code.
Actual Behavior
The cluster members applies first with the cluster resource and then is updated by the cluster instance resource. It then shows a change everytime a plan or apply runs.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
I can't share as they were discovered at work. I believe this is the issue. the cluster_members according to docs should only be an attribute but the way it has been defined is as an optional input as well. The relationship input is already covered by the cluster instance as defined by cluster identifier argument.
If the option remains there should need to check its not defined in both and would need to be added to documentation.
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster#attribute-reference
https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/rds/cluster.go#L135-L140
"cluster_members": {
Type: schema.TypeSet,
Optional: true,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
Steps to Reproduce
Apply the first time
Then run a plan and it will show as dropping the instance from the cluster.
Fix/workaround:
Remove the cluster_members argument from rds cluster resource
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
Cluster source code issue suspected
https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/rds/cluster.go#L135-L140
Documentation from hashicorp
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: