Skip to content

Commit 6637e26

Browse files
authored
Added dialogflow_agent_to_link field to the google_discovery_engine_chat_engine resource (#11889)
1 parent 751f5b6 commit 6637e26

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

mmv1/products/discoveryengine/ChatEngine.yaml

+23-2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ examples:
5050
engine_id: 'chat-engine-id'
5151
data_store_id: 'data-store'
5252
data_store_2_id: 'data-store-2'
53+
- name: 'discoveryengine_chat_engine_existing_dialogflow_agent'
54+
primary_resource_id: 'primary'
55+
vars:
56+
engine_id: 'chat-engine-id'
57+
data_store_id: 'data-store'
5358
parameters:
5459
- name: 'engineId'
5560
type: String
@@ -99,7 +104,6 @@ properties:
99104
description: |
100105
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.
101106
required: true
102-
immutable: true
103107
item_type:
104108
type: String
105109
min_size: 1
@@ -125,7 +129,12 @@ properties:
125129
type: NestedObject
126130
description: |
127131
The configuration to generate the Dialogflow agent that is associated to this Engine.
128-
required: true
132+
Exactly one of `agent_creation_config` or `dialogflow_agent_to_link` must be set.
133+
immutable: true
134+
ignore_read: true
135+
exactly_one_of:
136+
- 'chat_engine_config.0.agent_creation_config'
137+
- 'chat_engine_config.0.dialogflow_agent_to_link'
129138
properties:
130139
- name: 'business'
131140
type: String
@@ -145,6 +154,18 @@ properties:
145154
type: String
146155
description: |
147156
Agent location for Agent creation, currently supported values: global/us/eu, it needs to be the same region as the Chat Engine.
157+
- name: 'dialogflowAgentToLink'
158+
type: String
159+
description: |
160+
The resource name of an existing Dialogflow agent to link to this Chat Engine. Format: `projects/<Project_ID>/locations/<Location_ID>/agents/<Agent_ID>`.
161+
Exactly one of `agent_creation_config` or `dialogflow_agent_to_link` must be set.
162+
immutable: true
163+
ignore_read: true
164+
validation:
165+
regex: '^projects\/[a-zA-Z0-9-]+(?:\/locations\/[a-zA-Z0-9-]+)?\/agents\/[a-zA-Z0-9-]+$'
166+
exactly_one_of:
167+
- 'chat_engine_config.0.agent_creation_config'
168+
- 'chat_engine_config.0.dialogflow_agent_to_link'
148169
- name: 'commonConfig'
149170
type: NestedObject
150171
description: |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
resource "google_discovery_engine_data_store" "test_data_store" {
2+
location = "global"
3+
data_store_id = "{{index $.Vars "data_store_id"}}"
4+
display_name = "Structured datastore"
5+
industry_vertical = "GENERIC"
6+
content_config = "NO_CONTENT"
7+
solution_types = ["SOLUTION_TYPE_CHAT"]
8+
}
9+
10+
resource "google_dialogflow_cx_agent" "agent" {
11+
display_name = "dialogflowcx-agent"
12+
location = "global"
13+
default_language_code = "en"
14+
time_zone = "America/Los_Angeles"
15+
}
16+
17+
resource "google_discovery_engine_chat_engine" "primary" {
18+
engine_id = "{{index $.Vars "engine_id"}}"
19+
collection_id = "default_collection"
20+
location = google_discovery_engine_data_store.test_data_store.location
21+
display_name = "Chat engine"
22+
industry_vertical = "GENERIC"
23+
data_store_ids = [google_discovery_engine_data_store.test_data_store.data_store_id]
24+
common_config {
25+
company_name = "test-company"
26+
}
27+
chat_engine_config {
28+
dialogflow_agent_to_link = google_dialogflow_cx_agent.agent.id
29+
}
30+
}

0 commit comments

Comments
 (0)