hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.33k stars 1.73k forks source link

Add google_alloydb_user resouce w/ support for creating IAM users #14272

Closed franklinlindemberg closed 1 year ago

franklinlindemberg commented 1 year ago

Community Note

Description

Add a new resource that allows creating alloydb users using terraform. We currently have a similar feature for cloudsql resource .

This new provider would make possible creation of IAM users, allowing instances to be created without passing any password.

New or Affected Resource(s)

Potential Terraform Configuration

resource "google_alloydb_user" "users" {
  name     = "me@example.com"
  instance = google_sql_database_instance.main.name
  type     = "CLOUD_IAM_USER"
}

References

rileykarson commented 1 year ago

User management appears to be done in PSQL directly per https://cloud.google.com/alloydb/docs/database-users/about#manage-users. We'd need this to be exposed in the API to interact with it in Terraform. It shouldn't break through from the control plane to the data plane of the resource.

We'd expect users to use a database management tool instead of an infrastructure management tool to interact with the database, or at least a dedicated provider such as the community one here: https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs

trodge commented 1 year ago

b/280326208

mwarkentin commented 1 year ago

https://cloud.google.com/alloydb/docs/reference/rest/v1/projects.locations.clusters.users

mohoromitch commented 1 year ago

Leaving a note here, but anyone looking for a workaround can look at this in the meantime:

https://registry.terraform.io/modules/terraform-google-modules/gcloud/google/latest

It will let you use the gcloud command to create the users by directly using the API that @mwarkentin linked.

DanielRieske commented 1 year ago

I'd like to pick this issue up, did some work on it and will add the PR shortly.

GauravJain21 commented 1 year ago

PR: https://github.com/GoogleCloudPlatform/magic-modules/pull/8920

franklinlindemberg commented 1 year ago

Thanks folks, really appreciate it!

Does anyone know when this will be available on terraform registry?

GauravJain21 commented 1 year ago

Hey Franklin, It should be available by 17th or max 24th of Oct.

franklinlindemberg commented 1 year ago

@GauravJain21 Thank you!

Im closing this issue given it was already resolved

github-actions[bot] commented 12 months ago

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.