terraform-aws-rds-cluster icon indicating copy to clipboard operation
terraform-aws-rds-cluster copied to clipboard

Creating Postgres Multi A-Z RDS cluster running into error InvalidParameterValue: CreateDBInstance

Open matharoo opened this issue 3 years ago • 0 comments

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

When trying to create a Multi A-Z postgres cluster, it runs into the following error:

Error: error creating RDS Cluster (eg-test-rds-cluster) Instance: InvalidParameterValue: CreateDBInstance can't be used to create a DB instance in a Multi-AZ DB cluster. Use CreateDBCluster instead.
│ 	status code: 400, request id: xxx-xxxx-xxxxx-xxxxx
│
│   with module.rds_cluster.aws_rds_cluster_instance.default[0],
│   on ../../main.tf line 240, in resource "aws_rds_cluster_instance" "default":

The resource aws_rds_cluster_instance is specifically used for Aurora engine types like aurora, aurora-mysql, aurora-postgresql Check here.

Expected Behavior

When trying to setup other non-aurora engine types, the resource aws_rds_cluster_instance creation should be skipped.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create non-aurora multi a-z rds-cluster with following vars:
availability_zones = ["us-east-2a", "us-east-2b", "us-east-2c"]
engine = "postgres"
engine_mode = "provisioned"
engine_version = "13.4"
db_cluster_instance_class = "db.m5d.large"
allocated_storage = 100
storage_type = "io1"
iops = 1000
  1. Do a terraform apply
  2. See error

Additional Context

Add any other context about the problem here.

matharoo avatar Jul 11 '22 22:07 matharoo