cloudposse / terraform-aws-rds

Terraform module to provision AWS RDS instances
https://cloudposse.com/accelerate
Apache License 2.0
153 stars 180 forks source link

db_name field doesn't work for AWS Custom SQL Server databases #143

Closed metronlab-it closed 1 year ago

metronlab-it commented 2 years ago

Describe the Bug

Trying to create an MSSQL RDS gives terraform error in hashistack aws_db_instance code.

Expected Behavior

Module can create Amazon RDS Custom for SQL Server instance

Steps to Reproduce

Try to create module as follows:

module "rds_instance" {
  source                      = "cloudposse/rds/aws"
  version                     = "v0.38.8"
  namespace                   = "${var.namespace}"
  stage                       = var.stage
  dns_zone_id                 = data.terraform_remote_state.server.outputs.aws_zone_id
  host_name                   = "msssql.${var.stage}"
  security_group_ids          = [ "${aws_security_group.mssql.id}" ]
  database_name               = "SQL_Master"
  database_user               = "sql_master"
  database_password           = var.password
  database_port               = 1433
  multi_az                    = true
  storage_type                = "io1"
  iops                        = 1500
  allocated_storage           = 100
  storage_encrypted           = true
  engine                      = "custom-sqlserver-se"
  engine_version              = "15.00.4073.23.v1"
  major_engine_version        = "15"
  instance_class              = "db.m5.large"
  db_parameter_group          = ""
  publicly_accessible         = true
  subnet_ids                  = module.db_dynamic_subnets.availability_zones
  vpc_id                      = module.db_vpc.vpc_id
  auto_minor_version_upgrade  = false
  allow_major_version_upgrade = false
  skip_final_snapshot         = true
  backup_retention_period     = 7
  backup_window               = "02:00-05:00"
  maintenance_window          = "Mon:00:00-Mon:01:30"
}

This gives the following :

│ Error: Unsupported argument
│ 
│   on .terraform/modules/rds_instance/main.tf line 31, in resource "aws_db_instance" "default":
│   31:   db_name               = var.database_name
│ 
│ An argument named "db_name" is not expected here.

whether or not the database_name is specified or not

Additional Context

Looking at the AWS documentation at https://awscli.amazonaws.com/v2/documentation/api/latest/reference/rds/create-db-instance.html, we see:

Options¶
--db-name (string)
...
Amazon RDS Custom for SQL Server

Not applicable. Must be null.
0xCiBeR commented 2 years ago

Is there an ETA with this? Current state breaks the creation of new mysql databases

VersusF commented 1 year ago

Same for postgres in Terraform 1.2.9. Current workaround is to use name instead of db_name