Tony
Tony

Reputation: 473

Error creating DB Instance: InvalidParameterCombination: Invalid storage size for engine name aurora-mysql and storage type aurora: 1

Trying to create a AWS RDS aurora-mysql. All the examples are based on mySQl, so I followed that

resource "aws_db_instance" "credential-db" {
  identifier           = "credentialdb"
  storage_type         = "aurora"
  allocated_storage    = 1
  engine               = "aurora-mysql"
  engine_version       = "5.7.12"
  instance_class       = "db.t2.small"
  port                 = "3306"
  name                 = "credentialdb"
  username             = "${var.username}"
  password             = "${var.password}"
  parameter_group_name = "default.aurora-mysql5.7"
  availability_zone    = "us-west-2"
  skip_final_snapshot  = true
}

But when I run it I get the following error


 Error: Error creating DB Instance: InvalidParameterCombination: Invalid storage size for engine name aurora-mysql and storage type aurora: 1
│       status code: 400, request id: 85d20c39-36e8-4fd1-a04b-971a4d226f3d
│
│   with aws_db_instance.credential-db,
│   on rds.tf line 1, in resource "aws_db_instance" "credential-db":
│    1: resource "aws_db_instance" "credential-db" {
│

I cant find docs that say what the storage size should be for aurora-mysql

Upvotes: 1

Views: 9503

Answers (4)

PCA
PCA

Reputation: 1

You can specify

{ storage_type = null }

as null and it will default the terrform provider to aurora

Upvotes: 0

raman singh
raman singh

Reputation: 21

I faced this same problem while creating aurora (mysql compatible) database. Error is like

Error: creating RDS DB Instance (example-aurora-cluste): InvalidParameterCombination: Invalid storage size for engine name aurora-mysql and storage type aurora: 21
status code: 400, request id: 51a8e8e2-b1ed-4e34-9cfb-0f518e5e3979
with aws_db_instance.example,
on main.tf line 141, in resource "aws_db_instance" "example":
141: resource "aws_db_instance" "example" {

I was using this resource -> resource "aws_db_instance" "example"

To overcome this problem the resource should be used is -> "aws_rds_cluster_instance" "example" You can checkout code below.

 resource "aws_rds_cluster_instance" "example" {
    identifier             = "example-aurora-cluste"
    cluster_identifier     = aws_rds_cluster.example.cluster_identifier
    engine                 = "aurora-mysql"
    engine_version         = "8.0.mysql_aurora.3.02.2"
    instance_class         = "db.r5.large"
    db_subnet_group_name   = aws_db_subnet_group.example.name
    }


resource "aws_rds_cluster" "example" {
  cluster_identifier      = "example-aurora-cluster"
  engine                  = "aurora-mysql"
  engine_version          = "8.0.mysql_aurora.3.02.2"
  availability_zones      = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]  
  database_name           = "exampledb"
  master_username         = "admin"
  master_password         = "admin12345"
  db_subnet_group_name    = aws_db_subnet_group.example.name
  vpc_security_group_ids = [module.networking.rds_sg_id]
  skip_final_snapshot     = true  
}

Upvotes: 2

Meetu Gupta
Meetu Gupta

Reputation: 874

Upgrading aws provider version to 4.45 helped in my case. They have addressed this issue with this version.

aws = {
  source  = "hashicorp/aws"
  version = "~> 4.45"

Upvotes: 0

exaucae
exaucae

Reputation: 2675

As per aws_db_instance terraform docs, aurora doesn't seem to be an allowed value for storage_type. It's rather gp2, io1 or standard.

Depending on the storage_type you'll choose, AWS docs, give minimum values of allocated_storage. ( see section 1 about AllocatedStorage)

Upvotes: -1

Related Questions