From b673313fa7905511fd83a1abc602f656c0ae536e Mon Sep 17 00:00:00 2001 From: Andrew Garcia-Corley Date: Fri, 5 Jun 2026 12:39:25 -0700 Subject: [PATCH 1/7] removing force new --- mmv1/products/artifactregistry/Repository.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mmv1/products/artifactregistry/Repository.yaml b/mmv1/products/artifactregistry/Repository.yaml index fdd3a0589325..d2743ec78fa9 100644 --- a/mmv1/products/artifactregistry/Repository.yaml +++ b/mmv1/products/artifactregistry/Repository.yaml @@ -761,27 +761,23 @@ properties: type: NestedObject description: |- The credentials used to access the remote repository. - immutable: true is_missing_in_cai: true properties: - name: 'usernamePasswordCredentials' type: NestedObject description: |- Use username and password to access the remote repository. - immutable: true properties: - name: 'username' type: String description: |- The username to access the remote repository. - immutable: true - name: 'passwordSecretVersion' type: String description: |- The Secret Manager key version that holds the password to access the remote repository. Must be in the format of `projects/{project}/secrets/{secret}/versions/{version}`. - immutable: true - name: 'disableUpstreamValidation' type: Boolean description: |- From ac0b49f68304377c13b6fe7a16f835a28f8e4c71 Mon Sep 17 00:00:00 2001 From: Andrew Garcia-Corley Date: Fri, 5 Jun 2026 15:02:42 -0700 Subject: [PATCH 2/7] Adding tests --- ..._artifact_registry_repository_test.go.tmpl | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl index 324a8e39c4e3..38a28c8f9416 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl +++ b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl @@ -339,6 +339,136 @@ resource "google_artifact_registry_repository" "test" { `, repositoryID) } +func TestAccArtifactRegistryRepository_remoteWithAuthUpdate(t *testing.T) { + t.Parallel() + + + context_1 := map[string]interface{}{ + "username_1": "tf-test-username" + randomSuffix, + "username_2": "tf-test-username-new" + randomSuffix, + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccArtifactRegistryRepository_remoteWithAuthUpdate(context), + }, + { + ResourceName: "google_artifact_registry_repository.my-repo", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "remote_repository_config.0.disable_upstream_validation", "repository_id", "terraform_labels"}, + }, + { + Config: testAccArtifactRegistryRepository_remoteWithAuthUpdate2(context), + }, + { + ResourceName: "google_artifact_registry_repository.my-repo", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "remote_repository_config.0.disable_upstream_validation", "repository_id", "terraform_labels"}, + }, + }, + }) +} + +func testAccArtifactRegistryRepository_remoteWithAuthUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_project" "project" {} + +resource "google_secret_manager_secret" "secret" { + secret_id = "tf-test-example-secret" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "secret_version" { + secret = google_secret_manager_secret.secret.id + secret_data = "tf-test-password" +} + +resource "google_secret_manager_secret_iam_member" "secret-access" { + secret_id = google_secret_manager_secret.secret.id + role = "roles/secretmanager.secretAccessor" + member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" +} + +resource "google_artifact_registry_repository" "my-repo" { + location = "us-central1" + repository_id = "tf-test-my-repository-%{random_suffix}" + format = "DOCKER" + mode = "REMOTE_REPOSITORY" + remote_repository_config { + description = "docker hub with custom credentials" + disable_upstream_validation = true + docker_repository { + public_repository = "DOCKER_HUB" + } + upstream_credentials { + username_password_credentials { + username = "%{username_1}" + password_secret_version = google_secret_manager_secret_version.secret_version.name + } + } + } +} +`, context) +} + +func testAccArtifactRegistryRepository_remoteWithAuthUpdate2(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_project" "project" {} + +resource "google_secret_manager_secret" "secret" { + secret_id = "tf-test-example-secret" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "secret_version" { + secret = google_secret_manager_secret.secret.id + secret_data = "tf-test-password" +} + +resource "google_secret_manager_secret_version" "secret_version_updated" { + secret = google_secret_manager_secret.secret.id + secret_data = "tf-test-password-updated" +} + +resource "google_secret_manager_secret_iam_member" "secret-access" { + secret_id = google_secret_manager_secret.%{secret_resource_id}.id + role = "roles/secretmanager.secretAccessor" + member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" +} + +resource "google_artifact_registry_repository" "my-repo" { + location = "us-central1" + repository_id = "tf-test-my-repository-%{random_suffix}" + format = "DOCKER" + mode = "REMOTE_REPOSITORY" + remote_repository_config { + description = "docker hub with custom credentials" + disable_upstream_validation = true + docker_repository { + public_repository = "DOCKER_HUB" + } + upstream_credentials { + username_password_credentials { + username = "%{username_2}" + password_secret_version = google_secret_manager_secret_version.secret_version_updated.name + } + } + } +} +`, context) +} + {{ if ne $.TargetVersionName `ga` -}} func TestAccArtifactRegistryRepository_virtual(t *testing.T) { From 2dcd3ab9078b2d884455525466eda977d80e12a3 Mon Sep 17 00:00:00 2001 From: Andrew Garcia-Corley Date: Mon, 8 Jun 2026 10:50:53 -0700 Subject: [PATCH 3/7] Fixed context typo --- .../resource_artifact_registry_repository_test.go.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl index 38a28c8f9416..07aa6ee2f308 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl +++ b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl @@ -343,9 +343,9 @@ func TestAccArtifactRegistryRepository_remoteWithAuthUpdate(t *testing.T) { t.Parallel() - context_1 := map[string]interface{}{ - "username_1": "tf-test-username" + randomSuffix, - "username_2": "tf-test-username-new" + randomSuffix, + context := map[string]interface{}{ + "username_1": "tf-test-username", + "username_2": "tf-test-username-new", "random_suffix": acctest.RandString(t, 10), } From 5e40bc58756d34828694283cf1bbfc9a0ca2de36 Mon Sep 17 00:00:00 2001 From: Andrew Garcia-Corley Date: Tue, 9 Jun 2026 08:55:13 -0700 Subject: [PATCH 4/7] Fixing typo --- .../resource_artifact_registry_repository_test.go.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl index 07aa6ee2f308..f8f9c8c99ed4 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl +++ b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl @@ -442,7 +442,7 @@ resource "google_secret_manager_secret_version" "secret_version_updated" { } resource "google_secret_manager_secret_iam_member" "secret-access" { - secret_id = google_secret_manager_secret.%{secret_resource_id}.id + secret_id = google_secret_manager_secret.secret.id role = "roles/secretmanager.secretAccessor" member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" } From fb277f029ebe1ec8122f9dd69df90f2df493b1c8 Mon Sep 17 00:00:00 2001 From: Andrew Garcia-Corley Date: Tue, 9 Jun 2026 13:19:20 -0700 Subject: [PATCH 5/7] adding randstring to secret name --- .../resource_artifact_registry_repository_test.go.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl index f8f9c8c99ed4..7254fa17b355 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl +++ b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl @@ -381,7 +381,7 @@ func testAccArtifactRegistryRepository_remoteWithAuthUpdate(context map[string]i data "google_project" "project" {} resource "google_secret_manager_secret" "secret" { - secret_id = "tf-test-example-secret" + secret_id = "tf-test-example-secret-%{random_suffix}" replication { auto {} } @@ -425,7 +425,7 @@ func testAccArtifactRegistryRepository_remoteWithAuthUpdate2(context map[string] data "google_project" "project" {} resource "google_secret_manager_secret" "secret" { - secret_id = "tf-test-example-secret" + secret_id = "tf-test-example-secret-%{random_suffix}" replication { auto {} } From 9ddef40e90bb7a58640b63917bb614647bd7597d Mon Sep 17 00:00:00 2001 From: Andrew Garcia-Corley Date: Thu, 11 Jun 2026 12:14:12 -0700 Subject: [PATCH 6/7] removed is_missing_in_cai as Artifact Registry repositories are explicitly supported in Cloud Asset Inventory --- mmv1/products/artifactregistry/Repository.yaml | 1 - .../resource_artifact_registry_repository_test.go.tmpl | 2 -- 2 files changed, 3 deletions(-) diff --git a/mmv1/products/artifactregistry/Repository.yaml b/mmv1/products/artifactregistry/Repository.yaml index d2743ec78fa9..8ba292f741f8 100644 --- a/mmv1/products/artifactregistry/Repository.yaml +++ b/mmv1/products/artifactregistry/Repository.yaml @@ -761,7 +761,6 @@ properties: type: NestedObject description: |- The credentials used to access the remote repository. - is_missing_in_cai: true properties: - name: 'usernamePasswordCredentials' type: NestedObject diff --git a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl index 7254fa17b355..9c26c207c033 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl +++ b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl @@ -361,7 +361,6 @@ func TestAccArtifactRegistryRepository_remoteWithAuthUpdate(t *testing.T) { ResourceName: "google_artifact_registry_repository.my-repo", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "remote_repository_config.0.disable_upstream_validation", "repository_id", "terraform_labels"}, }, { Config: testAccArtifactRegistryRepository_remoteWithAuthUpdate2(context), @@ -370,7 +369,6 @@ func TestAccArtifactRegistryRepository_remoteWithAuthUpdate(t *testing.T) { ResourceName: "google_artifact_registry_repository.my-repo", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"labels", "location", "remote_repository_config.0.disable_upstream_validation", "repository_id", "terraform_labels"}, }, }, }) From 57529c73d57aa031a8a9748a93a14e76ee79e34e Mon Sep 17 00:00:00 2001 From: Andrew Garcia-Corley Date: Thu, 11 Jun 2026 13:25:47 -0700 Subject: [PATCH 7/7] no patch was being passed due to parent field being immutable --- mmv1/products/artifactregistry/Repository.yaml | 1 - .../resource_artifact_registry_repository_test.go.tmpl | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mmv1/products/artifactregistry/Repository.yaml b/mmv1/products/artifactregistry/Repository.yaml index 8ba292f741f8..06df8daf8362 100644 --- a/mmv1/products/artifactregistry/Repository.yaml +++ b/mmv1/products/artifactregistry/Repository.yaml @@ -506,7 +506,6 @@ properties: type: NestedObject description: |- Configuration specific for a Remote Repository. - immutable: true conflicts: - virtual_repository_config properties: diff --git a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl index 9c26c207c033..7254fa17b355 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl +++ b/mmv1/third_party/terraform/services/artifactregistry/resource_artifact_registry_repository_test.go.tmpl @@ -361,6 +361,7 @@ func TestAccArtifactRegistryRepository_remoteWithAuthUpdate(t *testing.T) { ResourceName: "google_artifact_registry_repository.my-repo", ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "remote_repository_config.0.disable_upstream_validation", "repository_id", "terraform_labels"}, }, { Config: testAccArtifactRegistryRepository_remoteWithAuthUpdate2(context), @@ -369,6 +370,7 @@ func TestAccArtifactRegistryRepository_remoteWithAuthUpdate(t *testing.T) { ResourceName: "google_artifact_registry_repository.my-repo", ImportState: true, ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "remote_repository_config.0.disable_upstream_validation", "repository_id", "terraform_labels"}, }, }, })