From 56c164cb9160507d319ec0138c2bf7aa61b7bb72 Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Wed, 3 Jun 2026 20:41:31 +0000 Subject: [PATCH] Add missing tool types and schema enhancements to google_ces_tool resource (#17758) [upstream:c59c36c347e1667c24f685dac208861fd12eb5b2] Signed-off-by: Modular Magician --- ces_tool_agent_basic/backing_file.tf | 15 ++++ ces_tool_agent_basic/main.tf | 29 ++++++++ ces_tool_agent_basic/motd | 7 ++ ces_tool_agent_basic/tutorial.md | 79 ++++++++++++++++++++++ ces_tool_file_search_basic/backing_file.tf | 15 ++++ ces_tool_file_search_basic/main.tf | 21 ++++++ ces_tool_file_search_basic/motd | 7 ++ ces_tool_file_search_basic/tutorial.md | 79 ++++++++++++++++++++++ ces_tool_widget_basic/backing_file.tf | 15 ++++ ces_tool_widget_basic/main.tf | 44 ++++++++++++ ces_tool_widget_basic/motd | 7 ++ ces_tool_widget_basic/tutorial.md | 79 ++++++++++++++++++++++ 12 files changed, 397 insertions(+) create mode 100644 ces_tool_agent_basic/backing_file.tf create mode 100644 ces_tool_agent_basic/main.tf create mode 100644 ces_tool_agent_basic/motd create mode 100644 ces_tool_agent_basic/tutorial.md create mode 100644 ces_tool_file_search_basic/backing_file.tf create mode 100644 ces_tool_file_search_basic/main.tf create mode 100644 ces_tool_file_search_basic/motd create mode 100644 ces_tool_file_search_basic/tutorial.md create mode 100644 ces_tool_widget_basic/backing_file.tf create mode 100644 ces_tool_widget_basic/main.tf create mode 100644 ces_tool_widget_basic/motd create mode 100644 ces_tool_widget_basic/tutorial.md diff --git a/ces_tool_agent_basic/backing_file.tf b/ces_tool_agent_basic/backing_file.tf new file mode 100644 index 00000000..c60b1199 --- /dev/null +++ b/ces_tool_agent_basic/backing_file.tf @@ -0,0 +1,15 @@ +# This file has some scaffolding to make sure that names are unique and that +# a region and zone are selected when you try to create your Terraform resources. + +locals { + name_suffix = "${random_pet.suffix.id}" +} + +resource "random_pet" "suffix" { + length = 2 +} + +provider "google" { + region = "us-central1" + zone = "us-central1-c" +} diff --git a/ces_tool_agent_basic/main.tf b/ces_tool_agent_basic/main.tf new file mode 100644 index 00000000..fe92940d --- /dev/null +++ b/ces_tool_agent_basic/main.tf @@ -0,0 +1,29 @@ +resource "google_ces_app" "my-app" { + location = "us" + display_name = "my-app-${local.name_suffix}" + app_id = "app-id-${local.name_suffix}" + time_zone_settings { + time_zone = "America/Los_Angeles" + } +} + +resource "google_ces_agent" "target_agent" { + agent_id = "target-agent" + location = "us" + app = google_ces_app.my-app.app_id + display_name = "Target Agent" + instruction = "Target agent instruction" + llm_agent {} +} + +resource "google_ces_tool" "ces_tool_agent_basic" { + location = "us" + app = google_ces_app.my-app.name + tool_id = "ces_tool_basic5-${local.name_suffix}" + execution_type = "SYNCHRONOUS" + agent_tool { + name = "ces_tool_agent_basic-${local.name_suffix}" + description = "example-description" + agent = "projects/${google_ces_app.my-app.project}/locations/us/apps/${google_ces_app.my-app.app_id}/agents/${google_ces_agent.target_agent.agent_id}" + } +} diff --git a/ces_tool_agent_basic/motd b/ces_tool_agent_basic/motd new file mode 100644 index 00000000..45a906e8 --- /dev/null +++ b/ces_tool_agent_basic/motd @@ -0,0 +1,7 @@ +=== + +These examples use real resources that will be billed to the +Google Cloud Platform project you use - so make sure that you +run "terraform destroy" before quitting! + +=== diff --git a/ces_tool_agent_basic/tutorial.md b/ces_tool_agent_basic/tutorial.md new file mode 100644 index 00000000..e9676b62 --- /dev/null +++ b/ces_tool_agent_basic/tutorial.md @@ -0,0 +1,79 @@ +# Ces Tool Agent Basic - Terraform + +## Setup + + + +Welcome to Terraform in Google Cloud Shell! We need you to let us know what project you'd like to use with Terraform. + + + +Terraform provisions real GCP resources, so anything you create in this session will be billed against this project. + +## Terraforming! + +Let's use {{project-id}} with Terraform! Click the Cloud Shell icon below to copy the command +to your shell, and then run it from the shell by pressing Enter/Return. Terraform will pick up +the project name from the environment variable. + +```bash +export GOOGLE_CLOUD_PROJECT={{project-id}} +``` + +After that, let's get Terraform started. Run the following to pull in the providers. + +```bash +terraform init +``` + +With the providers downloaded and a project set, you're ready to use Terraform. Go ahead! + +```bash +terraform apply +``` + +Terraform will show you what it plans to do, and prompt you to accept. Type "yes" to accept the plan. + +```bash +yes +``` + + +## Post-Apply + +### Editing your config + +Now you've provisioned your resources in GCP! If you run a "plan", you should see no changes needed. + +```bash +terraform plan +``` + +So let's make a change! Try editing a number, or appending a value to the name in the editor. Then, +run a 'plan' again. + +```bash +terraform plan +``` + +Afterwards you can run an apply, which implicitly does a plan and shows you the intended changes +at the 'yes' prompt. + +```bash +terraform apply +``` + +```bash +yes +``` + +## Cleanup + +Run the following to remove the resources Terraform provisioned: + +```bash +terraform destroy +``` +```bash +yes +``` diff --git a/ces_tool_file_search_basic/backing_file.tf b/ces_tool_file_search_basic/backing_file.tf new file mode 100644 index 00000000..c60b1199 --- /dev/null +++ b/ces_tool_file_search_basic/backing_file.tf @@ -0,0 +1,15 @@ +# This file has some scaffolding to make sure that names are unique and that +# a region and zone are selected when you try to create your Terraform resources. + +locals { + name_suffix = "${random_pet.suffix.id}" +} + +resource "random_pet" "suffix" { + length = 2 +} + +provider "google" { + region = "us-central1" + zone = "us-central1-c" +} diff --git a/ces_tool_file_search_basic/main.tf b/ces_tool_file_search_basic/main.tf new file mode 100644 index 00000000..d08bb6ff --- /dev/null +++ b/ces_tool_file_search_basic/main.tf @@ -0,0 +1,21 @@ +resource "google_ces_app" "my-app" { + location = "us" + display_name = "my-app-${local.name_suffix}" + app_id = "app-id-${local.name_suffix}" + time_zone_settings { + time_zone = "America/Los_Angeles" + } +} + +resource "google_ces_tool" "ces_tool_file_search_basic" { + location = "us" + app = google_ces_app.my-app.name + tool_id = "ces_tool_basic6-${local.name_suffix}" + execution_type = "SYNCHRONOUS" + file_search_tool { + name = "ces_tool_file_search_basic-${local.name_suffix}" + description = "example-description" + corpus_type = "FULLY_MANAGED" + file_corpus = "projects/${google_ces_app.my-app.project}/locations/us/ragCorpora/tf-test-mock-corpus" + } +} diff --git a/ces_tool_file_search_basic/motd b/ces_tool_file_search_basic/motd new file mode 100644 index 00000000..45a906e8 --- /dev/null +++ b/ces_tool_file_search_basic/motd @@ -0,0 +1,7 @@ +=== + +These examples use real resources that will be billed to the +Google Cloud Platform project you use - so make sure that you +run "terraform destroy" before quitting! + +=== diff --git a/ces_tool_file_search_basic/tutorial.md b/ces_tool_file_search_basic/tutorial.md new file mode 100644 index 00000000..fb73c8c4 --- /dev/null +++ b/ces_tool_file_search_basic/tutorial.md @@ -0,0 +1,79 @@ +# Ces Tool File Search Basic - Terraform + +## Setup + + + +Welcome to Terraform in Google Cloud Shell! We need you to let us know what project you'd like to use with Terraform. + + + +Terraform provisions real GCP resources, so anything you create in this session will be billed against this project. + +## Terraforming! + +Let's use {{project-id}} with Terraform! Click the Cloud Shell icon below to copy the command +to your shell, and then run it from the shell by pressing Enter/Return. Terraform will pick up +the project name from the environment variable. + +```bash +export GOOGLE_CLOUD_PROJECT={{project-id}} +``` + +After that, let's get Terraform started. Run the following to pull in the providers. + +```bash +terraform init +``` + +With the providers downloaded and a project set, you're ready to use Terraform. Go ahead! + +```bash +terraform apply +``` + +Terraform will show you what it plans to do, and prompt you to accept. Type "yes" to accept the plan. + +```bash +yes +``` + + +## Post-Apply + +### Editing your config + +Now you've provisioned your resources in GCP! If you run a "plan", you should see no changes needed. + +```bash +terraform plan +``` + +So let's make a change! Try editing a number, or appending a value to the name in the editor. Then, +run a 'plan' again. + +```bash +terraform plan +``` + +Afterwards you can run an apply, which implicitly does a plan and shows you the intended changes +at the 'yes' prompt. + +```bash +terraform apply +``` + +```bash +yes +``` + +## Cleanup + +Run the following to remove the resources Terraform provisioned: + +```bash +terraform destroy +``` +```bash +yes +``` diff --git a/ces_tool_widget_basic/backing_file.tf b/ces_tool_widget_basic/backing_file.tf new file mode 100644 index 00000000..c60b1199 --- /dev/null +++ b/ces_tool_widget_basic/backing_file.tf @@ -0,0 +1,15 @@ +# This file has some scaffolding to make sure that names are unique and that +# a region and zone are selected when you try to create your Terraform resources. + +locals { + name_suffix = "${random_pet.suffix.id}" +} + +resource "random_pet" "suffix" { + length = 2 +} + +provider "google" { + region = "us-central1" + zone = "us-central1-c" +} diff --git a/ces_tool_widget_basic/main.tf b/ces_tool_widget_basic/main.tf new file mode 100644 index 00000000..d0993f04 --- /dev/null +++ b/ces_tool_widget_basic/main.tf @@ -0,0 +1,44 @@ +resource "google_ces_app" "my-app" { + location = "us" + display_name = "my-app-${local.name_suffix}" + app_id = "app-id-${local.name_suffix}" + time_zone_settings { + time_zone = "America/Los_Angeles" + } +} + +resource "google_ces_tool" "ces_tool_widget_basic" { + location = "us" + app = google_ces_app.my-app.name + tool_id = "ces_tool_basic7-${local.name_suffix}" + execution_type = "SYNCHRONOUS" + widget_tool { + name = "ces_tool_widget_basic-${local.name_suffix}" + description = "example-description" + widget_type = "PRODUCT_CAROUSEL" + ui_config = jsonencode({ + displaySettings = { + showHeader = true + } + }) + data_mapping { + mode = "FIELD_MAPPING" + field_mappings = { + "key1" = "value1" + "key2" = "value2" + } + } + text_response_config { + type = "STATIC" + static_text = "example-static-text" + } + parameters { + type = "OBJECT" + properties = jsonencode({ + param1 = { + type = "STRING" + } + }) + } + } +} diff --git a/ces_tool_widget_basic/motd b/ces_tool_widget_basic/motd new file mode 100644 index 00000000..45a906e8 --- /dev/null +++ b/ces_tool_widget_basic/motd @@ -0,0 +1,7 @@ +=== + +These examples use real resources that will be billed to the +Google Cloud Platform project you use - so make sure that you +run "terraform destroy" before quitting! + +=== diff --git a/ces_tool_widget_basic/tutorial.md b/ces_tool_widget_basic/tutorial.md new file mode 100644 index 00000000..07f3426b --- /dev/null +++ b/ces_tool_widget_basic/tutorial.md @@ -0,0 +1,79 @@ +# Ces Tool Widget Basic - Terraform + +## Setup + + + +Welcome to Terraform in Google Cloud Shell! We need you to let us know what project you'd like to use with Terraform. + + + +Terraform provisions real GCP resources, so anything you create in this session will be billed against this project. + +## Terraforming! + +Let's use {{project-id}} with Terraform! Click the Cloud Shell icon below to copy the command +to your shell, and then run it from the shell by pressing Enter/Return. Terraform will pick up +the project name from the environment variable. + +```bash +export GOOGLE_CLOUD_PROJECT={{project-id}} +``` + +After that, let's get Terraform started. Run the following to pull in the providers. + +```bash +terraform init +``` + +With the providers downloaded and a project set, you're ready to use Terraform. Go ahead! + +```bash +terraform apply +``` + +Terraform will show you what it plans to do, and prompt you to accept. Type "yes" to accept the plan. + +```bash +yes +``` + + +## Post-Apply + +### Editing your config + +Now you've provisioned your resources in GCP! If you run a "plan", you should see no changes needed. + +```bash +terraform plan +``` + +So let's make a change! Try editing a number, or appending a value to the name in the editor. Then, +run a 'plan' again. + +```bash +terraform plan +``` + +Afterwards you can run an apply, which implicitly does a plan and shows you the intended changes +at the 'yes' prompt. + +```bash +terraform apply +``` + +```bash +yes +``` + +## Cleanup + +Run the following to remove the resources Terraform provisioned: + +```bash +terraform destroy +``` +```bash +yes +```