Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateDBInstance can't be used to create a DB instance in a Multi-AZ DB cluster. Use CreateDBCluster instead. #206

Open
shivakumarlb opened this issue Apr 1, 2024 · 1 comment
Labels
bug 🐛 An issue with the system

Comments

@shivakumarlb
Copy link

shivakumarlb commented Apr 1, 2024

Describe the Bug

i am using minimal config to provision the db cluster, the cluster on console works properly but the terraform scripts fails in the end with the error message

│ Error: creating RDS Cluster (prod-mysql) Instance (prod-mysql-1): 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: 7ec7b266-62c3-46b0-89f3-8ad0782e73ef │ │ with module.rds_mysql_idp.aws_rds_cluster_instance.default[0], │ on .terraform/modules/rds_mysql/main.tf line 251, in resource "aws_rds_cluster_instance" "default": │ 251: resource "aws_rds_cluster_instance" "default" {

Expected Behavior

script should not fail as cluster is up and running

Steps to Reproduce

` source = "cloudposse/rds-cluster/aws"
version = "1.9.0"

name = "name"
cluster_family = "mysql8.0"
engine = "mysql"
engine_mode = "provisioned"
engine_version = "8.0"
cluster_size = 1
namespace = var.namespace
stage = var.environment
admin_user = var.db_admin_username
admin_password = var.db_admin_password
db_name = "db_name"
db_port = 3306
db_cluster_instance_class = var.db_instance_type
vpc_id = var.vpc_id
security_groups = []
subnets = var.subnets
zone_id = var.zone_id
storage_type = "io1"
iops = 1000
allocated_storage = 100`

the tf script used

│ Error: creating RDS Cluster (bloom-prod-idpmysql) Instance (bloom-prod-idpmysql-1): 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: 7ec7b266-62c3-46b0-89f3-8ad0782e73ef │ │ with module.rds_mysql_idp.aws_rds_cluster_instance.default[0], │ on .terraform/modules/rds_mysql_idp/main.tf line 251, in resource "aws_rds_cluster_instance" "default": │ 251: resource "aws_rds_cluster_instance" "default" {

Screenshots

No response

Environment

module version : 1.9.0
Terraform v1.5.0
on darwin_amd64

  • provider registry.terraform.io/hashicorp/aws v4.67.0
  • provider registry.terraform.io/hashicorp/local v2.5.1
  • provider registry.terraform.io/hashicorp/null v3.2.2
  • provider registry.terraform.io/hashicorp/random v3.6.0
  • provider registry.terraform.io/hashicorp/tls v4.0.5

Additional Context

No response

@shivakumarlb shivakumarlb added the bug 🐛 An issue with the system label Apr 1, 2024
@LucasEsposito
Copy link

I found this by chance. I had a similar issue with RDS when migrating a DB from Aurora to non-Aurora. Same error as you, and also had the cluster running but not the instance.

This part of the docs solved the issue for me:

To manage cluster instances that inherit configuration from the cluster (when not running the cluster in serverless engine mode), see the aws_rds_cluster_instance resource. To manage non-Aurora DB instances (e.g., MySQL, PostgreSQL, SQL Server, etc.), see the aws_db_instance resource

Basically, for Aurora, use aws_rds_cluster and aws_rds_cluster_instance. For non-Aurora, use aws_rds_cluster too, but use aws_db_instance instead of aws_rds_cluster_instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

2 participants