...
1/**
2 * Copyright 2022 Google LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17```hcl
18resource "google_project" "agent_project" {
19 project_id = "tf-test-dialogflow-%{random_suffix}"
20 name = "tf-test-dialogflow-%{random_suffix}"
21 org_id = "123456789"
22}
23
24resource "google_project_service" "agent_project" {
25 project = google_project.agent_project.project_id
26 service = "dialogflow.googleapis.com"
27 disable_dependent_services = false
28}
29
30resource "google_service_account" "dialogflow_service_account" {
31 account_id = "tf-test-dialogflow-%{random_suffix}"
32}
33
34resource "google_project_iam_member" "agent_create" {
35 project = google_project_service.agent_project.project
36 role = "roles/dialogflow.admin"
37 member = "serviceAccount:${google_service_account.dialogflow_service_account.email}"
38}
39
40resource "google_dialogflow_agent" "basic_agent" {
41 project = google_project.agent_project.project_id
42 display_name = "example_agent"
43 default_language_code = "en"
44 time_zone = "America/New_York"
45}
46
47resource "google_dialogflow_intent" "full_intent" {
48 project = google_project.agent_project.project_id
49 depends_on = [google_dialogflow_agent.basic_agent]
50 display_name = "full-intent"
51 webhook_state = "WEBHOOK_STATE_ENABLED"
52 priority = 1
53 is_fallback = false
54 ml_disabled = true
55 action = "some_action"
56 reset_contexts = true
57 input_context_names = ["projects/${google_project.agent_project.project_id}/agent/sessions/-/contexts/some_id"]
58 events = ["some_event"]
59 default_response_platforms = ["FACEBOOK","SLACK"]
60}
61```
View as plain text