Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
20 changes: 20 additions & 0 deletions mmv1/products/vertexai/ReasoningEngine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ properties:
required: true
- name: 'spec'
type: NestedObject
default_from_api: true
description: |-
Optional. Configurations of the ReasoningEngine.
properties:
Expand Down Expand Up @@ -407,3 +408,22 @@ properties:
project's Cloud Storage and "roles/aiplatform.user" for using Vertex
extensions. If not specified, the Vertex AI Reasoning Engine service
Agent in the project will be used.
- name: 'identityType'
type: Enum
min_version: 'beta'
description: |-
Optional. The identity type to use for the Reasoning Engine.
If not specified, the `service_account` field will be used if set,
otherwise the default Vertex AI Reasoning Engine Service Agent in the project will be used.
Possible values:
* `SERVICE_ACCOUNT`: Use a custom service account if the `service_account` field is set, otherwise use the default Vertex AI Reasoning Engine Service Agent in the project.
* `AGENT_IDENTITY`: Use Agent Identity. The `service_account` field must not be set.
enum_values:
- 'SERVICE_ACCOUNT'
- 'AGENT_IDENTITY'
- name: 'effectiveIdentity'
type: String
min_version: 'beta'
description: |-
The identity to use for the Reasoning Engine.
output: true
Original file line number Diff line number Diff line change
Expand Up @@ -556,3 +556,69 @@ resource "google_vertex_ai_reasoning_engine" "reasoning_engine" {
}
`)
}

Copy link
Member

Choose a reason for hiding this comment

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

Can you add a version guard to this test function, so it is only generated to the beta provider? Thanks

  1. Change the file extension to .go.tmpl
  2. Add the version guard
    Example: https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/services/alloydb/resource_alloydb_instance_test.go.tmpl#L1572

func TestAccVertexAIReasoningEngine_vertexAiReasoningEngineIdentityTypeUpdate(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.ProtoV5ProviderBetaFactories(t),
CheckDestroy: testAccCheckVertexAIEndpointDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccVertexAIReasoningEngine_identityTypeServiceAccount(context),
},
{
ResourceName: "google_vertex_ai_reasoning_engine.reasoning_engine",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"etag", "location", "region", "labels", "terraform_labels", "spec.0.effective_identity"},
},
{
Config: testAccVertexAIReasoningEngine_identityTypeAgentIdentity(context),
},
{
ResourceName: "google_vertex_ai_reasoning_engine.reasoning_engine",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"etag", "location", "region", "labels", "terraform_labels", "spec.0.effective_identity"},
},
},
})
}

func testAccVertexAIReasoningEngine_identityTypeServiceAccount(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_vertex_ai_reasoning_engine" "reasoning_engine" {
provider = google-beta

display_name = "tf-test-sample-reasoning-engine%{random_suffix}"
description = "A reasoning engine for identity type testing"
region = "us-central1"

spec {
identity_type = "SERVICE_ACCOUNT"
}
}
`, context)
}

func testAccVertexAIReasoningEngine_identityTypeAgentIdentity(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_vertex_ai_reasoning_engine" "reasoning_engine" {
provider = google-beta

display_name = "tf-test-sample-reasoning-engine%{random_suffix}"
description = "A reasoning engine for identity type testing"
region = "us-central1"

spec {
identity_type = "AGENT_IDENTITY"
}
}
`, context)
}
Loading