diff --git a/.changelog/9834.txt b/.changelog/9834.txt new file mode 100644 index 00000000000..24b5f613f88 --- /dev/null +++ b/.changelog/9834.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +`google_discovery_engine_chat_engine` +``` \ No newline at end of file diff --git a/google/provider/provider_mmv1_resources.go b/google/provider/provider_mmv1_resources.go index 2c2756da5be..ff94e58cf15 100644 --- a/google/provider/provider_mmv1_resources.go +++ b/google/provider/provider_mmv1_resources.go @@ -382,9 +382,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{ } // Resources -// Generated resources: 373 +// Generated resources: 374 // Generated IAM resources: 222 -// Total generated resources: 595 +// Total generated resources: 596 var generatedResources = map[string]*schema.Resource{ "google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(), "google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(), @@ -692,6 +692,7 @@ var generatedResources = map[string]*schema.Resource{ "google_dialogflow_cx_test_case": dialogflowcx.ResourceDialogflowCXTestCase(), "google_dialogflow_cx_version": dialogflowcx.ResourceDialogflowCXVersion(), "google_dialogflow_cx_webhook": dialogflowcx.ResourceDialogflowCXWebhook(), + "google_discovery_engine_chat_engine": discoveryengine.ResourceDiscoveryEngineChatEngine(), "google_discovery_engine_data_store": discoveryengine.ResourceDiscoveryEngineDataStore(), "google_dns_managed_zone": dns.ResourceDNSManagedZone(), "google_dns_managed_zone_iam_binding": tpgiamresource.ResourceIamBinding(dns.DNSManagedZoneIamSchema, dns.DNSManagedZoneIamUpdaterProducer, dns.DNSManagedZoneIdParseFunc), diff --git a/google/services/discoveryengine/resource_discovery_engine_chat_engine.go b/google/services/discoveryengine/resource_discovery_engine_chat_engine.go new file mode 100644 index 00000000000..128d52fc96e --- /dev/null +++ b/google/services/discoveryengine/resource_discovery_engine_chat_engine.go @@ -0,0 +1,698 @@ +// 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 discoveryengine + +import ( + "fmt" + "log" + "reflect" + "strings" + "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" + "github.com/hashicorp/terraform-provider-google/google/verify" +) + +func ResourceDiscoveryEngineChatEngine() *schema.Resource { + return &schema.Resource{ + Create: resourceDiscoveryEngineChatEngineCreate, + Read: resourceDiscoveryEngineChatEngineRead, + Update: resourceDiscoveryEngineChatEngineUpdate, + Delete: resourceDiscoveryEngineChatEngineDelete, + + Importer: &schema.ResourceImporter{ + State: resourceDiscoveryEngineChatEngineImport, + }, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(20 * time.Minute), + Update: schema.DefaultTimeout(20 * time.Minute), + Delete: schema.DefaultTimeout(20 * time.Minute), + }, + + CustomizeDiff: customdiff.All( + tpgresource.DefaultProviderProject, + ), + + Schema: map[string]*schema.Schema{ + "chat_engine_config": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: `Configurations for a chat Engine.`, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "agent_creation_config": { + Type: schema.TypeList, + Required: true, + Description: `The configuration to generate the Dialogflow agent that is associated to this Engine.`, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "default_language_code": { + Type: schema.TypeString, + Required: true, + Description: `The default language of the agent as a language tag. See [Language Support](https://cloud.google.com/dialogflow/docs/reference/language) for a list of the currently supported language codes.`, + }, + "time_zone": { + Type: schema.TypeString, + Required: true, + Description: `The time zone of the agent from the [time zone database](https://www.iana.org/time-zones), e.g., America/New_York, Europe/Paris.`, + }, + "business": { + Type: schema.TypeString, + Optional: true, + Description: `Name of the company, organization or other entity that the agent represents. Used for knowledge connector LLM prompt and for knowledge search.`, + }, + "location": { + Type: schema.TypeString, + Optional: true, + Description: `Agent location for Agent creation, currently supported values: global/us/eu, it needs to be the same region as the Chat Engine.`, + }, + }, + }, + }, + }, + }, + }, + "collection_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The collection ID.`, + }, + "data_store_ids": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: `The data stores associated with this engine. Multiple DataStores in the same Collection can be associated here. All listed DataStores must be 'SOLUTION_TYPE_CHAT'. Adding or removing data stores will force recreation.`, + MinItems: 1, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "display_name": { + Type: schema.TypeString, + Required: true, + Description: `The display name of the engine. Should be human readable. UTF-8 encoded string with limit of 1024 characters.`, + }, + "engine_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `The ID to use for chat engine.`, + }, + "location": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: `Location.`, + }, + "common_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: `Common config spec that specifies the metadata of the engine.`, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "company_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: `The name of the company, business or entity that is associated with the engine. Setting this may help improve LLM related features.`, + }, + }, + }, + }, + "industry_vertical": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: verify.ValidateEnum([]string{"GENERIC", ""}), + Description: `The industry vertical that the chat engine registers. Vertical on Engine has to match vertical of the DataStore linked to the engine. Default value: "GENERIC" Possible values: ["GENERIC"]`, + Default: "GENERIC", + }, + "chat_engine_metadata": { + Type: schema.TypeList, + Computed: true, + Description: `Additional information of the Chat Engine.`, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "dialogflow_agent": { + Type: schema.TypeString, + Computed: true, + Description: `The resource name of a Dialogflow agent, that this Chat Engine refers to.`, + }, + }, + }, + }, + "create_time": { + Type: schema.TypeString, + Computed: true, + Description: `Timestamp the Engine was created at.`, + }, + "name": { + Type: schema.TypeString, + Computed: true, + Description: `The unique full resource name of the chat engine. Values are of the format +'projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}'. +This field must be a UTF-8 encoded string with a length limit of 1024 +characters.`, + }, + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: `Timestamp the Engine was last updated.`, + }, + "project": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + }, + UseJSONNumber: true, + } +} + +func resourceDiscoveryEngineChatEngineCreate(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{}) + industryVerticalProp, err := expandDiscoveryEngineChatEngineIndustryVertical(d.Get("industry_vertical"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("industry_vertical"); !tpgresource.IsEmptyValue(reflect.ValueOf(industryVerticalProp)) && (ok || !reflect.DeepEqual(v, industryVerticalProp)) { + obj["industryVertical"] = industryVerticalProp + } + displayNameProp, err := expandDiscoveryEngineChatEngineDisplayName(d.Get("display_name"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("display_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(displayNameProp)) && (ok || !reflect.DeepEqual(v, displayNameProp)) { + obj["displayName"] = displayNameProp + } + dataStoreIdsProp, err := expandDiscoveryEngineChatEngineDataStoreIds(d.Get("data_store_ids"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("data_store_ids"); !tpgresource.IsEmptyValue(reflect.ValueOf(dataStoreIdsProp)) && (ok || !reflect.DeepEqual(v, dataStoreIdsProp)) { + obj["dataStoreIds"] = dataStoreIdsProp + } + chatEngineConfigProp, err := expandDiscoveryEngineChatEngineChatEngineConfig(d.Get("chat_engine_config"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("chat_engine_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(chatEngineConfigProp)) && (ok || !reflect.DeepEqual(v, chatEngineConfigProp)) { + obj["chatEngineConfig"] = chatEngineConfigProp + } + commonConfigProp, err := expandDiscoveryEngineChatEngineCommonConfig(d.Get("common_config"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("common_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(commonConfigProp)) && (ok || !reflect.DeepEqual(v, commonConfigProp)) { + obj["commonConfig"] = commonConfigProp + } + + obj, err = resourceDiscoveryEngineChatEngineEncoder(d, meta, obj) + if err != nil { + return err + } + + url, err := tpgresource.ReplaceVars(d, config, "{{DiscoveryEngineBasePath}}projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines?engineId={{engine_id}}") + if err != nil { + return err + } + + log.Printf("[DEBUG] Creating new ChatEngine: %#v", obj) + billingProject := "" + + project, err := tpgresource.GetProject(d, config) + if err != nil { + return fmt.Errorf("Error fetching project for ChatEngine: %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 ChatEngine: %s", err) + } + + // Store the ID now + id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}") + if err != nil { + return fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + // Use the resource in the operation response to populate + // identity fields and d.Id() before read + var opRes map[string]interface{} + err = DiscoveryEngineOperationWaitTimeWithResponse( + config, res, &opRes, project, "Creating ChatEngine", userAgent, + d.Timeout(schema.TimeoutCreate)) + if err != nil { + // The resource didn't actually create + d.SetId("") + + return fmt.Errorf("Error waiting to create ChatEngine: %s", err) + } + + if err := d.Set("name", flattenDiscoveryEngineChatEngineName(opRes["name"], d, config)); err != nil { + return err + } + + // This may have caused the ID to update - update it if so. + id, err = tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}") + if err != nil { + return fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + log.Printf("[DEBUG] Finished creating ChatEngine %q: %#v", d.Id(), res) + + return resourceDiscoveryEngineChatEngineRead(d, meta) +} + +func resourceDiscoveryEngineChatEngineRead(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, "{{DiscoveryEngineBasePath}}projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}") + if err != nil { + return err + } + + billingProject := "" + + project, err := tpgresource.GetProject(d, config) + if err != nil { + return fmt.Errorf("Error fetching project for ChatEngine: %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("DiscoveryEngineChatEngine %q", d.Id())) + } + + if err := d.Set("project", project); err != nil { + return fmt.Errorf("Error reading ChatEngine: %s", err) + } + + if err := d.Set("name", flattenDiscoveryEngineChatEngineName(res["name"], d, config)); err != nil { + return fmt.Errorf("Error reading ChatEngine: %s", err) + } + if err := d.Set("industry_vertical", flattenDiscoveryEngineChatEngineIndustryVertical(res["industryVertical"], d, config)); err != nil { + return fmt.Errorf("Error reading ChatEngine: %s", err) + } + if err := d.Set("display_name", flattenDiscoveryEngineChatEngineDisplayName(res["displayName"], d, config)); err != nil { + return fmt.Errorf("Error reading ChatEngine: %s", err) + } + if err := d.Set("data_store_ids", flattenDiscoveryEngineChatEngineDataStoreIds(res["dataStoreIds"], d, config)); err != nil { + return fmt.Errorf("Error reading ChatEngine: %s", err) + } + if err := d.Set("create_time", flattenDiscoveryEngineChatEngineCreateTime(res["createTime"], d, config)); err != nil { + return fmt.Errorf("Error reading ChatEngine: %s", err) + } + if err := d.Set("update_time", flattenDiscoveryEngineChatEngineUpdateTime(res["updateTime"], d, config)); err != nil { + return fmt.Errorf("Error reading ChatEngine: %s", err) + } + if err := d.Set("common_config", flattenDiscoveryEngineChatEngineCommonConfig(res["commonConfig"], d, config)); err != nil { + return fmt.Errorf("Error reading ChatEngine: %s", err) + } + if err := d.Set("chat_engine_metadata", flattenDiscoveryEngineChatEngineChatEngineMetadata(res["chatEngineMetadata"], d, config)); err != nil { + return fmt.Errorf("Error reading ChatEngine: %s", err) + } + + return nil +} + +func resourceDiscoveryEngineChatEngineUpdate(d *schema.ResourceData, meta interface{}) error { + config := meta.(*transport_tpg.Config) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + if err != nil { + return err + } + + billingProject := "" + + project, err := tpgresource.GetProject(d, config) + if err != nil { + return fmt.Errorf("Error fetching project for ChatEngine: %s", err) + } + billingProject = project + + obj := make(map[string]interface{}) + displayNameProp, err := expandDiscoveryEngineChatEngineDisplayName(d.Get("display_name"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("display_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, displayNameProp)) { + obj["displayName"] = displayNameProp + } + + obj, err = resourceDiscoveryEngineChatEngineEncoder(d, meta, obj) + if err != nil { + return err + } + + url, err := tpgresource.ReplaceVars(d, config, "{{DiscoveryEngineBasePath}}projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}") + if err != nil { + return err + } + + log.Printf("[DEBUG] Updating ChatEngine %q: %#v", d.Id(), obj) + updateMask := []string{} + + if d.HasChange("display_name") { + updateMask = append(updateMask, "displayName") + } + // updateMask is a URL parameter but not present in the schema, so ReplaceVars + // won't set it + url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) + if err != nil { + return err + } + + // err == nil indicates that the billing_project value was found + if bp, err := tpgresource.GetBillingProject(d, config); err == nil { + billingProject = bp + } + + // if updateMask is empty we are not updating anything so skip the post + if len(updateMask) > 0 { + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "PATCH", + Project: billingProject, + RawURL: url, + UserAgent: userAgent, + Body: obj, + Timeout: d.Timeout(schema.TimeoutUpdate), + }) + + if err != nil { + return fmt.Errorf("Error updating ChatEngine %q: %s", d.Id(), err) + } else { + log.Printf("[DEBUG] Finished updating ChatEngine %q: %#v", d.Id(), res) + } + + } + + return resourceDiscoveryEngineChatEngineRead(d, meta) +} + +func resourceDiscoveryEngineChatEngineDelete(d *schema.ResourceData, meta interface{}) error { + config := meta.(*transport_tpg.Config) + userAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent) + if err != nil { + return err + } + + billingProject := "" + + project, err := tpgresource.GetProject(d, config) + if err != nil { + return fmt.Errorf("Error fetching project for ChatEngine: %s", err) + } + billingProject = project + + url, err := tpgresource.ReplaceVars(d, config, "{{DiscoveryEngineBasePath}}projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}") + if err != nil { + return err + } + + var obj map[string]interface{} + log.Printf("[DEBUG] Deleting ChatEngine %q", d.Id()) + + // 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: "DELETE", + Project: billingProject, + RawURL: url, + UserAgent: userAgent, + Body: obj, + Timeout: d.Timeout(schema.TimeoutDelete), + }) + if err != nil { + return transport_tpg.HandleNotFoundError(err, d, "ChatEngine") + } + + err = DiscoveryEngineOperationWaitTime( + config, res, project, "Deleting ChatEngine", userAgent, + d.Timeout(schema.TimeoutDelete)) + + if err != nil { + return err + } + + log.Printf("[DEBUG] Finished deleting ChatEngine %q: %#v", d.Id(), res) + return nil +} + +func resourceDiscoveryEngineChatEngineImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + config := meta.(*transport_tpg.Config) + if err := tpgresource.ParseImportId([]string{ + "^projects/(?P[^/]+)/locations/(?P[^/]+)/collections/(?P[^/]+)/engines/(?P[^/]+)$", + "^(?P[^/]+)/(?P[^/]+)/(?P[^/]+)/(?P[^/]+)$", + "^(?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}}/collections/{{collection_id}}/engines/{{engine_id}}") + if err != nil { + return nil, fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + return []*schema.ResourceData{d}, nil +} + +func flattenDiscoveryEngineChatEngineName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenDiscoveryEngineChatEngineIndustryVertical(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenDiscoveryEngineChatEngineDisplayName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenDiscoveryEngineChatEngineDataStoreIds(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenDiscoveryEngineChatEngineCreateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenDiscoveryEngineChatEngineUpdateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenDiscoveryEngineChatEngineCommonConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["company_name"] = + flattenDiscoveryEngineChatEngineCommonConfigCompanyName(original["companyName"], d, config) + return []interface{}{transformed} +} +func flattenDiscoveryEngineChatEngineCommonConfigCompanyName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenDiscoveryEngineChatEngineChatEngineMetadata(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + if v == nil { + return nil + } + original := v.(map[string]interface{}) + if len(original) == 0 { + return nil + } + transformed := make(map[string]interface{}) + transformed["dialogflow_agent"] = + flattenDiscoveryEngineChatEngineChatEngineMetadataDialogflowAgent(original["dialogflowAgent"], d, config) + return []interface{}{transformed} +} +func flattenDiscoveryEngineChatEngineChatEngineMetadataDialogflowAgent(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func expandDiscoveryEngineChatEngineIndustryVertical(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandDiscoveryEngineChatEngineDisplayName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandDiscoveryEngineChatEngineDataStoreIds(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandDiscoveryEngineChatEngineChatEngineConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + l := v.([]interface{}) + if len(l) == 0 || l[0] == nil { + return nil, nil + } + raw := l[0] + original := raw.(map[string]interface{}) + transformed := make(map[string]interface{}) + + transformedAgentCreationConfig, err := expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfig(original["agent_creation_config"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedAgentCreationConfig); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["agentCreationConfig"] = transformedAgentCreationConfig + } + + return transformed, nil +} + +func expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + l := v.([]interface{}) + if len(l) == 0 || l[0] == nil { + return nil, nil + } + raw := l[0] + original := raw.(map[string]interface{}) + transformed := make(map[string]interface{}) + + transformedBusiness, err := expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfigBusiness(original["business"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedBusiness); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["business"] = transformedBusiness + } + + transformedDefaultLanguageCode, err := expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfigDefaultLanguageCode(original["default_language_code"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedDefaultLanguageCode); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["defaultLanguageCode"] = transformedDefaultLanguageCode + } + + transformedTimeZone, err := expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfigTimeZone(original["time_zone"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedTimeZone); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["timeZone"] = transformedTimeZone + } + + transformedLocation, err := expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfigLocation(original["location"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedLocation); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["location"] = transformedLocation + } + + return transformed, nil +} + +func expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfigBusiness(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfigDefaultLanguageCode(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfigTimeZone(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandDiscoveryEngineChatEngineChatEngineConfigAgentCreationConfigLocation(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandDiscoveryEngineChatEngineCommonConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + l := v.([]interface{}) + if len(l) == 0 || l[0] == nil { + return nil, nil + } + raw := l[0] + original := raw.(map[string]interface{}) + transformed := make(map[string]interface{}) + + transformedCompanyName, err := expandDiscoveryEngineChatEngineCommonConfigCompanyName(original["company_name"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedCompanyName); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["companyName"] = transformedCompanyName + } + + return transformed, nil +} + +func expandDiscoveryEngineChatEngineCommonConfigCompanyName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func resourceDiscoveryEngineChatEngineEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { + //hard code solutionType to "SOLUTION_TYPE_CHAT" for chat engine resource + obj["solutionType"] = "SOLUTION_TYPE_CHAT" + return obj, nil +} diff --git a/google/services/discoveryengine/resource_discovery_engine_chat_engine_generated_test.go b/google/services/discoveryengine/resource_discovery_engine_chat_engine_generated_test.go new file mode 100644 index 00000000000..90e7d7b8173 --- /dev/null +++ b/google/services/discoveryengine/resource_discovery_engine_chat_engine_generated_test.go @@ -0,0 +1,136 @@ +// 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 discoveryengine_test + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" +) + +func TestAccDiscoveryEngineChatEngine_discoveryengineChatEngineBasicExample(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), + CheckDestroy: testAccCheckDiscoveryEngineChatEngineDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccDiscoveryEngineChatEngine_discoveryengineChatEngineBasicExample(context), + }, + { + ResourceName: "google_discovery_engine_chat_engine.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"chat_engine_config", "engine_id", "collection_id", "location"}, + }, + }, + }) +} + +func testAccDiscoveryEngineChatEngine_discoveryengineChatEngineBasicExample(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_discovery_engine_data_store" "test_data_store" { + location = "global" + data_store_id = "tf-test-data-store%{random_suffix}" + display_name = "Structured datastore" + industry_vertical = "GENERIC" + content_config = "NO_CONTENT" + solution_types = ["SOLUTION_TYPE_CHAT"] +} + +resource "google_discovery_engine_data_store" "test_data_store_2" { + location = google_discovery_engine_data_store.test_data_store.location + data_store_id = "tf-test-data-store-2%{random_suffix}" + display_name = "Structured datastore 2" + industry_vertical = "GENERIC" + content_config = "NO_CONTENT" + solution_types = ["SOLUTION_TYPE_CHAT"] +} + +resource "google_discovery_engine_chat_engine" "primary" { + engine_id = "tf-test-chat-engine-id%{random_suffix}" + collection_id = "default_collection" + location = google_discovery_engine_data_store.test_data_store.location + display_name = "Chat engine" + industry_vertical = "GENERIC" + data_store_ids = [google_discovery_engine_data_store.test_data_store.data_store_id, google_discovery_engine_data_store.test_data_store_2.data_store_id] + common_config { + company_name = "test-company" + } + chat_engine_config { + agent_creation_config { + business = "test business name" + default_language_code = "en" + time_zone = "America/Los_Angeles" + } + } +} +`, context) +} + +func testAccCheckDiscoveryEngineChatEngineDestroyProducer(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_discovery_engine_chat_engine" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := acctest.GoogleProviderConfig(t) + + url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{DiscoveryEngineBasePath}}projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}") + if err != nil { + return err + } + + billingProject := "" + + if config.BillingProject != "" { + billingProject = config.BillingProject + } + + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: config.UserAgent, + }) + if err == nil { + return fmt.Errorf("DiscoveryEngineChatEngine still exists at %s", url) + } + } + + return nil + } +} diff --git a/google/services/discoveryengine/resource_discovery_engine_chat_engine_sweeper.go b/google/services/discoveryengine/resource_discovery_engine_chat_engine_sweeper.go new file mode 100644 index 00000000000..5a34f8d4a4a --- /dev/null +++ b/google/services/discoveryengine/resource_discovery_engine_chat_engine_sweeper.go @@ -0,0 +1,143 @@ +// 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 discoveryengine + +import ( + "context" + "log" + "strings" + "testing" + + "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/sweeper" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" +) + +func init() { + sweeper.AddTestSweepers("DiscoveryEngineChatEngine", testSweepDiscoveryEngineChatEngine) +} + +// At the time of writing, the CI only passes us-central1 as the region +func testSweepDiscoveryEngineChatEngine(region string) error { + resourceName := "DiscoveryEngineChatEngine" + log.Printf("[INFO][SWEEPER_LOG] Starting sweeper for %s", resourceName) + + config, err := sweeper.SharedConfigForRegion(region) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) + return err + } + + err = config.LoadAndValidate(context.Background()) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error loading: %s", err) + return err + } + + t := &testing.T{} + billingId := envvar.GetTestBillingAccountFromEnv(t) + + // Setup variables to replace in list template + d := &tpgresource.ResourceDataMock{ + FieldsInSchema: map[string]interface{}{ + "project": config.Project, + "region": region, + "location": region, + "zone": "-", + "billing_account": billingId, + }, + } + + listTemplate := strings.Split("https://{{location}}-discoveryengine.googleapis.com/v1/projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}", "?")[0] + listUrl, err := tpgresource.ReplaceVars(d, config, listTemplate) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err) + return nil + } + + res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: config.Project, + RawURL: listUrl, + UserAgent: config.UserAgent, + }) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] Error in response from request %s: %s", listUrl, err) + return nil + } + + resourceList, ok := res["chatEngines"] + if !ok { + log.Printf("[INFO][SWEEPER_LOG] Nothing found in response.") + return nil + } + + rl := resourceList.([]interface{}) + + log.Printf("[INFO][SWEEPER_LOG] Found %d items in %s list response.", len(rl), resourceName) + // Keep count of items that aren't sweepable for logging. + nonPrefixCount := 0 + for _, ri := range rl { + obj := ri.(map[string]interface{}) + var name string + // Id detected in the delete URL, attempt to use id. + if obj["id"] != nil { + name = tpgresource.GetResourceNameFromSelfLink(obj["id"].(string)) + } else if obj["name"] != nil { + name = tpgresource.GetResourceNameFromSelfLink(obj["name"].(string)) + } else { + log.Printf("[INFO][SWEEPER_LOG] %s resource name and id were nil", resourceName) + return nil + } + // Skip resources that shouldn't be sweeped + if !sweeper.IsSweepableTestResource(name) { + nonPrefixCount++ + continue + } + + deleteTemplate := "https://{{location}}-discoveryengine.googleapis.com/v1/projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}" + deleteUrl, err := tpgresource.ReplaceVars(d, config, deleteTemplate) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err) + return nil + } + deleteUrl = deleteUrl + name + + // Don't wait on operations as we may have a lot to delete + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "DELETE", + Project: config.Project, + RawURL: deleteUrl, + UserAgent: config.UserAgent, + }) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] Error deleting for url %s : %s", deleteUrl, err) + } else { + log.Printf("[INFO][SWEEPER_LOG] Sent delete request for %s resource: %s", resourceName, name) + } + } + + if nonPrefixCount > 0 { + log.Printf("[INFO][SWEEPER_LOG] %d items were non-sweepable and skipped.", nonPrefixCount) + } + + return nil +} diff --git a/google/services/discoveryengine/resource_discovery_engine_chat_engine_test.go b/google/services/discoveryengine/resource_discovery_engine_chat_engine_test.go new file mode 100644 index 00000000000..59ee516be10 --- /dev/null +++ b/google/services/discoveryengine/resource_discovery_engine_chat_engine_test.go @@ -0,0 +1,108 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 +package discoveryengine_test + +import ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "testing" +) + +func TestAccDiscoveryEngineChatEngine_discoveryengineChatengine_update(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: testAccDiscoveryEngineChatEngine_discoveryengineChatengine_basic(context), + }, + { + ResourceName: "google_discovery_engine_chat_engine.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"chat_engine_config"}, + }, + { + Config: testAccDiscoveryEngineChatEngine_discoveryengineChatengine_update(context), + }, + { + ResourceName: "google_discovery_engine_chat_engine.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"chat_engine_config"}, + }, + }, + }) +} + +func testAccDiscoveryEngineChatEngine_discoveryengineChatengine_basic(context map[string]interface{}) string { + return acctest.Nprintf(` + resource "google_discovery_engine_data_store" "test_data_store" { + location = "eu" + data_store_id = "tf-test-data-store-id%{random_suffix}" + display_name = "tf-test-structured-datastore" + industry_vertical = "GENERIC" + content_config = "NO_CONTENT" + solution_types = ["SOLUTION_TYPE_CHAT"] + } + + resource "google_discovery_engine_chat_engine" "primary" { + engine_id = "tf-test-chat-engine-id%{random_suffix}" + collection_id = "default_collection" + location = google_discovery_engine_data_store.test_data_store.location + display_name = "tf-test-chat-engine-name%{random_suffix}" + industry_vertical = "GENERIC" + data_store_ids = [google_discovery_engine_data_store.test_data_store.data_store_id] + common_config { + company_name = "test-company" + } + chat_engine_config { + agent_creation_config { + business = "test business name" + default_language_code = "en" + time_zone = "America/Los_Angeles" + } + } + } + `, context) +} + +func testAccDiscoveryEngineChatEngine_discoveryengineChatengine_update(context map[string]interface{}) string { + return acctest.Nprintf(` + resource "google_discovery_engine_data_store" "test_data_store" { + location = "eu" + data_store_id = "tf-test-data-store-id%{random_suffix}" + display_name = "tf-test-structured-datastore" + industry_vertical = "GENERIC" + content_config = "NO_CONTENT" + solution_types = ["SOLUTION_TYPE_CHAT"] + } + + + resource "google_discovery_engine_chat_engine" "primary" { + engine_id = "tf-test-chat-engine-id%{random_suffix}" + collection_id = "default_collection" + location = google_discovery_engine_data_store.test_data_store.location + display_name = "tf-test-chat-engine-name-2%{random_suffix}" + industry_vertical = "GENERIC" + data_store_ids = [google_discovery_engine_data_store.test_data_store.data_store_id] + + common_config { + company_name = "test-company" + } + chat_engine_config { + agent_creation_config { + business = "test business name" + default_language_code = "en" + time_zone = "America/Los_Angeles" + } + } + } + `, context) +} diff --git a/website/docs/r/discovery_engine_chat_engine.html.markdown b/website/docs/r/discovery_engine_chat_engine.html.markdown new file mode 100644 index 00000000000..7b0ee2b359e --- /dev/null +++ b/website/docs/r/discovery_engine_chat_engine.html.markdown @@ -0,0 +1,226 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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: "Discovery Engine" +description: |- + Vertex chat and Conversation Engine Chat type +--- + +# google\_discovery\_engine\_chat\_engine + +Vertex chat and Conversation Engine Chat type + + +To get more information about ChatEngine, see: + +* [API documentation](https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1/projects.locations.collections.engines) +* How-to Guides + * [Vertex AI Conversation](https://cloud.google.com/dialogflow/cx/docs/concept/generative) + + +## Example Usage - Discoveryengine Chat Engine Basic + + +```hcl +resource "google_discovery_engine_data_store" "test_data_store" { + location = "global" + data_store_id = "data-store" + display_name = "Structured datastore" + industry_vertical = "GENERIC" + content_config = "NO_CONTENT" + solution_types = ["SOLUTION_TYPE_CHAT"] +} + +resource "google_discovery_engine_data_store" "test_data_store_2" { + location = google_discovery_engine_data_store.test_data_store.location + data_store_id = "data-store-2" + display_name = "Structured datastore 2" + industry_vertical = "GENERIC" + content_config = "NO_CONTENT" + solution_types = ["SOLUTION_TYPE_CHAT"] +} + +resource "google_discovery_engine_chat_engine" "primary" { + engine_id = "chat-engine-id" + collection_id = "default_collection" + location = google_discovery_engine_data_store.test_data_store.location + display_name = "Chat engine" + industry_vertical = "GENERIC" + data_store_ids = [google_discovery_engine_data_store.test_data_store.data_store_id, google_discovery_engine_data_store.test_data_store_2.data_store_id] + common_config { + company_name = "test-company" + } + chat_engine_config { + agent_creation_config { + business = "test business name" + default_language_code = "en" + time_zone = "America/Los_Angeles" + } + } +} +``` + +## Argument Reference + +The following arguments are supported: + + +* `display_name` - + (Required) + The display name of the engine. Should be human readable. UTF-8 encoded string with limit of 1024 characters. + +* `data_store_ids` - + (Required) + The data stores associated with this engine. Multiple DataStores in the same Collection can be associated here. All listed DataStores must be `SOLUTION_TYPE_CHAT`. Adding or removing data stores will force recreation. + +* `chat_engine_config` - + (Required) + Configurations for a chat Engine. + Structure is [documented below](#nested_chat_engine_config). + +* `engine_id` - + (Required) + The ID to use for chat engine. + +* `collection_id` - + (Required) + The collection ID. + +* `location` - + (Required) + Location. + + +The `chat_engine_config` block supports: + +* `agent_creation_config` - + (Required) + The configuration to generate the Dialogflow agent that is associated to this Engine. + Structure is [documented below](#nested_agent_creation_config). + + +The `agent_creation_config` block supports: + +* `business` - + (Optional) + Name of the company, organization or other entity that the agent represents. Used for knowledge connector LLM prompt and for knowledge search. + +* `default_language_code` - + (Required) + The default language of the agent as a language tag. See [Language Support](https://cloud.google.com/dialogflow/docs/reference/language) for a list of the currently supported language codes. + +* `time_zone` - + (Required) + The time zone of the agent from the [time zone database](https://www.iana.org/time-zones), e.g., America/New_York, Europe/Paris. + +* `location` - + (Optional) + Agent location for Agent creation, currently supported values: global/us/eu, it needs to be the same region as the Chat Engine. + +- - - + + +* `industry_vertical` - + (Optional) + The industry vertical that the chat engine registers. Vertical on Engine has to match vertical of the DataStore linked to the engine. + Default value is `GENERIC`. + Possible values are: `GENERIC`. + +* `common_config` - + (Optional) + Common config spec that specifies the metadata of the engine. + Structure is [documented below](#nested_common_config). + +* `project` - (Optional) The ID of the project in which the resource belongs. + If it is not provided, the provider project is used. + + +The `common_config` block supports: + +* `company_name` - + (Optional) + The name of the company, business or entity that is associated with the engine. Setting this may help improve LLM related features. + +## 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}}/collections/{{collection_id}}/engines/{{engine_id}}` + +* `name` - + The unique full resource name of the chat engine. Values are of the format + `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`. + This field must be a UTF-8 encoded string with a length limit of 1024 + characters. + +* `create_time` - + Timestamp the Engine was created at. + +* `update_time` - + Timestamp the Engine was last updated. + +* `chat_engine_metadata` - + Additional information of the Chat Engine. + Structure is [documented below](#nested_chat_engine_metadata). + + +The `chat_engine_metadata` block contains: + +* `dialogflow_agent` - + (Output) + The resource name of a Dialogflow agent, that this Chat Engine refers to. + +## 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. +- `update` - Default is 20 minutes. +- `delete` - Default is 20 minutes. + +## Import + + +ChatEngine can be imported using any of these accepted formats: + +* `projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}` +* `{{project}}/{{location}}/{{collection_id}}/{{engine_id}}` +* `{{location}}/{{collection_id}}/{{engine_id}}` + + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import ChatEngine using one of the formats above. For example: + +```tf +import { + id = "projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}}" + to = google_discovery_engine_chat_engine.default +} +``` + +When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), ChatEngine can be imported using one of the formats above. For example: + +``` +$ terraform import google_discovery_engine_chat_engine.default projects/{{project}}/locations/{{location}}/collections/{{collection_id}}/engines/{{engine_id}} +$ terraform import google_discovery_engine_chat_engine.default {{project}}/{{location}}/{{collection_id}}/{{engine_id}} +$ terraform import google_discovery_engine_chat_engine.default {{location}}/{{collection_id}}/{{engine_id}} +``` + +## User Project Overrides + +This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).