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.83k stars 9.17k forks source link

[Bug]: r/aws_redshiftserverless_namespace: unable to switch to managed admin password #39250

Open marcinbelczewski opened 1 month ago

marcinbelczewski commented 1 month ago

Terraform Core Version

1.9.5

AWS Provider Version

5.66.0

Affected Resource(s)

Expected Behavior

Namespace can be updated to switch from explicit admin user password provided in the configuration, to managing the password via Secrets Manager. Such a change is supported by the API

Actual Behavior

Error when applying configuration switching from user provider admin password to managed one:

aws_redshiftserverless_namespace.test: Modifying... [id=test]
╷
│ Error: updating Redshift Serverless Namespace (test): operation error Redshift Serverless: UpdateNamespace, https response error StatusCode: 400, RequestID: 13774622-d1e9-41ca-bcd0-17cb86931b1b, ValidationException: 1 validation error detected: Value at 'adminUserPassword' failed to satisfy constraint: Member must have length greater than or equal to 8
│
│   with aws_redshiftserverless_namespace.test,
│   on main.tf line 19, in resource "aws_redshiftserverless_namespace" "test":
│   19: resource "aws_redshiftserverless_namespace" "test" {
│
╵

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_redshiftserverless_namespace" "test" {
  namespace_name = "test"
  admin_username = "test"
  admin_user_password = "Password1234!"
}

Steps to Reproduce

  1. First apply following configuration:
resource "aws_redshiftserverless_namespace" "test" {
  namespace_name = "test"
  admin_username = "test"
  admin_user_password = "Password1234!"
}
  1. Change the configuration to switch to manged admin password and see apply resulting in error:
resource "aws_redshiftserverless_namespace" "test" {
  namespace_name = "test"
  manage_admin_password = true
  admin_username = "test"
}

Another variant to reproduce the same problem:

  1. First apply following configuration:
resource "aws_redshiftserverless_namespace" "test" {
  namespace_name = "test"
}
  1. Change the configuration to switch to manged admin password and see apply resulting in error:
resource "aws_redshiftserverless_namespace" "test" {
  namespace_name = "test"
  manage_admin_password = true
  admin_username = "test"
}

Debug Output

No response

Panic Output

No response

Important Factoids

Provider does not recognize a switch from unmanaged to managed password and still insists on validating admin password from the configuration (there is non on the update)

References

No response

Would you like to implement a fix?

Yes

github-actions[bot] commented 1 month ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue