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.74k forks source link

Create OAuth 2.0 Client ID (non-IAP) resource #16452

Closed katieclaiborne closed 1 year ago

katieclaiborne commented 1 year ago

Community Note

Description

I'd like to be able to configure a non-IAP OAuth 2.0 Client ID as a resource.

If it's helpful, our specific use case is described on this documentation page.

We tried using the google_iap_client resource to import a manually-created client, but encountered the following error:

Error when reading or editing IapClient "projects//brands//identityAwareProxyClients/": googleapi: Error 403: The caller does not have permission

import {
  to = google_iap_brand.data_platform
  id = "projects/<project_number>/brands/<brand_id>"
}
resource "google_iap_brand" "data_platform" {
  support_email     = "<first.last>@cityblock.com"
  application_title = "Data Platform"
}

import {
  to = google_iap_client.dbt_cloud
  id = "projects/<project_number>/brands/<brand_id>/identityAwareProxyClients/<client_id>"
}
resource "google_iap_client" "dbt_cloud" {
  display_name = "dbt Cloud"
  brand        = google_iap_brand.data_platform.name
}

New or Affected Resource(s)

This issue requests a new resource, perhaps named something like:

It relates to the existing google_iap_client resource.

Potential Terraform Configuration

resource "google_oauth_client" "dbt_cloud" {
  application_type              = "Web application"
  name                          = "dbt Cloud"
  authorized_javascript_origins = ["https://cloud.getdbt.com"]
  authorized_redirect_uris      = ["https://cloud.getdbt.com/complete/bigquery"]
}

I would like to be able to access the client ID and secret values as attributes.

References

slevenick commented 1 year ago

I'm not sure if this is currently possible via the REST APIs. Are you aware of a REST API that would allow us to do this? The resource google_iap_brand is backed by the IAP APIs here: https://cloud.google.com/iap/docs/reference/rest/v1/projects.brands so it seems to be only usable for IAP clients.

Without a REST API that enables this use case there isn't much we can do from the Terraform side

katieclaiborne commented 1 year ago

Ah, okay! In that case, we'll upvote the Google issue. Thank you, Sam.

github-actions[bot] commented 11 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.