From 9e8ccb17e880e02fe9c87bf83bd97ef5743e7cd3 Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 18 Jan 2024 14:43:58 -0800 Subject: [PATCH] Revert "Discovery Engine Data Store" (#9839) (#17043) [upstream:ebc991bb98c1a5fae88d695b3be64de3efc26cd4] Signed-off-by: Modular Magician --- .changelog/9839.txt | 3 + .teamcity/components/generated/services.kt | 5 - google/fwmodels/provider_model.go | 1 - google/fwprovider/framework_provider.go | 6 - google/fwtransport/framework_config.go | 10 - google/provider/provider.go | 6 - google/provider/provider_mmv1_resources.go | 6 +- .../discovery_engine_operation.go | 92 ---- .../resource_discovery_engine_data_store.go | 479 ------------------ ...covery_engine_data_store_generated_test.go | 109 ---- ...rce_discovery_engine_data_store_sweeper.go | 143 ------ ...source_discovery_engine_data_store_test.go | 69 --- google/sweeper/gcp_sweeper_test.go | 1 - google/transport/config.go | 9 - .../discovery_engine_data_store.html.markdown | 158 ------ 15 files changed, 5 insertions(+), 1092 deletions(-) create mode 100644 .changelog/9839.txt delete mode 100644 google/services/discoveryengine/discovery_engine_operation.go delete mode 100644 google/services/discoveryengine/resource_discovery_engine_data_store.go delete mode 100644 google/services/discoveryengine/resource_discovery_engine_data_store_generated_test.go delete mode 100644 google/services/discoveryengine/resource_discovery_engine_data_store_sweeper.go delete mode 100644 google/services/discoveryengine/resource_discovery_engine_data_store_test.go delete mode 100644 website/docs/r/discovery_engine_data_store.html.markdown diff --git a/.changelog/9839.txt b/.changelog/9839.txt new file mode 100644 index 00000000000..c7e1b1a3d9e --- /dev/null +++ b/.changelog/9839.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +google_discovery_engine_data_store (revert) +``` diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index e046eb0f707..1dd717c1049 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -301,11 +301,6 @@ var services = mapOf( "displayName" to "Dialogflowcx", "path" to "./google/services/dialogflowcx" ), - "discoveryengine" to mapOf( - "name" to "discoveryengine", - "displayName" to "Discoveryengine", - "path" to "./google/services/discoveryengine" - ), "dns" to mapOf( "name" to "dns", "displayName" to "Dns", diff --git a/google/fwmodels/provider_model.go b/google/fwmodels/provider_model.go index c95ce279873..64f0be94bf2 100644 --- a/google/fwmodels/provider_model.go +++ b/google/fwmodels/provider_model.go @@ -75,7 +75,6 @@ type ProviderModel struct { DeploymentManagerCustomEndpoint types.String `tfsdk:"deployment_manager_custom_endpoint"` DialogflowCustomEndpoint types.String `tfsdk:"dialogflow_custom_endpoint"` DialogflowCXCustomEndpoint types.String `tfsdk:"dialogflow_cx_custom_endpoint"` - DiscoveryEngineCustomEndpoint types.String `tfsdk:"discovery_engine_custom_endpoint"` DNSCustomEndpoint types.String `tfsdk:"dns_custom_endpoint"` DocumentAICustomEndpoint types.String `tfsdk:"document_ai_custom_endpoint"` DocumentAIWarehouseCustomEndpoint types.String `tfsdk:"document_ai_warehouse_custom_endpoint"` diff --git a/google/fwprovider/framework_provider.go b/google/fwprovider/framework_provider.go index 5c4e39856de..a6394c7fd0d 100644 --- a/google/fwprovider/framework_provider.go +++ b/google/fwprovider/framework_provider.go @@ -430,12 +430,6 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest, transport_tpg.CustomEndpointValidator(), }, }, - "discovery_engine_custom_endpoint": &schema.StringAttribute{ - Optional: true, - Validators: []validator.String{ - transport_tpg.CustomEndpointValidator(), - }, - }, "dns_custom_endpoint": &schema.StringAttribute{ Optional: true, Validators: []validator.String{ diff --git a/google/fwtransport/framework_config.go b/google/fwtransport/framework_config.go index 3da93559b56..7fb27bb6a9e 100644 --- a/google/fwtransport/framework_config.go +++ b/google/fwtransport/framework_config.go @@ -100,7 +100,6 @@ type FrameworkProviderConfig struct { DeploymentManagerBasePath string DialogflowBasePath string DialogflowCXBasePath string - DiscoveryEngineBasePath string DNSBasePath string DocumentAIBasePath string DocumentAIWarehouseBasePath string @@ -248,7 +247,6 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context, p.DeploymentManagerBasePath = data.DeploymentManagerCustomEndpoint.ValueString() p.DialogflowBasePath = data.DialogflowCustomEndpoint.ValueString() p.DialogflowCXBasePath = data.DialogflowCXCustomEndpoint.ValueString() - p.DiscoveryEngineBasePath = data.DiscoveryEngineCustomEndpoint.ValueString() p.DNSBasePath = data.DNSCustomEndpoint.ValueString() p.DocumentAIBasePath = data.DocumentAICustomEndpoint.ValueString() p.DocumentAIWarehouseBasePath = data.DocumentAIWarehouseCustomEndpoint.ValueString() @@ -827,14 +825,6 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo data.DialogflowCXCustomEndpoint = types.StringValue(customEndpoint.(string)) } } - if data.DiscoveryEngineCustomEndpoint.IsNull() { - customEndpoint := transport_tpg.MultiEnvDefault([]string{ - "GOOGLE_DISCOVERY_ENGINE_CUSTOM_ENDPOINT", - }, transport_tpg.DefaultBasePaths[transport_tpg.DiscoveryEngineBasePathKey]) - if customEndpoint != nil { - data.DiscoveryEngineCustomEndpoint = types.StringValue(customEndpoint.(string)) - } - } if data.DNSCustomEndpoint.IsNull() { customEndpoint := transport_tpg.MultiEnvDefault([]string{ "GOOGLE_DNS_CUSTOM_ENDPOINT", diff --git a/google/provider/provider.go b/google/provider/provider.go index 97176807f5e..be5f9b01e41 100644 --- a/google/provider/provider.go +++ b/google/provider/provider.go @@ -380,11 +380,6 @@ func Provider() *schema.Provider { Optional: true, ValidateFunc: transport_tpg.ValidateCustomEndpoint, }, - "discovery_engine_custom_endpoint": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: transport_tpg.ValidateCustomEndpoint, - }, "dns_custom_endpoint": { Type: schema.TypeString, Optional: true, @@ -929,7 +924,6 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr config.DeploymentManagerBasePath = d.Get("deployment_manager_custom_endpoint").(string) config.DialogflowBasePath = d.Get("dialogflow_custom_endpoint").(string) config.DialogflowCXBasePath = d.Get("dialogflow_cx_custom_endpoint").(string) - config.DiscoveryEngineBasePath = d.Get("discovery_engine_custom_endpoint").(string) config.DNSBasePath = d.Get("dns_custom_endpoint").(string) config.DocumentAIBasePath = d.Get("document_ai_custom_endpoint").(string) config.DocumentAIWarehouseBasePath = d.Get("document_ai_warehouse_custom_endpoint").(string) diff --git a/google/provider/provider_mmv1_resources.go b/google/provider/provider_mmv1_resources.go index b6e7f689b07..92654308fac 100644 --- a/google/provider/provider_mmv1_resources.go +++ b/google/provider/provider_mmv1_resources.go @@ -53,7 +53,6 @@ import ( "github.com/hashicorp/terraform-provider-google/google/services/deploymentmanager" "github.com/hashicorp/terraform-provider-google/google/services/dialogflow" "github.com/hashicorp/terraform-provider-google/google/services/dialogflowcx" - "github.com/hashicorp/terraform-provider-google/google/services/discoveryengine" "github.com/hashicorp/terraform-provider-google/google/services/dns" "github.com/hashicorp/terraform-provider-google/google/services/documentai" "github.com/hashicorp/terraform-provider-google/google/services/documentaiwarehouse" @@ -379,9 +378,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{ } // Resources -// Generated resources: 368 +// Generated resources: 367 // Generated IAM resources: 222 -// Total generated resources: 590 +// Total generated resources: 589 var generatedResources = map[string]*schema.Resource{ "google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(), "google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(), @@ -687,7 +686,6 @@ 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_data_store": discoveryengine.ResourceDiscoveryEngineDataStore(), "google_dns_managed_zone": dns.ResourceDNSManagedZone(), "google_dns_managed_zone_iam_binding": tpgiamresource.ResourceIamBinding(dns.DNSManagedZoneIamSchema, dns.DNSManagedZoneIamUpdaterProducer, dns.DNSManagedZoneIdParseFunc), "google_dns_managed_zone_iam_member": tpgiamresource.ResourceIamMember(dns.DNSManagedZoneIamSchema, dns.DNSManagedZoneIamUpdaterProducer, dns.DNSManagedZoneIdParseFunc), diff --git a/google/services/discoveryengine/discovery_engine_operation.go b/google/services/discoveryengine/discovery_engine_operation.go deleted file mode 100644 index 0e248366e22..00000000000 --- a/google/services/discoveryengine/discovery_engine_operation.go +++ /dev/null @@ -1,92 +0,0 @@ -// 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 ( - "encoding/json" - "errors" - "fmt" - "time" - - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" -) - -type DiscoveryEngineOperationWaiter struct { - Config *transport_tpg.Config - UserAgent string - Project string - tpgresource.CommonOperationWaiter -} - -func (w *DiscoveryEngineOperationWaiter) QueryOp() (interface{}, error) { - if w == nil { - return nil, fmt.Errorf("Cannot query operation, it's unset or nil.") - } - // Returns the proper get. - url := fmt.Sprintf("%s%s", w.Config.DiscoveryEngineBasePath, w.CommonOperationWaiter.Op.Name) - - return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: w.Config, - Method: "GET", - Project: w.Project, - RawURL: url, - UserAgent: w.UserAgent, - }) -} - -func createDiscoveryEngineWaiter(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string) (*DiscoveryEngineOperationWaiter, error) { - w := &DiscoveryEngineOperationWaiter{ - Config: config, - UserAgent: userAgent, - Project: project, - } - if err := w.CommonOperationWaiter.SetOp(op); err != nil { - return nil, err - } - return w, nil -} - -// nolint: deadcode,unused -func DiscoveryEngineOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - w, err := createDiscoveryEngineWaiter(config, op, project, activity, userAgent) - if err != nil { - return err - } - if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil { - return err - } - rawResponse := []byte(w.CommonOperationWaiter.Op.Response) - if len(rawResponse) == 0 { - return errors.New("`resource` not set in operation response") - } - return json.Unmarshal(rawResponse, response) -} - -func DiscoveryEngineOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error { - if val, ok := op["name"]; !ok || val == "" { - // This was a synchronous call - there is no operation to wait for. - return nil - } - w, err := createDiscoveryEngineWaiter(config, op, project, activity, userAgent) - if err != nil { - // If w is nil, the op was synchronous. - return err - } - return tpgresource.OperationWait(w, activity, timeout, config.PollInterval) -} diff --git a/google/services/discoveryengine/resource_discovery_engine_data_store.go b/google/services/discoveryengine/resource_discovery_engine_data_store.go deleted file mode 100644 index e1aa77f8eb8..00000000000 --- a/google/services/discoveryengine/resource_discovery_engine_data_store.go +++ /dev/null @@ -1,479 +0,0 @@ -// 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 ResourceDiscoveryEngineDataStore() *schema.Resource { - return &schema.Resource{ - Create: resourceDiscoveryEngineDataStoreCreate, - Read: resourceDiscoveryEngineDataStoreRead, - Update: resourceDiscoveryEngineDataStoreUpdate, - Delete: resourceDiscoveryEngineDataStoreDelete, - - Importer: &schema.ResourceImporter{ - State: resourceDiscoveryEngineDataStoreImport, - }, - - Timeouts: &schema.ResourceTimeout{ - Create: schema.DefaultTimeout(60 * time.Minute), - Update: schema.DefaultTimeout(60 * time.Minute), - Delete: schema.DefaultTimeout(60 * time.Minute), - }, - - CustomizeDiff: customdiff.All( - tpgresource.DefaultProviderProject, - ), - - Schema: map[string]*schema.Schema{ - "content_config": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"NO_CONTENT", "CONTENT_REQUIRED", "PUBLIC_WEBSITE"}), - Description: `The content config of the data store. Possible values: ["NO_CONTENT", "CONTENT_REQUIRED", "PUBLIC_WEBSITE"]`, - }, - "data_store_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The unique id of the data store.`, - }, - "display_name": { - Type: schema.TypeString, - Required: true, - Description: `The display name of the data store. This field must be a UTF-8 encoded -string with a length limit of 128 characters.`, - }, - "industry_vertical": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"GENERIC", "MEDIA"}), - Description: `The industry vertical that the data store registers. Possible values: ["GENERIC", "MEDIA"]`, - }, - "location": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The geographic location where the data store should reside.`, - }, - "create_advanced_site_search": { - Type: schema.TypeBool, - Optional: true, - Description: `If true, an advanced data store for site search will be created. If the -data store is not configured as site search (GENERIC vertical and -PUBLIC_WEBSITE contentConfig), this flag will be ignored.`, - Default: false, - }, - "solution_types": { - Type: schema.TypeList, - Optional: true, - ForceNew: true, - Description: `The solutions that the data store enrolls. Possible values: ["SOLUTION_TYPE_RECOMMENDATION", "SOLUTION_TYPE_SEARCH", "SOLUTION_TYPE_CHAT"]`, - Elem: &schema.Schema{ - Type: schema.TypeString, - ValidateFunc: verify.ValidateEnum([]string{"SOLUTION_TYPE_RECOMMENDATION", "SOLUTION_TYPE_SEARCH", "SOLUTION_TYPE_CHAT"}), - }, - }, - "create_time": { - Type: schema.TypeString, - Computed: true, - Description: `Timestamp when the DataStore was created.`, - }, - "default_schema_id": { - Type: schema.TypeString, - Computed: true, - Description: `The id of the default Schema associated with this data store.`, - }, - "name": { - Type: schema.TypeString, - Computed: true, - Description: `The unique full resource name of the data store. Values are of the format -'projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}'. -This field must be a UTF-8 encoded string with a length limit of 1024 -characters.`, - }, - "project": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, - }, - UseJSONNumber: true, - } -} - -func resourceDiscoveryEngineDataStoreCreate(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{}) - displayNameProp, err := expandDiscoveryEngineDataStoreDisplayName(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 - } - industryVerticalProp, err := expandDiscoveryEngineDataStoreIndustryVertical(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 - } - solutionTypesProp, err := expandDiscoveryEngineDataStoreSolutionTypes(d.Get("solution_types"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("solution_types"); !tpgresource.IsEmptyValue(reflect.ValueOf(solutionTypesProp)) && (ok || !reflect.DeepEqual(v, solutionTypesProp)) { - obj["solutionTypes"] = solutionTypesProp - } - contentConfigProp, err := expandDiscoveryEngineDataStoreContentConfig(d.Get("content_config"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("content_config"); !tpgresource.IsEmptyValue(reflect.ValueOf(contentConfigProp)) && (ok || !reflect.DeepEqual(v, contentConfigProp)) { - obj["contentConfig"] = contentConfigProp - } - - url, err := tpgresource.ReplaceVars(d, config, "{{DiscoveryEngineBasePath}}projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores?dataStoreId={{data_store_id}}&createAdvancedSiteSearch={{create_advanced_site_search}}") - if err != nil { - return err - } - - log.Printf("[DEBUG] Creating new DataStore: %#v", obj) - billingProject := "" - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("Error fetching project for DataStore: %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 DataStore: %s", err) - } - - // Store the ID now - id, err := tpgresource.ReplaceVars(d, config, "projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}") - if err != nil { - return fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - err = DiscoveryEngineOperationWaitTime( - config, res, project, "Creating DataStore", userAgent, - d.Timeout(schema.TimeoutCreate)) - - if err != nil { - // The resource didn't actually create - d.SetId("") - return fmt.Errorf("Error waiting to create DataStore: %s", err) - } - - log.Printf("[DEBUG] Finished creating DataStore %q: %#v", d.Id(), res) - - return resourceDiscoveryEngineDataStoreRead(d, meta) -} - -func resourceDiscoveryEngineDataStoreRead(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/default_collection/dataStores/{{data_store_id}}") - if err != nil { - return err - } - - billingProject := "" - - project, err := tpgresource.GetProject(d, config) - if err != nil { - return fmt.Errorf("Error fetching project for DataStore: %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("DiscoveryEngineDataStore %q", d.Id())) - } - - if err := d.Set("project", project); err != nil { - return fmt.Errorf("Error reading DataStore: %s", err) - } - - if err := d.Set("name", flattenDiscoveryEngineDataStoreName(res["name"], d, config)); err != nil { - return fmt.Errorf("Error reading DataStore: %s", err) - } - if err := d.Set("display_name", flattenDiscoveryEngineDataStoreDisplayName(res["displayName"], d, config)); err != nil { - return fmt.Errorf("Error reading DataStore: %s", err) - } - if err := d.Set("industry_vertical", flattenDiscoveryEngineDataStoreIndustryVertical(res["industryVertical"], d, config)); err != nil { - return fmt.Errorf("Error reading DataStore: %s", err) - } - if err := d.Set("solution_types", flattenDiscoveryEngineDataStoreSolutionTypes(res["solutionTypes"], d, config)); err != nil { - return fmt.Errorf("Error reading DataStore: %s", err) - } - if err := d.Set("default_schema_id", flattenDiscoveryEngineDataStoreDefaultSchemaId(res["defaultSchemaId"], d, config)); err != nil { - return fmt.Errorf("Error reading DataStore: %s", err) - } - if err := d.Set("content_config", flattenDiscoveryEngineDataStoreContentConfig(res["contentConfig"], d, config)); err != nil { - return fmt.Errorf("Error reading DataStore: %s", err) - } - if err := d.Set("create_time", flattenDiscoveryEngineDataStoreCreateTime(res["createTime"], d, config)); err != nil { - return fmt.Errorf("Error reading DataStore: %s", err) - } - - return nil -} - -func resourceDiscoveryEngineDataStoreUpdate(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 DataStore: %s", err) - } - billingProject = project - - obj := make(map[string]interface{}) - displayNameProp, err := expandDiscoveryEngineDataStoreDisplayName(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 - } - - url, err := tpgresource.ReplaceVars(d, config, "{{DiscoveryEngineBasePath}}projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}") - if err != nil { - return err - } - - log.Printf("[DEBUG] Updating DataStore %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 DataStore %q: %s", d.Id(), err) - } else { - log.Printf("[DEBUG] Finished updating DataStore %q: %#v", d.Id(), res) - } - - err = DiscoveryEngineOperationWaitTime( - config, res, project, "Updating DataStore", userAgent, - d.Timeout(schema.TimeoutUpdate)) - - if err != nil { - return err - } - } - - return resourceDiscoveryEngineDataStoreRead(d, meta) -} - -func resourceDiscoveryEngineDataStoreDelete(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 DataStore: %s", err) - } - billingProject = project - - url, err := tpgresource.ReplaceVars(d, config, "{{DiscoveryEngineBasePath}}projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}") - if err != nil { - return err - } - - var obj map[string]interface{} - log.Printf("[DEBUG] Deleting DataStore %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, "DataStore") - } - - err = DiscoveryEngineOperationWaitTime( - config, res, project, "Deleting DataStore", userAgent, - d.Timeout(schema.TimeoutDelete)) - - if err != nil { - return err - } - - log.Printf("[DEBUG] Finished deleting DataStore %q: %#v", d.Id(), res) - return nil -} - -func resourceDiscoveryEngineDataStoreImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { - config := meta.(*transport_tpg.Config) - if err := tpgresource.ParseImportId([]string{ - "^projects/(?P[^/]+)/locations/(?P[^/]+)/collections/default_collection/dataStores/(?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/default_collection/dataStores/{{data_store_id}}") - if err != nil { - return nil, fmt.Errorf("Error constructing id: %s", err) - } - d.SetId(id) - - return []*schema.ResourceData{d}, nil -} - -func flattenDiscoveryEngineDataStoreName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenDiscoveryEngineDataStoreDisplayName(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenDiscoveryEngineDataStoreIndustryVertical(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenDiscoveryEngineDataStoreSolutionTypes(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenDiscoveryEngineDataStoreDefaultSchemaId(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenDiscoveryEngineDataStoreContentConfig(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func flattenDiscoveryEngineDataStoreCreateTime(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - -func expandDiscoveryEngineDataStoreDisplayName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} - -func expandDiscoveryEngineDataStoreIndustryVertical(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} - -func expandDiscoveryEngineDataStoreSolutionTypes(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} - -func expandDiscoveryEngineDataStoreContentConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return v, nil -} diff --git a/google/services/discoveryengine/resource_discovery_engine_data_store_generated_test.go b/google/services/discoveryengine/resource_discovery_engine_data_store_generated_test.go deleted file mode 100644 index 7b0c045f5db..00000000000 --- a/google/services/discoveryengine/resource_discovery_engine_data_store_generated_test.go +++ /dev/null @@ -1,109 +0,0 @@ -// 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 TestAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample(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: testAccCheckDiscoveryEngineDataStoreDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample(context), - }, - { - ResourceName: "google_discovery_engine_data_store.basic", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "data_store_id", "create_advanced_site_search"}, - }, - }, - }) -} - -func testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_discovery_engine_data_store" "basic" { - location = "global" - 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_SEARCH"] - create_advanced_site_search = false -} -`, context) -} - -func testAccCheckDiscoveryEngineDataStoreDestroyProducer(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_data_store" { - continue - } - if strings.HasPrefix(name, "data.") { - continue - } - - config := acctest.GoogleProviderConfig(t) - - url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{DiscoveryEngineBasePath}}projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_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("DiscoveryEngineDataStore still exists at %s", url) - } - } - - return nil - } -} diff --git a/google/services/discoveryengine/resource_discovery_engine_data_store_sweeper.go b/google/services/discoveryengine/resource_discovery_engine_data_store_sweeper.go deleted file mode 100644 index 6fd4e99f385..00000000000 --- a/google/services/discoveryengine/resource_discovery_engine_data_store_sweeper.go +++ /dev/null @@ -1,143 +0,0 @@ -// 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("DiscoveryEngineDataStore", testSweepDiscoveryEngineDataStore) -} - -// At the time of writing, the CI only passes us-central1 as the region -func testSweepDiscoveryEngineDataStore(region string) error { - resourceName := "DiscoveryEngineDataStore" - 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://discoveryengine.googleapis.com/v1alpha/projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores", "?")[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["dataStores"] - 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://discoveryengine.googleapis.com/v1alpha/projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_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_data_store_test.go b/google/services/discoveryengine/resource_discovery_engine_data_store_test.go deleted file mode 100644 index 50d74e39af7..00000000000 --- a/google/services/discoveryengine/resource_discovery_engine_data_store_test.go +++ /dev/null @@ -1,69 +0,0 @@ -// 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 TestAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_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), - CheckDestroy: testAccCheckDiscoveryEngineDataStoreDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_basic(context), - }, - { - ResourceName: "google_discovery_engine_data_store.basic", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "data_store_id", "create_advanced_site_search"}, - }, - { - Config: testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_update(context), - }, - { - ResourceName: "google_discovery_engine_data_store.basic", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "data_store_id", "create_advanced_site_search"}, - }, - }, - }) -} - -func testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_basic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_discovery_engine_data_store" "basic" { - location = "global" - data_store_id = "tf-test-data-store-id%{random_suffix}" - display_name = "tf-test-structured-datastore" - industry_vertical = "GENERIC" - content_config = "NO_CONTENT" -} -`, context) -} - -func testAccDiscoveryEngineDataStore_discoveryengineDatastoreBasicExample_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_discovery_engine_data_store" "basic" { - location = "global" - data_store_id = "tf-test-data-store-id%{random_suffix}" - display_name = "updated-tf-test-structured-datastore" - industry_vertical = "GENERIC" - content_config = "NO_CONTENT" - solution_types = ["SOLUTION_TYPE_SEARCH"] - create_advanced_site_search = false -} -`, context) -} diff --git a/google/sweeper/gcp_sweeper_test.go b/google/sweeper/gcp_sweeper_test.go index 1d0e9da96b0..08c6e4ac90d 100644 --- a/google/sweeper/gcp_sweeper_test.go +++ b/google/sweeper/gcp_sweeper_test.go @@ -56,7 +56,6 @@ import ( _ "github.com/hashicorp/terraform-provider-google/google/services/deploymentmanager" _ "github.com/hashicorp/terraform-provider-google/google/services/dialogflow" _ "github.com/hashicorp/terraform-provider-google/google/services/dialogflowcx" - _ "github.com/hashicorp/terraform-provider-google/google/services/discoveryengine" _ "github.com/hashicorp/terraform-provider-google/google/services/dns" _ "github.com/hashicorp/terraform-provider-google/google/services/documentai" _ "github.com/hashicorp/terraform-provider-google/google/services/documentaiwarehouse" diff --git a/google/transport/config.go b/google/transport/config.go index d4174fb5a31..a3f04c9a5ff 100644 --- a/google/transport/config.go +++ b/google/transport/config.go @@ -234,7 +234,6 @@ type Config struct { DeploymentManagerBasePath string DialogflowBasePath string DialogflowCXBasePath string - DiscoveryEngineBasePath string DNSBasePath string DocumentAIBasePath string DocumentAIWarehouseBasePath string @@ -364,7 +363,6 @@ const DatastreamBasePathKey = "Datastream" const DeploymentManagerBasePathKey = "DeploymentManager" const DialogflowBasePathKey = "Dialogflow" const DialogflowCXBasePathKey = "DialogflowCX" -const DiscoveryEngineBasePathKey = "DiscoveryEngine" const DNSBasePathKey = "DNS" const DocumentAIBasePathKey = "DocumentAI" const DocumentAIWarehouseBasePathKey = "DocumentAIWarehouse" @@ -488,7 +486,6 @@ var DefaultBasePaths = map[string]string{ DeploymentManagerBasePathKey: "https://www.googleapis.com/deploymentmanager/v2/", DialogflowBasePathKey: "https://dialogflow.googleapis.com/v2/", DialogflowCXBasePathKey: "https://{{location}}-dialogflow.googleapis.com/v3/", - DiscoveryEngineBasePathKey: "https://discoveryengine.googleapis.com/v1alpha/", DNSBasePathKey: "https://dns.googleapis.com/dns/v1/", DocumentAIBasePathKey: "https://{{location}}-documentai.googleapis.com/v1/", DocumentAIWarehouseBasePathKey: "https://contentwarehouse.googleapis.com/v1/", @@ -874,11 +871,6 @@ func SetEndpointDefaults(d *schema.ResourceData) error { "GOOGLE_DIALOGFLOW_CX_CUSTOM_ENDPOINT", }, DefaultBasePaths[DialogflowCXBasePathKey])) } - if d.Get("discovery_engine_custom_endpoint") == "" { - d.Set("discovery_engine_custom_endpoint", MultiEnvDefault([]string{ - "GOOGLE_DISCOVERY_ENGINE_CUSTOM_ENDPOINT", - }, DefaultBasePaths[DiscoveryEngineBasePathKey])) - } if d.Get("dns_custom_endpoint") == "" { d.Set("dns_custom_endpoint", MultiEnvDefault([]string{ "GOOGLE_DNS_CUSTOM_ENDPOINT", @@ -2083,7 +2075,6 @@ func ConfigureBasePaths(c *Config) { c.DeploymentManagerBasePath = DefaultBasePaths[DeploymentManagerBasePathKey] c.DialogflowBasePath = DefaultBasePaths[DialogflowBasePathKey] c.DialogflowCXBasePath = DefaultBasePaths[DialogflowCXBasePathKey] - c.DiscoveryEngineBasePath = DefaultBasePaths[DiscoveryEngineBasePathKey] c.DNSBasePath = DefaultBasePaths[DNSBasePathKey] c.DocumentAIBasePath = DefaultBasePaths[DocumentAIBasePathKey] c.DocumentAIWarehouseBasePath = DefaultBasePaths[DocumentAIWarehouseBasePathKey] diff --git a/website/docs/r/discovery_engine_data_store.html.markdown b/website/docs/r/discovery_engine_data_store.html.markdown deleted file mode 100644 index c410517ced1..00000000000 --- a/website/docs/r/discovery_engine_data_store.html.markdown +++ /dev/null @@ -1,158 +0,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. -# -# ---------------------------------------------------------------------------- -subcategory: "Discovery Engine" -description: |- - Data store is a collection of websites and documents used to find answers for - end-user's questions in Discovery Engine (a. ---- - -# google\_discovery\_engine\_data\_store - -Data store is a collection of websites and documents used to find answers for -end-user's questions in Discovery Engine (a.k.a. Vertex AI Search and -Conversation). - - -To get more information about DataStore, see: - -* [API documentation](https://cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1alpha/projects.locations.collections.dataStores) -* How-to Guides - * [Create a search data store](https://cloud.google.com/generative-ai-app-builder/docs/create-data-store-es) - - -## Example Usage - Discoveryengine Datastore Basic - - -```hcl -resource "google_discovery_engine_data_store" "basic" { - location = "global" - data_store_id = "data-store-id" - display_name = "tf-test-structured-datastore" - industry_vertical = "GENERIC" - content_config = "NO_CONTENT" - solution_types = ["SOLUTION_TYPE_SEARCH"] - create_advanced_site_search = false -} -``` - -## Argument Reference - -The following arguments are supported: - - -* `display_name` - - (Required) - The display name of the data store. This field must be a UTF-8 encoded - string with a length limit of 128 characters. - -* `industry_vertical` - - (Required) - The industry vertical that the data store registers. - Possible values are: `GENERIC`, `MEDIA`. - -* `content_config` - - (Required) - The content config of the data store. - Possible values are: `NO_CONTENT`, `CONTENT_REQUIRED`, `PUBLIC_WEBSITE`. - -* `location` - - (Required) - The geographic location where the data store should reside. - -* `data_store_id` - - (Required) - The unique id of the data store. - - -- - - - - -* `solution_types` - - (Optional) - The solutions that the data store enrolls. - Each value may be one of: `SOLUTION_TYPE_RECOMMENDATION`, `SOLUTION_TYPE_SEARCH`, `SOLUTION_TYPE_CHAT`. - -* `create_advanced_site_search` - - (Optional) - If true, an advanced data store for site search will be created. If the - data store is not configured as site search (GENERIC vertical and - PUBLIC_WEBSITE contentConfig), this flag will be ignored. - -* `project` - (Optional) The ID of the project in which the resource belongs. - If it is not provided, the provider project is used. - - -## 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/default_collection/dataStores/{{data_store_id}}` - -* `name` - - The unique full resource name of the data store. Values are of the format - `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. - This field must be a UTF-8 encoded string with a length limit of 1024 - characters. - -* `default_schema_id` - - The id of the default Schema associated with this data store. - -* `create_time` - - Timestamp when the DataStore was created. - - -## Timeouts - -This resource provides the following -[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: - -- `create` - Default is 60 minutes. -- `update` - Default is 60 minutes. -- `delete` - Default is 60 minutes. - -## Import - - -DataStore can be imported using any of these accepted formats: - -* `projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}` -* `{{project}}/{{location}}/{{data_store_id}}` -* `{{location}}/{{data_store_id}}` - - -In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import DataStore using one of the formats above. For example: - -```tf -import { - id = "projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}}" - to = google_discovery_engine_data_store.default -} -``` - -When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), DataStore can be imported using one of the formats above. For example: - -``` -$ terraform import google_discovery_engine_data_store.default projects/{{project}}/locations/{{location}}/collections/default_collection/dataStores/{{data_store_id}} -$ terraform import google_discovery_engine_data_store.default {{project}}/{{location}}/{{data_store_id}} -$ terraform import google_discovery_engine_data_store.default {{location}}/{{data_store_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).