From 941dd6fcda2983a8be8c04ac67caf9a968dcd93a Mon Sep 17 00:00:00 2001 From: Gustavo Kotarsky <167570715+kotarsky@users.noreply.github.com> Date: Fri, 26 Apr 2024 17:03:55 +0000 Subject: [PATCH] adding new tests for artifactregistry.googleapis.com/Repository (#10539) --- mmv1/templates/tgc/resource_converters.go.erb | 1 + .../example_artifact_registry_repository.json | 19 +++++++++++++++++++ .../example_artifact_registry_repository.tf | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 mmv1/third_party/tgc/tests/data/example_artifact_registry_repository.json create mode 100644 mmv1/third_party/tgc/tests/data/example_artifact_registry_repository.tf diff --git a/mmv1/templates/tgc/resource_converters.go.erb b/mmv1/templates/tgc/resource_converters.go.erb index aad7ac4d6c6f..3fb28d691912 100644 --- a/mmv1/templates/tgc/resource_converters.go.erb +++ b/mmv1/templates/tgc/resource_converters.go.erb @@ -35,6 +35,7 @@ import ( // N:1 = [ResourceConverter{Convert: convertAbc, merge: mergeAbc}] (len=1) func ResourceConverters() map[string][]cai.ResourceConverter { return map[string][]cai.ResourceConverter{ + "google_artifact_registry_repository": {artifactregistry.ResourceConverterArtifactRegistryRepository()}, "google_compute_address": {compute.ResourceConverterComputeAddress()}, "google_compute_firewall": {compute.ResourceConverterComputeFirewall()}, "google_compute_disk": {compute.ResourceConverterComputeDisk()}, diff --git a/mmv1/third_party/tgc/tests/data/example_artifact_registry_repository.json b/mmv1/third_party/tgc/tests/data/example_artifact_registry_repository.json new file mode 100644 index 000000000000..8c2596d216a3 --- /dev/null +++ b/mmv1/third_party/tgc/tests/data/example_artifact_registry_repository.json @@ -0,0 +1,19 @@ +[ + { + "name": "//artifactregistry.googleapis.com/projects/{{.Provider.project}}/locations/us-central1/repositories/my-repository", + "ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}", + "asset_type": "artifactregistry.googleapis.com/Repository", + "resource": { + "version": "v1", + "discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/artifactregistry/v1/rest", + "discovery_name": "Repository", + "parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}", + "data": { + "description": "example docker repository", + "format": "DOCKER", + "mode": "STANDARD_REPOSITORY" + } + }, + "ancestors": ["organizations/{{.OrgID}}"] + } +] \ No newline at end of file diff --git a/mmv1/third_party/tgc/tests/data/example_artifact_registry_repository.tf b/mmv1/third_party/tgc/tests/data/example_artifact_registry_repository.tf new file mode 100644 index 000000000000..6078dfb7d24a --- /dev/null +++ b/mmv1/third_party/tgc/tests/data/example_artifact_registry_repository.tf @@ -0,0 +1,19 @@ +terraform { + required_providers { + google = { + source = "hashicorp/google-beta" + version = "~> {{.Provider.version}}" + } + } +} + +provider "google" { + {{if .Provider.credentials }}credentials = "{{.Provider.credentials}}"{{end}} +} + +resource "google_artifact_registry_repository" "my-repo" { + location = "us-central1" + repository_id = "my-repository" + description = "example docker repository" + format = "DOCKER" +} \ No newline at end of file