Skip to content

Commit

Permalink
Added dialogflow_agent_to_link field to the google_discovery_engine_c…
Browse files Browse the repository at this point in the history
…hat_engine resource (GoogleCloudPlatform#11889)
  • Loading branch information
averbuks authored and BBBmau committed Oct 23, 2024
1 parent 2f958cf commit 949eaa8
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
25 changes: 23 additions & 2 deletions mmv1/products/discoveryengine/ChatEngine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ examples:
engine_id: 'chat-engine-id'
data_store_id: 'data-store'
data_store_2_id: 'data-store-2'
- name: 'discoveryengine_chat_engine_existing_dialogflow_agent'
primary_resource_id: 'primary'
vars:
engine_id: 'chat-engine-id'
data_store_id: 'data-store'
parameters:
- name: 'engineId'
type: String
Expand Down Expand Up @@ -99,7 +104,6 @@ properties:
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.
required: true
immutable: true
item_type:
type: String
min_size: 1
Expand All @@ -125,7 +129,12 @@ properties:
type: NestedObject
description: |
The configuration to generate the Dialogflow agent that is associated to this Engine.
required: true
Exactly one of `agent_creation_config` or `dialogflow_agent_to_link` must be set.
immutable: true
ignore_read: true
exactly_one_of:
- 'chat_engine_config.0.agent_creation_config'
- 'chat_engine_config.0.dialogflow_agent_to_link'
properties:
- name: 'business'
type: String
Expand All @@ -145,6 +154,18 @@ properties:
type: String
description: |
Agent location for Agent creation, currently supported values: global/us/eu, it needs to be the same region as the Chat Engine.
- name: 'dialogflowAgentToLink'
type: String
description: |
The resource name of an existing Dialogflow agent to link to this Chat Engine. Format: `projects/<Project_ID>/locations/<Location_ID>/agents/<Agent_ID>`.
Exactly one of `agent_creation_config` or `dialogflow_agent_to_link` must be set.
immutable: true
ignore_read: true
validation:
regex: '^projects\/[a-zA-Z0-9-]+(?:\/locations\/[a-zA-Z0-9-]+)?\/agents\/[a-zA-Z0-9-]+$'
exactly_one_of:
- 'chat_engine_config.0.agent_creation_config'
- 'chat_engine_config.0.dialogflow_agent_to_link'
- name: 'commonConfig'
type: NestedObject
description: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
resource "google_discovery_engine_data_store" "test_data_store" {
location = "global"
data_store_id = "{{index $.Vars "data_store_id"}}"
display_name = "Structured datastore"
industry_vertical = "GENERIC"
content_config = "NO_CONTENT"
solution_types = ["SOLUTION_TYPE_CHAT"]
}

resource "google_dialogflow_cx_agent" "agent" {
display_name = "dialogflowcx-agent"
location = "global"
default_language_code = "en"
time_zone = "America/Los_Angeles"
}

resource "google_discovery_engine_chat_engine" "primary" {
engine_id = "{{index $.Vars "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]
common_config {
company_name = "test-company"
}
chat_engine_config {
dialogflow_agent_to_link = google_dialogflow_cx_agent.agent.id
}
}

0 comments on commit 949eaa8

Please sign in to comment.