Skip to content
Merged
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 @@ -19,8 +19,9 @@ func TestAccVertexAIReasoningEngine_vertexAiReasoningEngineUpdate(t *testing.T)
})

context := map[string]interface{}{
"bucket_name": acctest.TestBucketName(t),
"kms_key_name": acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-re-key1").CryptoKey.Name,
"random_suffix": acctest.RandString(t, 10),
"bucket_name": acctest.TestBucketName(t),
"kms_key_name": acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-re-key1").CryptoKey.Name,
}

acctest.VcrTest(t, resource.TestCase{
Expand Down Expand Up @@ -174,7 +175,7 @@ resource "time_sleep" "wait_5_minutes" {
}

resource "google_secret_manager_secret" "secret" {
secret_id = "secret"
secret_id = "tf-test-secret-%{random_suffix}"

replication {
auto {}
Expand Down Expand Up @@ -218,7 +219,7 @@ resource "google_storage_bucket_object" "bucket_obj_dependencies_adk" {
}

resource "google_service_account" "service_account" {
account_id = "reasoning-sa"
account_id = "tf-test-re-sa-%{random_suffix}"
}

resource "google_project_iam_member" "sa_iam_object_viewer" {
Expand Down Expand Up @@ -364,7 +365,7 @@ resource "time_sleep" "wait_5_minutes" {
}

resource "google_secret_manager_secret" "secret" {
secret_id = "secret"
secret_id = "tf-test-secret-%{random_suffix}"

replication {
auto {}
Expand All @@ -386,10 +387,12 @@ resource "google_secret_manager_secret_iam_member" "secret_access_new" {
secret_id = google_secret_manager_secret.secret.id
role = "roles/secretmanager.secretAccessor"
member = google_service_account.service_account_new.member

depends_on = [google_secret_manager_secret_iam_member.secret_access]
}

resource "google_secret_manager_secret" "secret_new" {
secret_id = "secret-new"
secret_id = "tf-test-secret-new-%{random_suffix}"

replication {
auto {}
Expand Down Expand Up @@ -460,7 +463,7 @@ resource "google_storage_bucket_object" "bucket_obj_dependencies_langchain" {
}

resource "google_service_account" "service_account" {
account_id = "reasoning-sa"
account_id = "tf-test-re-sa-%{random_suffix}"
}

resource "google_project_iam_member" "sa_iam_object_viewer" {
Expand All @@ -482,7 +485,7 @@ resource "google_project_iam_member" "sa_iam_viewer" {
}

resource "google_service_account" "service_account_new" {
account_id = "reasoning-sa-new"
account_id = "tf-test-re-sa-new-%{random_suffix}"
}

resource "google_project_iam_member" "sa_iam_object_viewer_new" {
Expand Down Expand Up @@ -556,3 +559,71 @@ resource "google_vertex_ai_reasoning_engine" "reasoning_engine" {
}
`)
}

Comment thread
zli82016 marked this conversation as resolved.
{{- if ne $.TargetVersionName "ga" }}
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)
}
{{- end }}
Loading