How to set database cluster arguments (like password) with terraform?

147 views Asked by At

I deploy a digitalocean_database_cluster with Terraform. It's working and I can connect to it with the username and password that Terraform generates in .tfstate

I want to set a concrete username, password, and port. I'm reading the DO documentation, but I don't see these arguments, so:

Is my strategy wrong (can't force a concrete value) or there's another way/resource to this?

PS: I'm new to Terraform

1

There are 1 answers

2
lxop On

You can use the digitalocean_database_user resource to provision a user with a concrete username, though you will still get an automatic password. It doesn't look like Digital Ocean lets you set a user password through their management API (which TF uses), so you'll need to change it using regular DB interaction.

Why do you want to set a custom port on the cluster?