diff --git a/.changelog/10186.txt b/.changelog/10186.txt new file mode 100644 index 00000000000..1cb6677e0eb --- /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/.teamcity/components/inputs/services_beta.kt b/.teamcity/components/inputs/services_beta.kt index 13510630f13..613e795bf68 100644 --- a/.teamcity/components/inputs/services_beta.kt +++ b/.teamcity/components/inputs/services_beta.kt @@ -466,6 +466,11 @@ var ServicesListBeta = mapOf( "displayName" to "Integrationconnectors", "path" to "./google-beta/services/integrationconnectors" ), + "integrations" to mapOf( + "name" to "integrations", + "displayName" to "Applicationintegration", + "path" to "./google-beta/services/integrations" + ), "kms" to mapOf( "name" to "kms", "displayName" to "Kms", diff --git a/.teamcity/components/inputs/services_ga.kt b/.teamcity/components/inputs/services_ga.kt index f4b303eccc6..f3a3fe57388 100644 --- a/.teamcity/components/inputs/services_ga.kt +++ b/.teamcity/components/inputs/services_ga.kt @@ -461,6 +461,11 @@ var ServicesListGa = mapOf( "displayName" to "Integrationconnectors", "path" to "./google/services/integrationconnectors" ), + "integrations" to mapOf( + "name" to "integrations", + "displayName" to "Applicationintegration", + "path" to "./google/services/integrations" + ), "kms" to mapOf( "name" to "kms", "displayName" to "Kms", diff --git a/google/fwmodels/provider_model.go b/google/fwmodels/provider_model.go index dfd6a92424b..0a7f73b9a17 100644 --- a/google/fwmodels/provider_model.go +++ b/google/fwmodels/provider_model.go @@ -101,6 +101,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/fwprovider/framework_provider.go b/google/fwprovider/framework_provider.go index 3f59f738e12..e79671914b2 100644 --- a/google/fwprovider/framework_provider.go +++ b/google/fwprovider/framework_provider.go @@ -580,6 +580,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/fwtransport/framework_config.go b/google/fwtransport/framework_config.go index 4ba7c643a9e..615211d755f 100644 --- a/google/fwtransport/framework_config.go +++ b/google/fwtransport/framework_config.go @@ -124,6 +124,7 @@ type FrameworkProviderConfig struct { IapBasePath string IdentityPlatformBasePath string IntegrationConnectorsBasePath string + IntegrationsBasePath string KMSBasePath string LoggingBasePath string LookerBasePath string @@ -277,6 +278,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() @@ -1029,6 +1031,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/provider/provider.go b/google/provider/provider.go index 7f3d0687396..aa01f1965a3 100644 --- a/google/provider/provider.go +++ b/google/provider/provider.go @@ -510,6 +510,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, @@ -1002,6 +1007,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/provider/provider_mmv1_resources.go b/google/provider/provider_mmv1_resources.go index 21ff813d860..2fee32635b5 100644 --- a/google/provider/provider_mmv1_resources.go +++ b/google/provider/provider_mmv1_resources.go @@ -78,6 +78,7 @@ import ( "github.com/hashicorp/terraform-provider-google/google/services/iap" "github.com/hashicorp/terraform-provider-google/google/services/identityplatform" "github.com/hashicorp/terraform-provider-google/google/services/integrationconnectors" + "github.com/hashicorp/terraform-provider-google/google/services/integrations" "github.com/hashicorp/terraform-provider-google/google/services/kms" "github.com/hashicorp/terraform-provider-google/google/services/logging" "github.com/hashicorp/terraform-provider-google/google/services/looker" @@ -395,9 +396,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{ } // Resources -// Generated resources: 396 +// Generated resources: 397 // Generated IAM resources: 234 -// Total generated resources: 630 +// Total generated resources: 631 var generatedResources = map[string]*schema.Resource{ "google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(), "google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(), @@ -846,6 +847,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/services/integrations/resource_integrations_client.go b/google/services/integrations/resource_integrations_client.go new file mode 100644 index 00000000000..fb201aecaf1 --- /dev/null +++ b/google/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/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/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/services/integrations/resource_integrations_client_generated_test.go b/google/services/integrations/resource_integrations_client_generated_test.go new file mode 100644 index 00000000000..11dbd70dfa9 --- /dev/null +++ b/google/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/google/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/sweeper/gcp_sweeper_test.go b/google/sweeper/gcp_sweeper_test.go index 8dddf252e4c..97ea26dec77 100644 --- a/google/sweeper/gcp_sweeper_test.go +++ b/google/sweeper/gcp_sweeper_test.go @@ -80,6 +80,7 @@ import ( _ "github.com/hashicorp/terraform-provider-google/google/services/iap" _ "github.com/hashicorp/terraform-provider-google/google/services/identityplatform" _ "github.com/hashicorp/terraform-provider-google/google/services/integrationconnectors" + _ "github.com/hashicorp/terraform-provider-google/google/services/integrations" _ "github.com/hashicorp/terraform-provider-google/google/services/kms" _ "github.com/hashicorp/terraform-provider-google/google/services/logging" _ "github.com/hashicorp/terraform-provider-google/google/services/looker" diff --git a/google/transport/config.go b/google/transport/config.go index 709003b16cc..ca35bf630c4 100644 --- a/google/transport/config.go +++ b/google/transport/config.go @@ -260,6 +260,7 @@ type Config struct { IapBasePath string IdentityPlatformBasePath string IntegrationConnectorsBasePath string + IntegrationsBasePath string KMSBasePath string LoggingBasePath string LookerBasePath string @@ -395,6 +396,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" @@ -524,6 +526,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/", @@ -1016,6 +1019,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", @@ -2154,6 +2162,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 00000000000..52efc440325 --- /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).