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

Add support for roles in google_sql_user #10438

Open
enocom opened this issue Oct 28, 2021 · 10 comments · Fixed by GoogleCloudPlatform/magic-modules#6016, hashicorp/terraform-provider-google-beta#4364 or #11834

Comments

@enocom
Copy link

enocom commented Oct 28, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

The SqlServerUserDetails in the SQL Admin API supports specifying serverRoles that will be attached to a user on creation. This is a request to expose that functionality in the google_sql_user resource.

New or Affected Resource(s)

  • google_sql_user

Potential Terraform Configuration

resource "google_sql_user" "users" {
  name     = "me@example.com"
  instance = google_sql_database_instance.master.name
  type     = "CLOUD_IAM_USER"
  roles     = [ "read", "write", "admin" ] # or whatever roles a user might have in a database
}

References

b/314111627

@rileykarson rileykarson added this to the Goals milestone Nov 1, 2021
@arnisoph
Copy link

arnisoph commented Jan 9, 2022

Is there some documentation for serverRoles? Is this even PostgreSQL-specific? I haven't found it in the API docs nor in the gcloud CLI docs.

@enocom
Copy link
Author

enocom commented Jan 10, 2022

@arnisoph The best I've found is under the SqlServerUserDetails, which in spite of the name, does seem to apply to all three engines. Other than that, a person would probably have to experiment with the API to be certain.

@Illidanek
Copy link

Yes please! This seems to be a basic feature that the provider should have.
Without this we are forced to set permissions via magic scripts 🤮

@villesau
Copy link

@enocom @rileykarson what about postgres & mysql?

@enocom
Copy link
Author

enocom commented Jun 23, 2022

It seems I'm wrong: this applies to just SQL Server :-/

@villesau
Copy link

I think there's fairly sizeable amount of postres & mysql databases managed by Google too. When could we expect the same feature to land in those as well? This is a feature that prevents the system from being fully managed by Terraform.

@enocom
Copy link
Author

enocom commented Jun 24, 2022

I agree this would be a useful addition to the Cloud SQL Admin API so we could support all engines.

Since this isn't a Google provider limitation, let's track this work here: https://issuetracker.google.com/issues/195676939. Meanwhile, I'll bring this to the team that handles the Admin API.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2022
@melinath melinath reopened this Sep 28, 2022
@melinath melinath reopened this Sep 28, 2022
@melinath
Copy link
Collaborator

Reopening this ticket. It is not actually resolved for any sql database types, even sql server. Per GoogleCloudPlatform/magic-modules#6165 (review) SqlServerUserDetails is actually read-only.

@github-actions github-actions bot added obsolete-service/sqladmin forward/review In review; remove label to forward labels Aug 17, 2023
@roaks3
Copy link
Collaborator

roaks3 commented Nov 29, 2023

Marking as a feature request because the only mention of this being available through other surfaces is the SqlServerUserDetails, which as mentioned above is read-only. If this can already be done through the API, someone please correct me and we can change this to a coverage gap.

@roaks3 roaks3 added feature-request and removed forward/review In review; remove label to forward labels Nov 29, 2023
@hashicorp hashicorp unlocked this conversation Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment