LP13
LP13

Reputation: 34159

How to create database in existing RDS instance using terraform?

I am using terraform to create RDS instance

resource "aws_db_instance" "postgresql" {
  allocated_storage    = 10
  engine               = "postgres"
  engine_version       = "14.1"
  instance_class       = "db.t3.micro"
  username             = var.db_username
  password             = var.db_password
  publicly_accessible  = false
}

note that db_name attribute is not included so this configuration will not create any database

Is there anyway to create empty database using terraform in existing RDS instance?

Upvotes: 1

Views: 2166

Answers (1)

Marcin
Marcin

Reputation: 238957

Yes, you can use postgresql_database to create a database in your rds belonging to postgresql provider.

Upvotes: 1

Related Questions