From e96b6c74e79d89d060fa81b3fc1a38fbcfe67764 Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 9 Sep 2026 22:09:15 +0000 Subject: [PATCH] ces: add whatsapp_config to google_ces_deployment --- mmv1/products/ces/Deployment.yaml | 39 +++++++ .../ces/ces_deployment_whatsapp.tf.tmpl | 30 +++++ .../services/ces/ces_deployment_test.go | 109 ++++++++++++++++++ 3 files changed, 178 insertions(+) create mode 100644 mmv1/templates/terraform/samples/services/ces/ces_deployment_whatsapp.tf.tmpl diff --git a/mmv1/products/ces/Deployment.yaml b/mmv1/products/ces/Deployment.yaml index 5b5d31d8c95b..205b48f9f358 100644 --- a/mmv1/products/ces/Deployment.yaml +++ b/mmv1/products/ces/Deployment.yaml @@ -43,6 +43,16 @@ samples: app_version_display_name: my-app-version app_version_id: app-version-id deployment_display_name: my-deployment + - name: ces_deployment_whatsapp + primary_resource_id: my-deployment + steps: + - name: ces_deployment_whatsapp + resource_id_vars: + app_display_name: my-app + app_id: app-id + app_version_display_name: my-app-version + app_version_id: app-version-id + deployment_display_name: my-deployment parameters: - name: location type: String @@ -85,6 +95,8 @@ properties: CONTACT_CENTER_AS_A_SERVICE FIVE9 CONTACT_CENTER_INTEGRATION + WHATSAPP + INSTAGRAM - name: disableBargeInControl type: Boolean description: |- @@ -160,6 +172,33 @@ properties: description: |- Indicates whether reCAPTCHA verification for the web widget is enabled. send_empty_value: true + - name: whatsappConfig + type: NestedObject + description: Configuration specific to WhatsApp deployments. + properties: + - name: description + type: String + description: Output only. The description of the Meta business page or profile. + output: true + - name: displayName + type: String + description: Output only. The fetched Meta business page name. + output: true + - name: phoneNumber + type: String + description: Optional. The phone number in E.164 format. + - name: phoneNumberId + type: String + required: true + description: Required. The Meta phone number ID. + - name: thumbnailUrl + type: String + description: Output only. The fetched Meta business profile thumbnail URL. + output: true + - name: wabaId + type: String + required: true + description: Required. The WhatsApp Business Account ID. - name: createTime type: String description: Timestamp when this deployment was created. diff --git a/mmv1/templates/terraform/samples/services/ces/ces_deployment_whatsapp.tf.tmpl b/mmv1/templates/terraform/samples/services/ces/ces_deployment_whatsapp.tf.tmpl new file mode 100644 index 000000000000..d2427a1e4f22 --- /dev/null +++ b/mmv1/templates/terraform/samples/services/ces/ces_deployment_whatsapp.tf.tmpl @@ -0,0 +1,30 @@ +resource "google_ces_app" "my-app" { + location = "us" + display_name = "{{index $.ResourceIdVars "app_display_name"}}" + app_id = "{{index $.ResourceIdVars "app_id"}}" + time_zone_settings { + time_zone = "America/Los_Angeles" + } +} +resource "google_ces_app_version" "my-app-version" { + location = "us" + display_name = "{{index $.ResourceIdVars "app_version_display_name"}}" + app = google_ces_app.my-app.name + app_version_id = "{{index $.ResourceIdVars "app_version_id"}}" + description = "example-app-version" +} +resource "google_ces_deployment" "{{$.PrimaryResourceId}}" { + location = "us" + display_name = "{{index $.ResourceIdVars "deployment_display_name"}}" + app = google_ces_app.my-app.name + app_version = google_ces_app_version.my-app-version.id + channel_profile { + channel_type = "API" + profile_id = "temp_profile_id" + whatsapp_config { + phone_number = "+15551234567" + phone_number_id = "1234567890" + waba_id = "9876543210" + } + } +} diff --git a/mmv1/third_party/terraform/services/ces/ces_deployment_test.go b/mmv1/third_party/terraform/services/ces/ces_deployment_test.go index ee1fa75bfad2..6d11f6a8a6a2 100644 --- a/mmv1/third_party/terraform/services/ces/ces_deployment_test.go +++ b/mmv1/third_party/terraform/services/ces/ces_deployment_test.go @@ -426,3 +426,112 @@ resource "google_ces_deployment" "my-deployment" { } `, context) } + +func TestAccCESDeployment_whatsappConfig(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckCESDeploymentDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccCESDeployment_whatsappConfig(context), + }, + { + ResourceName: "google_ces_deployment.my-deployment", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"app", "app_version", "location"}, + }, + { + Config: testAccCESDeployment_whatsappConfig_update(context), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction("google_ces_deployment.my-deployment", plancheck.ResourceActionUpdate), + }, + }, + }, + { + ResourceName: "google_ces_deployment.my-deployment", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"app", "app_version", "location"}, + }, + }, + }) +} + +func testAccCESDeployment_whatsappConfig(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_ces_app" "my-app" { + location = "us" + display_name = "tf-test-my-app%%{random_suffix}" + app_id = "tf-test-app-id%%{random_suffix}" + time_zone_settings { + time_zone = "America/Los_Angeles" + } +} +resource "google_ces_app_version" "my-app-version" { + location = "us" + display_name = "tf-test-my-app-version%%{random_suffix}" + app = google_ces_app.my-app.name + app_version_id = "tf-test-app-version-id%%{random_suffix}" + description = "example-app-version" +} +resource "google_ces_deployment" "my-deployment" { + location = "us" + display_name = "tf-test-my-deployment%%{random_suffix}" + app = google_ces_app.my-app.name + app_version = google_ces_app_version.my-app-version.id + channel_profile { + channel_type = "API" + profile_id = "temp_profile_id" + whatsapp_config { + phone_number = "+15551234567" + phone_number_id = "1234567890" + waba_id = "9876543210" + } + } +} +`, context) +} + +func testAccCESDeployment_whatsappConfig_update(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_ces_app" "my-app" { + location = "us" + display_name = "tf-test-my-app%%{random_suffix}" + app_id = "tf-test-app-id%%{random_suffix}" + time_zone_settings { + time_zone = "America/Los_Angeles" + } +} +resource "google_ces_app_version" "my-app-version" { + location = "us" + display_name = "tf-test-my-app-version%%{random_suffix}" + app = google_ces_app.my-app.name + app_version_id = "tf-test-app-version-id%%{random_suffix}" + description = "example-app-version" +} +resource "google_ces_deployment" "my-deployment" { + location = "us" + display_name = "tf-test-my-deployment%%{random_suffix}" + app = google_ces_app.my-app.name + app_version = google_ces_app_version.my-app-version.id + channel_profile { + channel_type = "API" + profile_id = "temp_profile_id" + whatsapp_config { + phone_number = "+15559876543" + phone_number_id = "2345678901" + waba_id = "8765432109" + } + } +} +`, context) +}