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

Enable root_password for postgres #214

Closed
BusiPlay opened this issue Apr 30, 2021 · 5 comments
Closed

Enable root_password for postgres #214

BusiPlay opened this issue Apr 30, 2021 · 5 comments
Labels
enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work

Comments

@BusiPlay
Copy link

Per https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#root_password:

(Optional) Initial root password. Required for MS SQL Server, ignored by MySQL and PostgreSQL.

The creation of a CloudSQL Postgres instance automatically creates a postgres user, whose password can be set through API per https://cloud.google.com/sql/docs/postgres/create-manage-users#rest-v1beta4

Right now in order to create a root user via Terraform, a separate cloudsql_database_user resource must be created with root privileges.

Being able to set the postgres user password through the existing root_password attribute seems like a better approach, as it reduces the number of users being given administrative privileges to the database instance.

@morgante morgante added enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work labels May 3, 2021
@imrannayer
Copy link
Collaborator

According to google_sql_database_instance documentation

  • Second-generation instances include a default 'root'@'%' user with no password. This user will be deleted by Terraform on instance creation. You should use google_sql_user to define a custom user with a restricted host and strong password.

This is provider or API limitation and cant be solved by this module.

@BusiPlay
Copy link
Author

This statement applies only to MySQL 2nd Generation instances. Postgres instances do create a postgres user, this is not deleted by Terraform currently. This request was entered to allow the root_password attribute to update this default postgres user as it does for SQL Server.

@imrannayer
Copy link
Collaborator

It still applies to provider not this module. Right now provider uses root_password paraeter for MsSQL instance only and ignores for MySQL and Postgres. You may wana create issue for on provider's site.
Once provider has the capability it can be added to module.

@BusiPlay
Copy link
Author

right, my error - I will direct this to the provider site. Thanks!

@the-veloper
Copy link
Contributor

the-veloper commented Oct 5, 2023

I think the google_sql_database_instance resource from the provider can now accept root_password according to the official google docs:
https://cloud.google.com/sql/docs/postgres/samples/cloud-sql-postgres-instance-pvp

This PR should allow it: #521

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work
Projects
None yet
Development

No branches or pull requests

5 participants