From c09abed6dea5aebc3e873d2b30fc9128d4b30c9d Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Wed, 20 Mar 2024 21:59:10 +0000 Subject: [PATCH] Add integrations product. Create Client resource. (#10186) Co-authored-by: Cameron Thornton [upstream:d874e11de524dddb932b70f4ef1bc7905fb41846] Signed-off-by: Modular Magician --- .changelog/10186.txt | 3 + google-beta/fwmodels/provider_model.go | 1 + google-beta/fwprovider/framework_provider.go | 6 + google-beta/fwtransport/framework_config.go | 10 + google-beta/provider/provider.go | 6 + .../provider/provider_mmv1_resources.go | 6 +- .../resource_integrations_client.go | 287 ++++++++++++++++++ ...urce_integrations_client_generated_test.go | 122 ++++++++ google-beta/sweeper/gcp_sweeper_test.go | 1 + google-beta/transport/config.go | 9 + .../docs/r/integrations_client.html.markdown | 200 ++++++++++++ 11 files changed, 649 insertions(+), 2 deletions(-) create mode 100644 .changelog/10186.txt create mode 100644 google-beta/services/integrations/resource_integrations_client.go create mode 100644 google-beta/services/integrations/resource_integrations_client_generated_test.go create mode 100644 website/docs/r/integrations_client.html.markdown diff --git a/.changelog/10186.txt b/.changelog/10186.txt new file mode 100644 index 0000000000..1cb6677e0e --- /dev/null +++ b/.changelog/10186.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +google_integrations_client +``` \ No newline at end of file diff --git a/google-beta/fwmodels/provider_model.go b/google-beta/fwmodels/provider_model.go index 5e4683d8ed..ce20756e0f 100644 --- a/google-beta/fwmodels/provider_model.go +++ b/google-beta/fwmodels/provider_model.go @@ -109,6 +109,7 @@ type ProviderModel struct { IapCustomEndpoint types.String `tfsdk:"iap_custom_endpoint"` IdentityPlatformCustomEndpoint types.String `tfsdk:"identity_platform_custom_endpoint"` IntegrationConnectorsCustomEndpoint types.String `tfsdk:"integration_connectors_custom_endpoint"` + IntegrationsCustomEndpoint types.String `tfsdk:"integrations_custom_endpoint"` KMSCustomEndpoint types.String `tfsdk:"kms_custom_endpoint"` LoggingCustomEndpoint types.String `tfsdk:"logging_custom_endpoint"` LookerCustomEndpoint types.String `tfsdk:"looker_custom_endpoint"` diff --git a/google-beta/fwprovider/framework_provider.go b/google-beta/fwprovider/framework_provider.go index fe6251d749..5e35250e50 100644 --- a/google-beta/fwprovider/framework_provider.go +++ b/google-beta/fwprovider/framework_provider.go @@ -629,6 +629,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest, transport_tpg.CustomEndpointValidator(), }, }, + "integrations_custom_endpoint": &schema.StringAttribute{ + Optional: true, + Validators: []validator.String{ + transport_tpg.CustomEndpointValidator(), + }, + }, "kms_custom_endpoint": &schema.StringAttribute{ Optional: true, Validators: []validator.String{ diff --git a/google-beta/fwtransport/framework_config.go b/google-beta/fwtransport/framework_config.go index 71acef0bb3..2854483bce 100644 --- a/google-beta/fwtransport/framework_config.go +++ b/google-beta/fwtransport/framework_config.go @@ -132,6 +132,7 @@ type FrameworkProviderConfig struct { IapBasePath string IdentityPlatformBasePath string IntegrationConnectorsBasePath string + IntegrationsBasePath string KMSBasePath string LoggingBasePath string LookerBasePath string @@ -298,6 +299,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context, p.IapBasePath = data.IapCustomEndpoint.ValueString() p.IdentityPlatformBasePath = data.IdentityPlatformCustomEndpoint.ValueString() p.IntegrationConnectorsBasePath = data.IntegrationConnectorsCustomEndpoint.ValueString() + p.IntegrationsBasePath = data.IntegrationsCustomEndpoint.ValueString() p.KMSBasePath = data.KMSCustomEndpoint.ValueString() p.LoggingBasePath = data.LoggingCustomEndpoint.ValueString() p.LookerBasePath = data.LookerCustomEndpoint.ValueString() @@ -1119,6 +1121,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo data.IntegrationConnectorsCustomEndpoint = types.StringValue(customEndpoint.(string)) } } + if data.IntegrationsCustomEndpoint.IsNull() { + customEndpoint := transport_tpg.MultiEnvDefault([]string{ + "GOOGLE_INTEGRATIONS_CUSTOM_ENDPOINT", + }, transport_tpg.DefaultBasePaths[transport_tpg.IntegrationsBasePathKey]) + if customEndpoint != nil { + data.IntegrationsCustomEndpoint = types.StringValue(customEndpoint.(string)) + } + } if data.KMSCustomEndpoint.IsNull() { customEndpoint := transport_tpg.MultiEnvDefault([]string{ "GOOGLE_KMS_CUSTOM_ENDPOINT", diff --git a/google-beta/provider/provider.go b/google-beta/provider/provider.go index 2d7e804443..78672828a3 100644 --- a/google-beta/provider/provider.go +++ b/google-beta/provider/provider.go @@ -550,6 +550,11 @@ func Provider() *schema.Provider { Optional: true, ValidateFunc: transport_tpg.ValidateCustomEndpoint, }, + "integrations_custom_endpoint": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: transport_tpg.ValidateCustomEndpoint, + }, "kms_custom_endpoint": { Type: schema.TypeString, Optional: true, @@ -1076,6 +1081,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr config.IapBasePath = d.Get("iap_custom_endpoint").(string) config.IdentityPlatformBasePath = d.Get("identity_platform_custom_endpoint").(string) config.IntegrationConnectorsBasePath = d.Get("integration_connectors_custom_endpoint").(string) + config.IntegrationsBasePath = d.Get("integrations_custom_endpoint").(string) config.KMSBasePath = d.Get("kms_custom_endpoint").(string) config.LoggingBasePath = d.Get("logging_custom_endpoint").(string) config.LookerBasePath = d.Get("looker_custom_endpoint").(string) diff --git a/google-beta/provider/provider_mmv1_resources.go b/google-beta/provider/provider_mmv1_resources.go index ef409a8bf0..53ae075f8f 100644 --- a/google-beta/provider/provider_mmv1_resources.go +++ b/google-beta/provider/provider_mmv1_resources.go @@ -86,6 +86,7 @@ import ( "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/iap" "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/identityplatform" "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/integrationconnectors" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/integrations" "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/kms" "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/logging" "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/looker" @@ -439,9 +440,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{ } // Resources -// Generated resources: 454 +// Generated resources: 455 // Generated IAM resources: 267 -// Total generated resources: 721 +// Total generated resources: 722 var generatedResources = map[string]*schema.Resource{ "google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(), "google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(), @@ -949,6 +950,7 @@ var generatedResources = map[string]*schema.Resource{ "google_identity_platform_tenant_oauth_idp_config": identityplatform.ResourceIdentityPlatformTenantOauthIdpConfig(), "google_integration_connectors_connection": integrationconnectors.ResourceIntegrationConnectorsConnection(), "google_integration_connectors_endpoint_attachment": integrationconnectors.ResourceIntegrationConnectorsEndpointAttachment(), + "google_integrations_client": integrations.ResourceIntegrationsClient(), "google_kms_crypto_key": kms.ResourceKMSCryptoKey(), "google_kms_crypto_key_version": kms.ResourceKMSCryptoKeyVersion(), "google_kms_ekm_connection": kms.ResourceKMSEkmConnection(), diff --git a/google-beta/services/integrations/resource_integrations_client.go b/google-beta/services/integrations/resource_integrations_client.go new file mode 100644 index 0000000000..c9d4b903b4 --- /dev/null +++ b/google-beta/services/integrations/resource_integrations_client.go @@ -0,0 +1,287 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** Type: MMv1 *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package integrations + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" +) + +func ResourceIntegrationsClient() *schema.Resource { + return &schema.Resource{ + Create: resourceIntegrationsClientCreate, + Read: resourceIntegrationsClientRead, + Delete: resourceIntegrationsClientDelete, + + Importer: &schema.ResourceImporter{ + State: resourceIntegrationsClientImport, + }, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(20 * time.Minute), + Delete: schema.DefaultTimeout(20 * time.Minute), + }, + + CustomizeDiff: customdiff.All( + tpgresource.DefaultProviderProject, + ), + + Schema: map[string]*schema.Schema{ + "location": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `Location in which client needs to be provisioned.`, + }, + "cloud_kms_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: `Cloud KMS config for AuthModule to encrypt/decrypt credentials.`, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "key": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `A Cloud KMS key is a named object containing one or more key versions, along +with metadata for the key. A key exists on exactly one key ring tied to a +specific location.`, + }, + "kms_location": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `Location name of the key ring, e.g. "us-west1".`, + }, + "kms_ring": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `A key ring organizes keys in a specific Google Cloud location and allows you to +manage access control on groups of keys. A key ring's name does not need to be +unique across a Google Cloud project, but must be unique within a given location.`, + }, + "key_version": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: `Each version of a key contains key material used for encryption or signing. +A key's version is represented by an integer, starting at 1. To decrypt data +or verify a signature, you must use the same key version that was used to +encrypt or sign the data.`, + }, + "kms_project_id": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: `The Google Cloud project id of the project where the kms key stored. If empty, +the kms key is stored at the same project as customer's project and ecrypted +with CMEK, otherwise, the kms key is stored in the tenant project and +encrypted with GMEK.`, + }, + }, + }, + }, + "create_sample_workflows": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Description: `Indicates if sample workflow should be created along with provisioning.`, + }, + "provision_gmek": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Description: `Indicates provision with GMEK or CMEK.`, + }, + "run_as_service_account": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: `User input run-as service account, if empty, will bring up a new default service account.`, + }, + "project": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + UseJSONNumber: true, + } +} + +func resourceIntegrationsClientCreate(d *schema.ResourceData, meta interface{}) error { + config := meta.(*transport_tpg.Config) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + if err != nil { + return err + } + + obj := make(map[string]interface{}) + + lockName, err := tpgresource.ReplaceVars(d, config, "Client/{{location}}") + if err != nil { + return err + } + transport_tpg.MutexStore.Lock(lockName) + defer transport_tpg.MutexStore.Unlock(lockName) + + url, err := tpgresource.ReplaceVars(d, config, "{{IntegrationsBasePath}}projects/{{project}}/locations/{{location}}/clients:provision") + if err != nil { + return err + } + + log.Printf("[DEBUG] Creating new Client: %#v", obj) + billingProject := "" + + project, err := tpgresource.GetProject(d, config) + if err != nil { + return fmt.Errorf("Error fetching project for Client: %s", err) + } + billingProject = project + + // err == nil indicates that the billing_project value was found + if bp, err := tpgresource.GetBillingProject(d, config); err == nil { + billingProject = bp + } + + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "POST", + Project: billingProject, + RawURL: url, + UserAgent: userAgent, + Body: obj, + Timeout: d.Timeout(schema.TimeoutCreate), + }) + if err != nil { + return fmt.Errorf("Error creating Client: %s", err) + } + + // Store the ID now + id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/clients") + if err != nil { + return fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + log.Printf("[DEBUG] Finished creating Client %q: %#v", d.Id(), res) + + return resourceIntegrationsClientRead(d, meta) +} + +func resourceIntegrationsClientRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*transport_tpg.Config) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + if err != nil { + return err + } + + url, err := tpgresource.ReplaceVars(d, config, "{{IntegrationsBasePath}}projects/{{project}}/locations/{{location}}/clients") + if err != nil { + return err + } + + billingProject := "" + + project, err := tpgresource.GetProject(d, config) + if err != nil { + return fmt.Errorf("Error fetching project for Client: %s", err) + } + billingProject = project + + // err == nil indicates that the billing_project value was found + if bp, err := tpgresource.GetBillingProject(d, config); err == nil { + billingProject = bp + } + + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: userAgent, + }) + if err != nil { + return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("IntegrationsClient %q", d.Id())) + } + + res, err = resourceIntegrationsClientDecoder(d, meta, res) + if err != nil { + return err + } + + if res == nil { + // Decoding the object has resulted in it being gone. It may be marked deleted + log.Printf("[DEBUG] Removing IntegrationsClient because it no longer exists.") + d.SetId("") + return nil + } + + if err := d.Set("project", project); err != nil { + return fmt.Errorf("Error reading Client: %s", err) + } + + return nil +} + +func resourceIntegrationsClientDelete(d *schema.ResourceData, meta interface{}) error { + log.Printf("[WARNING] Integrations Client resources"+ + " cannot be deleted from Google Cloud. The resource %s will be removed from Terraform"+ + " state, but will still be present on Google Cloud.", d.Id()) + d.SetId("") + + return nil +} + +func resourceIntegrationsClientImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + config := meta.(*transport_tpg.Config) + if err := tpgresource.ParseImportId([]string{ + "^projects/(?P[^/]+)/locations/(?P[^/]+)/clients$", + "^(?P[^/]+)/(?P[^/]+)$", + "^(?P[^/]+)$", + }, d, config); err != nil { + return nil, err + } + + // Replace import id for the resource id + id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/clients") + if err != nil { + return nil, fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + return []*schema.ResourceData{d}, nil +} + +func resourceIntegrationsClientDecoder(d *schema.ResourceData, meta interface{}, res map[string]interface{}) (map[string]interface{}, error) { + // Since Client resource doesnt have any properties, + // Adding this decoder as placeholder else the linter will + // complain that the returned `res` is never used afterwards. + return res, nil +} diff --git a/google-beta/services/integrations/resource_integrations_client_generated_test.go b/google-beta/services/integrations/resource_integrations_client_generated_test.go new file mode 100644 index 0000000000..c876f36a44 --- /dev/null +++ b/google-beta/services/integrations/resource_integrations_client_generated_test.go @@ -0,0 +1,122 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** Type: MMv1 *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package integrations_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" +) + +func TestAccIntegrationsClient_integrationsClientBasicExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccIntegrationsClient_integrationsClientBasicExample(context), + }, + { + ResourceName: "google_integrations_client.example", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"cloud_kms_config", "create_sample_workflows", "provision_gmek", "run_as_service_account", "location"}, + }, + }, + }) +} + +func testAccIntegrationsClient_integrationsClientBasicExample(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_integrations_client" "example" { + location = "us-central1" +} +`, context) +} + +func TestAccIntegrationsClient_integrationsClientAdvanceExample(t *testing.T) { + acctest.SkipIfVcr(t) + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccIntegrationsClient_integrationsClientAdvanceExample(context), + }, + { + ResourceName: "google_integrations_client.example", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"cloud_kms_config", "create_sample_workflows", "provision_gmek", "run_as_service_account", "location"}, + }, + }, + }) +} + +func testAccIntegrationsClient_integrationsClientAdvanceExample(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_project" "test_project" { +} + +resource "google_kms_key_ring" "keyring" { + name = "tf-test-my-keyring%{random_suffix}" + location = "us-central1" +} + +resource "google_kms_crypto_key" "cryptokey" { + name = "crypto-key-example" + key_ring = google_kms_key_ring.keyring.id + rotation_period = "7776000s" + depends_on = [google_kms_key_ring.keyring] +} + +resource "google_kms_crypto_key_version" "test_key" { + crypto_key = google_kms_crypto_key.cryptokey.id + depends_on = [google_kms_crypto_key.cryptokey] +} + +resource "google_integrations_client" "example" { + location = "us-central1" + create_sample_workflows = true + provision_gmek = true + run_as_service_account = "radndom-service-account" + cloud_kms_config { + kms_location = "us-central1" + kms_ring = google_kms_key_ring.keyring.id + key = google_kms_crypto_key.cryptokey.id + key_version = google_kms_crypto_key_version.test_key.id + kms_project_id = data.google_project.test_project.id + } + depends_on = [google_kms_crypto_key_version.test_key] +} +`, context) +} diff --git a/google-beta/sweeper/gcp_sweeper_test.go b/google-beta/sweeper/gcp_sweeper_test.go index 4eef5f72b1..fcdd811c8d 100644 --- a/google-beta/sweeper/gcp_sweeper_test.go +++ b/google-beta/sweeper/gcp_sweeper_test.go @@ -88,6 +88,7 @@ import ( _ "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/iap" _ "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/identityplatform" _ "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/integrationconnectors" + _ "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/integrations" _ "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/kms" _ "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/logging" _ "github.com/hashicorp/terraform-provider-google-beta/google-beta/services/looker" diff --git a/google-beta/transport/config.go b/google-beta/transport/config.go index 28e32f961c..7f773bccc6 100644 --- a/google-beta/transport/config.go +++ b/google-beta/transport/config.go @@ -269,6 +269,7 @@ type Config struct { IapBasePath string IdentityPlatformBasePath string IntegrationConnectorsBasePath string + IntegrationsBasePath string KMSBasePath string LoggingBasePath string LookerBasePath string @@ -417,6 +418,7 @@ const IAMWorkforcePoolBasePathKey = "IAMWorkforcePool" const IapBasePathKey = "Iap" const IdentityPlatformBasePathKey = "IdentityPlatform" const IntegrationConnectorsBasePathKey = "IntegrationConnectors" +const IntegrationsBasePathKey = "Integrations" const KMSBasePathKey = "KMS" const LoggingBasePathKey = "Logging" const LookerBasePathKey = "Looker" @@ -559,6 +561,7 @@ var DefaultBasePaths = map[string]string{ IapBasePathKey: "https://iap.googleapis.com/v1/", IdentityPlatformBasePathKey: "https://identitytoolkit.googleapis.com/v2/", IntegrationConnectorsBasePathKey: "https://connectors.googleapis.com/v1/", + IntegrationsBasePathKey: "https://integrations.googleapis.com/v1/", KMSBasePathKey: "https://cloudkms.googleapis.com/v1/", LoggingBasePathKey: "https://logging.googleapis.com/v2/", LookerBasePathKey: "https://looker.googleapis.com/v1/", @@ -1096,6 +1099,11 @@ func SetEndpointDefaults(d *schema.ResourceData) error { "GOOGLE_INTEGRATION_CONNECTORS_CUSTOM_ENDPOINT", }, DefaultBasePaths[IntegrationConnectorsBasePathKey])) } + if d.Get("integrations_custom_endpoint") == "" { + d.Set("integrations_custom_endpoint", MultiEnvDefault([]string{ + "GOOGLE_INTEGRATIONS_CUSTOM_ENDPOINT", + }, DefaultBasePaths[IntegrationsBasePathKey])) + } if d.Get("kms_custom_endpoint") == "" { d.Set("kms_custom_endpoint", MultiEnvDefault([]string{ "GOOGLE_KMS_CUSTOM_ENDPOINT", @@ -2287,6 +2295,7 @@ func ConfigureBasePaths(c *Config) { c.IapBasePath = DefaultBasePaths[IapBasePathKey] c.IdentityPlatformBasePath = DefaultBasePaths[IdentityPlatformBasePathKey] c.IntegrationConnectorsBasePath = DefaultBasePaths[IntegrationConnectorsBasePathKey] + c.IntegrationsBasePath = DefaultBasePaths[IntegrationsBasePathKey] c.KMSBasePath = DefaultBasePaths[KMSBasePathKey] c.LoggingBasePath = DefaultBasePaths[LoggingBasePathKey] c.LookerBasePath = DefaultBasePaths[LookerBasePathKey] diff --git a/website/docs/r/integrations_client.html.markdown b/website/docs/r/integrations_client.html.markdown new file mode 100644 index 0000000000..52efc44032 --- /dev/null +++ b/website/docs/r/integrations_client.html.markdown @@ -0,0 +1,200 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** AUTO GENERATED CODE *** Type: MMv1 *** +# +# ---------------------------------------------------------------------------- +# +# This file is automatically generated by Magic Modules and manual +# changes will be clobbered when the file is regenerated. +# +# Please read more about how to change this file in +# .github/CONTRIBUTING.md. +# +# ---------------------------------------------------------------------------- +subcategory: "Application Integration" +description: |- + Application Integration Client. +--- + +# google\_integrations\_client + +Application Integration Client. + + +To get more information about Client, see: + +* [API documentation](https://cloud.google.com/application-integration/docs/reference/rest/v1/projects.locations.clients) +* How-to Guides + * [Official Documentation](https://cloud.google.com/application-integration/docs/overview) + * [Set up Application Integration](https://cloud.google.com/application-integration/docs/setup-application-integration) + + +## Example Usage - Integrations Client Basic + + +```hcl +resource "google_integrations_client" "example" { + location = "us-central1" +} +``` + +## Example Usage - Integrations Client Advance + + +```hcl +data "google_project" "test_project" { +} + +resource "google_kms_key_ring" "keyring" { + name = "my-keyring" + location = "us-central1" +} + +resource "google_kms_crypto_key" "cryptokey" { + name = "crypto-key-example" + key_ring = google_kms_key_ring.keyring.id + rotation_period = "7776000s" + depends_on = [google_kms_key_ring.keyring] +} + +resource "google_kms_crypto_key_version" "test_key" { + crypto_key = google_kms_crypto_key.cryptokey.id + depends_on = [google_kms_crypto_key.cryptokey] +} + +resource "google_integrations_client" "example" { + location = "us-central1" + create_sample_workflows = true + provision_gmek = true + run_as_service_account = "radndom-service-account" + cloud_kms_config { + kms_location = "us-central1" + kms_ring = google_kms_key_ring.keyring.id + key = google_kms_crypto_key.cryptokey.id + key_version = google_kms_crypto_key_version.test_key.id + kms_project_id = data.google_project.test_project.id + } + depends_on = [google_kms_crypto_key_version.test_key] +} +``` + +## Argument Reference + +The following arguments are supported: + + +* `location` - + (Required) + Location in which client needs to be provisioned. + + +- - - + + +* `cloud_kms_config` - + (Optional) + Cloud KMS config for AuthModule to encrypt/decrypt credentials. + Structure is [documented below](#nested_cloud_kms_config). + +* `create_sample_workflows` - + (Optional) + Indicates if sample workflow should be created along with provisioning. + +* `provision_gmek` - + (Optional) + Indicates provision with GMEK or CMEK. + +* `run_as_service_account` - + (Optional) + User input run-as service account, if empty, will bring up a new default service account. + +* `project` - (Optional) The ID of the project in which the resource belongs. + If it is not provided, the provider project is used. + + +The `cloud_kms_config` block supports: + +* `kms_location` - + (Required) + Location name of the key ring, e.g. "us-west1". + +* `kms_ring` - + (Required) + A key ring organizes keys in a specific Google Cloud location and allows you to + manage access control on groups of keys. A key ring's name does not need to be + unique across a Google Cloud project, but must be unique within a given location. + +* `key` - + (Required) + A Cloud KMS key is a named object containing one or more key versions, along + with metadata for the key. A key exists on exactly one key ring tied to a + specific location. + +* `key_version` - + (Optional) + Each version of a key contains key material used for encryption or signing. + A key's version is represented by an integer, starting at 1. To decrypt data + or verify a signature, you must use the same key version that was used to + encrypt or sign the data. + +* `kms_project_id` - + (Optional) + The Google Cloud project id of the project where the kms key stored. If empty, + the kms key is stored at the same project as customer's project and ecrypted + with CMEK, otherwise, the kms key is stored in the tenant project and + encrypted with GMEK. + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are exported: + +* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/clients` + + +## Timeouts + +This resource provides the following +[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: + +- `create` - Default is 20 minutes. +- `delete` - Default is 20 minutes. + +## Import + + +Client can be imported using any of these accepted formats: + +* `projects/{{project}}/locations/{{location}}/clients` +* `{{project}}/{{location}}` +* `{{location}}` + + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Client using one of the formats above. For example: + +```tf +import { + id = "projects/{{project}}/locations/{{location}}/clients" + to = google_integrations_client.default +} +``` + +When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Client can be imported using one of the formats above. For example: + +``` +$ terraform import google_integrations_client.default projects/{{project}}/locations/{{location}}/clients +$ terraform import google_integrations_client.default {{project}}/{{location}} +$ terraform import google_integrations_client.default {{location}} +``` + +## User Project Overrides + +This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).