Closed madamkiwi closed 4 years ago
Hey @madamkiwi - thank you for this!
Would it be sufficient to just output the name for the database once created? We are doing this for the control-plane but NOT for PAS.
Let me know 👯
Hello @Polar-Beard! @madamkiwi and I were talking about this. We think that we need name
to be specified because of the behavior of aws_db_instance
. Terraform will not create the database on the DB instance if name
is not specified. (See this documentation.)
When the database does not exist, some of our existing integration tests fail. We could try to find a way to alter the tests, but we're wondering if this is a small enough change that you'd consider pulling it in. Thanks!
@motevets @madamkiwi The documentation you linked seems to indicate that the name
field will create a database on the rds instance at the time of instantiation. So with your change, if my env_name
was set to funny-hippo
, then the rds instance would be instantiated with a database funny-hippo
.
We use the rds instance for terraforming-control-plane
and you can see how we reference the instance to create the databases that we need: https://github.com/pivotal-cf/terraforming-aws/blob/master/terraforming-control-plane/main.tf#L105-L122
resource "null_resource" "create_databases" {
count = "${var.rds_instance_count == 1 ? 1 : 0}"
provisioner "local-exec" {
command = "./db/create_databases.sh"
interpreter = ["bash", "-c"]
environment {
OPSMAN_URL = "${module.ops_manager.public_ip}"
OPSMAN_PRIVATE_KEY = "${module.ops_manager.ssh_private_key}"
RDS_DB_NAME = "${module.rds.rds_db_name}"
RDS_PORT = "${module.rds.rds_port}"
RDS_ADDRESS = "${module.rds.rds_address}"
RDS_USERNAME = "${module.rds.rds_username}"
RDS_PASSWORD = "${module.rds.rds_password}"
}
}
I might be able to help more if I knew more about your specific use case. Are you trying to use an external db for PAS or PKS?
Hey @madamkiwi @motevets! Is this still a PR that the ops manager team would like merged? Do you still have integration tests failing in ci due to the lack of a db on the instance?
Closing due to inactivity. Feel free to re-open if needed.