Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
65 changes: 65 additions & 0 deletions mmv1/products/dialogflow/version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2025 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: 'Version'
description: |
You can create multiple versions of your agent and publish them to separate environments.
references:
guides:
'Official Documentation': 'https://cloud.google.com/dialogflow/docs/'
api: 'https://cloud.google.com/dialogflow/docs/reference/rest/v2/projects/agent/versions'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Page 404s

docs:
id_format: '{{name}}'
base_url: 'projects/{{project}}/agent/versions'
self_link: '{{name}}'
update_verb: 'PATCH'
update_mask: true
import_format:
- '{{name}}'
timeouts:
insert_minutes: 40
update_minutes: 40
delete_minutes: 20
custom_code:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove as this is empty

exclude_sweeper: true
examples:
- name: 'dialogflow_version_full'
primary_resource_id: 'full_version'
parameters:
properties:
- name: 'name'
type: String
description: |
The unique identifier of this agent version.
output: true
- name: 'versionNumber'
type: Integer
description: |
The sequential number of this version.
output: true
- name: 'description'
type: String
description: |
The developer-provided description of this version.
required: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

False is default, can remove

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs fix

- name: 'status'
type: Enum
description: |
The status of this version.
output: true
enum_values:
- 'VERSION_STATUS_UNSPECIFIED'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UNSPECIFIED is generally an invalid value to use, so it can be removed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs fix

- 'IN_PROGRESS'
- 'READY'
- 'FAILED'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resource "google_dialogflow_agent" "basic_agent" {
display_name = "example_agent"
default_language_code = "en-us"
time_zone = "America/New_York"
}
resource "google_dialogflow_version" "full_version" {
description = "Dialogflow Version"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
package dialogflow_test

import (
"testing"

"github.com/hashicorp/terraform-provider-google/google/acctest"
"github.com/hashicorp/terraform-provider-google/google/envvar"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)

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

context := map[string]interface{}{
"org_id": envvar.GetTestOrgFromEnv(t),
"billing_account": envvar.GetTestBillingAccountFromEnv(t),
"random_suffix": acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Steps: []resource.TestStep{
{
Config: testAccDialogflowVersion_full1(context),
},
{
ResourceName: "google_dialogflow_version.foobar",
RefreshState: true,
},
{
Config: testAccDialogflowVersion_full2(context),
},
{
ResourceName: "google_dialogflow_version.foobar",
RefreshState: true,
},
},
})
}

func testAccDialogflowVersion_full1(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_project" "agent_project" {
name = "tf-test-dialogflow-%{random_suffix}"
project_id = "tf-test-dialogflow-%{random_suffix}"
org_id = "%{org_id}"
billing_account = "%{billing_account}"
deletion_policy = "DELETE"
}

resource "google_project_service" "agent_project" {
project = google_project.agent_project.project_id
service = "dialogflow.googleapis.com"
disable_dependent_services = false
}

resource "google_service_account" "dialogflow_service_account" {
account_id = "tf-test-dialogflow-%{random_suffix}"
}

resource "google_project_iam_member" "agent_create" {
project = google_project_service.agent_project.project
role = "roles/dialogflow.admin"
member = "serviceAccount:${google_service_account.dialogflow_service_account.email}"
}

resource "google_dialogflow_agent" "agent" {
project = google_project.agent_project.project_id
display_name = "tf-test-agent-%{random_suffix}"
default_language_code = "en"
time_zone = "America/New_York"
depends_on = [google_project_iam_member.agent_create]
}

resource "google_dialogflow_version" "foobar" {
depends_on = [google_dialogflow_agent.agent]
project = google_project.agent_project.project_id
description = "tf-test-description-%{random_suffix}"
}
`, context)
}

func testAccDialogflowVersion_full2(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_project" "agent_project" {
name = "tf-test-dialogflow-%{random_suffix}"
project_id = "tf-test-dialogflow-%{random_suffix}"
org_id = "%{org_id}"
billing_account = "%{billing_account}"
deletion_policy = "DELETE"
}

resource "google_project_service" "agent_project" {
project = google_project.agent_project.project_id
service = "dialogflow.googleapis.com"
disable_dependent_services = false
}

resource "google_service_account" "dialogflow_service_account" {
account_id = "tf-test-dialogflow-%{random_suffix}"
}

resource "google_project_iam_member" "agent_create" {
project = google_project_service.agent_project.project
role = "roles/dialogflow.admin"
member = "serviceAccount:${google_service_account.dialogflow_service_account.email}"
}

resource "google_dialogflow_agent" "agent" {
project = google_project.agent_project.project_id
display_name = "tf-test-agent-%{random_suffix}"
default_language_code = "en"
time_zone = "America/New_York"
depends_on = [google_project_iam_member.agent_create]
}

resource "google_dialogflow_version" "foobar" {
depends_on = [google_dialogflow_agent.agent]
project = google_project.agent_project.project_id
description = "tf-test-version-%{random_suffix}2"
}
`, context)
}
Loading