Open jeremyrx7 opened 2 months ago
cc @kislerdm, any thoughts?
@jeremyrx7 Hello Jeremy, thank you for your question.
Did I get it right, that you'd like to create several databases in a single Neon project using the terraform provider, and you'd like to read the databases connection strings from the terraform state? If it's so, I can suggest concatenating the database connection details in an output variable of the terraform module.
For example, suppose, you have two databases in a single project with a single branch + endpoint. The first database is owned by the default project's role, the second database is owned by a dedicated role. This scenario can be described using the following terraform manifest:
Once the state is provisioned, you can read the connection strings by running the terraform output command.
For example, you can read the connection string of the first database by running the following command:
terraform output conn_first
Similarly, you can read the connection string of the second database by running the following command:
terraform output conn_second
Please note that the terraform state will contain the information which allows to access your databases. It's considered a security risk factor because anyone with access to the terraform state can access and manipulate the data in the databases. If your use case requires, please take all measures necessary to restrict such access. For example, limit access to the terraform backend and consider encrypting it (e.g. consider using new tofu functionality).
Regards, Dmitry
Hi there,
Thank you for opening an issue.
Hi, I am using the latest version of the provider and it works great. I was wondering if there is a way to create multiple db's in the same project and get the connection uri for the individual ones. Rather than creating per project and get the URI from there.
Thoughts?
Cheers, Jeremy