Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
02b898d
Add AutoLabelingRule resource for Contact Center Insights
scawful Feb 4, 2026
bb5073f
Add AutoLabelingRule resource
scawful Feb 6, 2026
64b047e
ContactCenterInsights: Simplify location description in AutoLabelingRule
scawful Feb 6, 2026
4b1e786
Remove openapi json file as per review feedback
scawful Feb 24, 2026
95553f2
Fix HCL quoting in AutoLabelingRule basic example
scawful Feb 24, 2026
8137d65
Add auto_labeling_rule_id to examples
scawful Feb 24, 2026
7deba00
Fix HCL quoting and add auto_labeling_rule_id to tests
scawful Feb 24, 2026
32e2506
Fix ID pattern in AutoLabelingRule tests and examples
scawful Feb 24, 2026
0b94be4
Remove auto_labeling_rule_id from examples to avoid hyphen issues
scawful Feb 24, 2026
95dd1bd
Change ID prefix to rule-
scawful Feb 24, 2026
0f31549
Simplify CEL expression value
scawful Feb 24, 2026
eae7d46
Add missing description field to fix missing test report
scawful Feb 24, 2026
58d94e4
Fix CEL expression quoting to pass backend validation
scawful Feb 24, 2026
f025014
Fix CEL string quoting to use single quotes
scawful Feb 25, 2026
a1ed2d6
Increase async operation timeouts to 60m
scawful Mar 2, 2026
31086a0
Remove hyphen from auto_labeling_rule_id in test
scawful Mar 2, 2026
142354f
Triggering CI
scawful Mar 2, 2026
ddc85a5
Remove async configuration because the resource creation is synchronous
scawful Mar 2, 2026
4e79e53
Fix auto_labeling_rule_id pattern in examples
scawful Mar 3, 2026
6c5f2da
Fix template syntax for auto_labeling_rule_id
scawful Mar 3, 2026
4c62c2b
Ensure auto_labeling_rule_id is lowercase to satisfy API regex
scawful Mar 3, 2026
4083b86
Ensure random_suffix is lowercase in generated AutoLabelingRule tests
scawful Mar 3, 2026
4a61ec6
Revert "Ensure random_suffix is lowercase in generated AutoLabelingRu…
scawful Mar 3, 2026
2a3fa86
Fix random_suffix conflict by using id_suffix override
scawful Mar 3, 2026
57b1c96
Fix AutoLabelingRule ID pattern to be alphanumeric
scawful Mar 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions mmv1/products/contactcenterinsights/AutoLabelingRule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Copyright 2026 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
name: AutoLabelingRule
description: |
The CCAI Insights project wide auto labeling rule. This rule will be applied
to all conversations that match the filter defined in the rule.
references:
guides:
'Configure auto labeling rules using the API': 'https://cloud.google.com/contact-center/insights/docs/auto-labeling-rule'
api: 'https://cloud.google.com/contact-center/insights/docs/reference/rest/v1/projects.locations.autoLabelingRules'
base_url: projects/{{project}}/locations/{{location}}/autoLabelingRules
update_mask: true
self_link: projects/{{project}}/locations/{{location}}/autoLabelingRules/{{name}}
create_url: projects/{{project}}/locations/{{location}}/autoLabelingRules?autoLabelingRuleId={{auto_labeling_rule_id}}
update_verb: PATCH
id_format: projects/{{project}}/locations/{{location}}/autoLabelingRules/{{name}}
import_format:
- projects/{{project}}/locations/{{location}}/autoLabelingRules/{{name}}
examples:
- name: 'contact_center_insights_auto_labeling_rule_basic'
primary_resource_id: 'auto_labeling_rule_basic'
vars:
resource_name: 'autolabelingrulebasic'
test_vars_overrides:
'id_suffix': 'strings.ToLower(acctest.RandString(t, 10))'
autogen_status: QXV0b0xhYmVsaW5nUnVsZQ==
parameters:
- name: location
type: String
required: true
description: Location of the resource.
immutable: true
url_param_only: true
- name: autoLabelingRuleId
type: String
description: |-
A unique ID for the new AutoLabelingRule. This ID will become the final
component of the AutoLabelingRule's resource name. If no ID is specified,
a server-generated ID will be used.
This value should be 4-64 characters and must match the regular
expression `^[A-Za-z0-9]{4,64}$`.
immutable: true
url_param_only: true
properties:
- name: active
type: Boolean
description: |-
Whether the rule is active.
- name: createTime
type: String
description: The time at which this rule was created.
output: true
- name: displayName
type: String
description: Display Name of the auto labeling rule.
- name: description
type: String
description: The description of the rule.
- name: name
type: String
description: |-
Identifier. The resource name of the auto labeling rule.
Format:
projects/{project}/locations/{location}/autoLabelingRules/{auto_labeling_rule}
output: true
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl'
- name: labelKeyType
type: Enum
description: The type of the label key.
enum_values:
- 'LABEL_KEY_TYPE_UNSPECIFIED'
- 'LABEL_KEY_TYPE_CUSTOM'
- name: labelKey
type: String
description: The label key.
- name: conditions
type: Array
description: Conditions to apply for auto-labeling the label_key.
item_type:
type: NestedObject
properties:
- name: condition
type: String
description: |-
A optional CEL expression to be evaluated as a boolean value.
Once evaluated as true, then we will proceed with the value evaluation.
An empty condition will be auto evaluated as true.
- name: value
type: String
description: CEL expression to be evaluated as the value.
- name: updateTime
type: String
description: The most recent time at which this rule was updated.
output: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "google_contact_center_insights_auto_labeling_rule" "{{$.PrimaryResourceId}}" {
display_name = "{{index $.Vars "resource_name"}}"
auto_labeling_rule_id = "autolabelingrulebasic%{id_suffix}"
description = "Example auto labeling rule"
location = "us-central1"
label_key_type = "LABEL_KEY_TYPE_CUSTOM"
label_key = "{{index $.Vars "resource_name"}}"
conditions {
condition = "true"
value = "'label_value'"
}
active = true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package contactcenterinsights_test

import (
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/plancheck"
"github.com/hashicorp/terraform-provider-google/google/acctest"
"github.com/hashicorp/terraform-provider-google/google/envvar"
)

func TestAccContactCenterInsightsAutoLabelingRule_update(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"random_suffix": strings.ToLower(acctest.RandString(t, 10)),
"project_number": envvar.GetTestProjectNumberFromEnv(),
"resource_name": "tf-test-rule-" + strings.ToLower(acctest.RandString(t, 10)),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccContactCenterInsightsAutoLabelingRule_basic(context),
},
{
ResourceName: "google_contact_center_insights_auto_labeling_rule.auto_labeling_rule_basic",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "auto_labeling_rule_id"},
},
{
Config: testAccContactCenterInsightsAutoLabelingRule_update(context),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("google_contact_center_insights_auto_labeling_rule.auto_labeling_rule_basic", plancheck.ResourceActionUpdate),
},
},
},
{
ResourceName: "google_contact_center_insights_auto_labeling_rule.auto_labeling_rule_basic",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "auto_labeling_rule_id"},
},
},
})
}

func testAccContactCenterInsightsAutoLabelingRule_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_contact_center_insights_auto_labeling_rule" "auto_labeling_rule_basic" {
display_name = "auto-labeling-rule-display-name-%{random_suffix}"
description = "Example auto labeling rule"
auto_labeling_rule_id = "rule%{random_suffix}"
location = "us-central1"
label_key_type = "LABEL_KEY_TYPE_CUSTOM"
label_key = "%{resource_name}"
conditions {
condition = "true"
value = "'label_value'"
}
active = true
}
`, context)
}

func testAccContactCenterInsightsAutoLabelingRule_update(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_contact_center_insights_auto_labeling_rule" "auto_labeling_rule_basic" {
display_name = "auto-labeling-rule-display-name-%{random_suffix}-updated"
description = "Example auto labeling rule"
auto_labeling_rule_id = "rule%{random_suffix}"
location = "us-central1"
label_key_type = "LABEL_KEY_TYPE_CUSTOM"
label_key = "%{resource_name}"
conditions {
condition = "true"
value = "'label_value_updated'"
}
active = false
}
`, context)
}
Loading