terraform-aws-redshift icon indicating copy to clipboard operation
terraform-aws-redshift copied to clipboard

Invalid value for master_password (cannot contain [/@"' ])

Open leondkr opened this issue 3 years ago β€’ 0 comments

Description

When creating a new Redshift cluster, I am facing the following error when using the attribute create_random_password = true

β”‚ Error: invalid value for master_password (cannot contain [/@"' ])
β”‚ 
β”‚   with module.redshift_dwh.aws_redshift_cluster.this[0],
β”‚   on .terraform/modules/redshift_dwh/main.tf line 62, in resource "aws_redshift_cluster" "this":
β”‚   62:   master_password                  = var.snapshot_identifier != null ? null : local.master_password
β”‚ 
β•΅

Versions

  • Module version [Required]: 4.0.2

  • Terraform version: v1.2.6

  • Provider version(s): registry.terraform.io/hashicorp/aws v4.33.0

Reproduction Code [Required]

module "redshift" {
  source  = "terraform-aws-modules/redshift/aws"
  version = "4.0.2"

  node_type = "dc2.large"

  master_username        = "redshift"
  create_random_password = true

Expected behavior

The attribute create_random_password = true helps creating the password automatically.

Actual behavior

The randomized password has special characters that Redshift does not allow for creation.

Additional context

For workaround, I have done as follows

  • added a custom random_password resource to remove special characters.
  • set create_random_password = false
  • manually set master_password with reference to my custom random_password resource

leondkr avatar Oct 03 '22 10:10 leondkr