Google Dialogflow Agent

This page shows how to write Terraform for Dialogflow Agent and write them securely.

google_dialogflow_agent (Terraform)

The Agent in Dialogflow can be configured in Terraform with the resource name google_dialogflow_agent. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

dialogflow.tf#L4
resource "google_dialogflow_agent" "roomservice_agent" {
  display_name = "roomservice_agent"
  default_language_code = "en"
  supported_language_codes = ["fr","de","es"]
  time_zone = "America/New_York"
  description = "RoomService Agent"
dialogflow_agent.tf#L1
resource "google_dialogflow_agent" "RoboBob" {
  display_name = "RoboBob" #required
  default_language_code = "en" #required
  time_zone = "Europe/Kaliningrad" #required
  avatar_uri = "https://www.clipartmax.com/png/small/140-1400962_vee-chatbot-meet-vee.png"
  enable_logging = true
dialogflow_agent.tf#L1
resource "google_dialogflow_agent" "RoboBob" {
  display_name = "RoboBob" #required
  default_language_code = "en" #required
  time_zone = "Europe/Kaliningrad" #required
  avatar_uri = "https://www.clipartmax.com/png/small/140-1400962_vee-chatbot-meet-vee.png"
  enable_logging = true
agent.tf#L1
resource "google_dialogflow_agent" "full_agent" {
  display_name = "dialogflow-example-agent"
  default_language_code = "en"
  time_zone = "Europe/London"
  description = "This is the agent that acts like a human"
  enable_logging = true
main.tf#L1
resource "google_dialogflow_agent" "agent" {
  count                    = length(var.agent)
  project                  = var.project
  default_language_code    = lookup(var.agent[count.index], "default_language_code")
  display_name             = lookup(var.agent[count.index], "display_name")
  time_zone                = lookup(var.agent[count.index], "time_zone")

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

API version displayed in Dialogflow console. If not specified, V2 API is assumed. Clients are free to query different service endpoints for different API versions. However, bots connectors and webhook calls will follow the specified API version. API_VERSION_V1: Legacy V1 API. API_VERSION_V2: V2 API. * API_VERSION_V2_BETA_1: V2beta1 API. Possible values: ["API_VERSION_V1", "API_VERSION_V2", "API_VERSION_V2_BETA_1"]

The URI of the agent's avatar, which are used throughout the Dialogflow console. When an image URL is entered into this field, the Dialogflow will save the image in the backend. The address of the backend image returned from the API will be shown in the [avatarUriBackend] field.

The URI of the agent's avatar as returned from the API. Output only. To provide an image URL for the agent avatar, the [avatarUri] field can be used.

To filter out false positive results and still get variety in matched natural language inputs for your agent, you can tune the machine learning classification threshold. If the returned score value is less than the threshold value, then a fallback intent will be triggered or, if there are no fallback intents defined, no intent will be triggered. The score values range from 0.0 (completely uncertain) to 1.0 (completely certain). If set to 0.0, the default of 0.3 is used.

The default language of the agent as a language tag. See Language Support for a list of the currently supported language codes. This field cannot be updated after creation.

The description of this agent. The maximum length is 500 characters. If exceeded, the request is rejected.

The name of this agent.

Determines whether this agent should log conversation queries.

Determines how intents are detected from user queries. MATCH_MODE_HYBRID: Best for agents with a small number of examples in intents and/or wide use of templates syntax and composite entities. MATCH_MODE_ML_ONLY: Can be used for agents with a large number of examples in intents, especially the ones using @sys.any or very large developer entities. Possible values: ["MATCH_MODE_HYBRID", "MATCH_MODE_ML_ONLY"]

The list of all languages supported by this agent (except for the defaultLanguageCode).

The agent tier. If not specified, TIERSTANDARD is assumed. TIERSTANDARD: Standard tier. TIER_ENTERPRISE: Enterprise tier (Essentials). * TIER_ENTERPRISE_PLUS: Enterprise tier (Plus). NOTE: Due to consistency issues, the provider will not read this field from the API. Drift is possible between the Terraform state and Dialogflow if the agent tier is changed outside of Terraform. Possible values: ["TIER_STANDARD", "TIER_ENTERPRISE", "TIER_ENTERPRISE_PLUS"]

The time zone of this agent from the time zone database, e.g., America/New_York, Europe/Paris.

Explanation in Terraform Registry

A Dialogflow agent is a virtual agent that handles conversations with your end-users. It is a natural language understanding module that understands the nuances of human language. Dialogflow translates end-user text or audio during a conversation to structured data that your apps and services can understand. You design and build a Dialogflow agent to handle the types of conversations required for your system. To get more information about Agent, see:

Frequently asked questions

What is Google Dialogflow Agent?

Google Dialogflow Agent is a resource for Dialogflow of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Dialogflow Agent?

For Terraform, the SlumberStack/roomservice-bot, Dualic/AWA-GCP-final-project and leonbay/testi-ranch source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.