Terraform-provider-aws: aws_db_instance DBName must begin with a letter and contain only alphanumeric characters.

Created on 12 Jul 2017  ·  2Comments  ·  Source: hashicorp/terraform-provider-aws

Hi,

Terraform Version

Terraform v0.9.11

Affected Resource(s)

  • aws_db_instance

Terraform Configuration Files

data "aws_availability_zones" "available" {}

resource "aws_vpc" "main" {
  cidr_block = "10.10.0.0/16"
}

resource "aws_subnet" "main" {
  count             = "2"
  cidr_block        = "${cidrsubnet(aws_vpc.main.cidr_block, 8, count.index)}"
  availability_zone = "${data.aws_availability_zones.available.names[count.index]}"
  vpc_id            = "${aws_vpc.main.id}"
}

resource "aws_db_subnet_group" "main" {
  name       = "tf-db-main-${terraform.env}"
  subnet_ids = ["${aws_subnet.main.*.id}"]
}

resource "aws_db_instance" "main" {
  allocated_storage    = 10
  storage_type         = "gp2"
  engine               = "postgres"
  engine_version       = "9.6.2"
  instance_class       = "${terraform.env == "production" ? "db.t2.medium" : "db.t2.small"}"
  name                 = "mydatabase-${terraform.env}"
  username             = "mydatabase_user"
  password             = "mydatabase_user"
  db_subnet_group_name = "${aws_db_subnet_group.main.name}"
}

Expected Behavior

I should have the ability to create an aws db instance with a name containing non alphanumeric characters such as - or _.
I tried manually through aws console and it went well.

Actual Behavior

* aws_db_instance.main: 1 error(s) occurred:

* aws_db_instance.main: Error creating DB Instance: InvalidParameterValue: DBName must begin with a letter and contain only alphanumeric characters.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan
  2. terraform apply

Thanks !

Keep going ! You are doing a great job 😃 !

bug servicrds

Most helpful comment

I stumbled on this too. But turned out that what I was looking for was the identifier argument.
identifier - The name of the RDS instance

All 2 comments

I stumbled on this too. But turned out that what I was looking for was the identifier argument.
identifier - The name of the RDS instance

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

Was this page helpful?
0 / 5 - 0 ratings