Repository: GoogleCloudPlatform/terraform-validator
Pull request #371 (2021-11-09 18:33:40)

Dns managed zone newmodel
Dns managed zone newmodel

palani-ram-google-partner: @melinath Please review this DNS PR.
palani-ram-google-partner: @melinath It's corresponding MM PR is
https://github.com/GoogleCloudPlatform/magic-modules/pull/5433

Patch:
diff --git a/converters/google/resources/resource_converters.go b/converters/google/resources/resource_converters.go
index fece0de8..079b515e 100644
--- a/converters/google/resources/resource_converters.go
+++ b/converters/google/resources/resource_converters.go
@@ -70,6 +70,7 @@ func ResourceConverters() map[string][]ResourceConverter {
 		"google_compute_subnetwork_iam_policy":             {resourceConverterComputeSubnetworkIamPolicy()},
 		"google_compute_subnetwork_iam_binding":            {resourceConverterComputeSubnetworkIamBinding()},
 		"google_compute_subnetwork_iam_member":             {resourceConverterComputeSubnetworkIamMember()},
+		"google_dns_managed_zone":                          {resourceConverterDNSManagedZone()},
 		"google_data_catalog_entry_group_iam_policy":       {resourceConverterDataCatalogEntryGroupIamPolicy()},
 		"google_data_catalog_entry_group_iam_binding":      {resourceConverterDataCatalogEntryGroupIamBinding()},
 		"google_data_catalog_entry_group_iam_member":       {resourceConverterDataCatalogEntryGroupIamMember()},
diff --git a/docs/supported_resources.md b/docs/supported_resources.md
index 35dd96ed..6f1099de 100644
--- a/docs/supported_resources.md
+++ b/docs/supported_resources.md
@@ -52,6 +52,7 @@ google_data_catalog_entry_group_iam_policy       | datacatalog.googleapis.com/En
 google_data_catalog_tag_template_iam_binding     | datacatalog.googleapis.com/TagTemplate
 google_data_catalog_tag_template_iam_member      | datacatalog.googleapis.com/TagTemplate
 google_data_catalog_tag_template_iam_policy      | datacatalog.googleapis.com/TagTemplate
+google_dns_managed_zone                          | dns.googleapis.com/ManagedZone
 google_endpoints_service_iam_binding             | servicemanagement.googleapis.com/Service
 google_endpoints_service_iam_member              | servicemanagement.googleapis.com/Service
 google_endpoints_service_iam_policy              | servicemanagement.googleapis.com/Service
diff --git a/release.sh b/release.sh
index 068a830a..65d3240c 100755
--- a/release.sh
+++ b/release.sh
@@ -63,14 +63,14 @@ for platform in ${platforms}; do
 	done
 done
 
-echo "Creating Github tag ${version}"
-git tag "${version}"
-git push origin "${version}"
-echo "Github tag ${version} created"
+echo "Creating Github tag v${version}"
+git tag "v${version}"
+git push origin "v${version}"
+echo "Github tag v${version} created"
 
 # Publish release versions
 echo "Pushing releases to Google Storage"
 gsutil cp ${release_dir}/*.tar.gz gs://${release_bucket}/releases/v${version}
 echo "Releases pushed to Google Storage"
 
-echo "Create a new release by visiting https://github.com/GoogleCloudPlatform/terraform-validator/releases/new?tag=${version}&title=${version}"
+echo "Create a new release by visiting https://github.com/GoogleCloudPlatform/terraform-validator/releases/new?tag=v${version}&title=v${version}"


Test patch:
diff --git a/test/cli_test.go b/test/cli_test.go
index 579de7d9..2ff0617d 100644
--- a/test/cli_test.go
+++ b/test/cli_test.go
@@ -74,6 +74,7 @@ func TestCLI(t *testing.T) {
 		{name: "example_compute_subnetwork"},
 		{name: "example_compute_global_forwarding_rule"},
 		{name: "example_container_cluster"},
+		{name: "example_dns_managed_zone"},
 		{name: "example_filestore_instance"},
 		{name: "example_kms_crypto_key"},
 		{name: "example_kms_crypto_key_iam_binding"},
diff --git a/test/read_test.go b/test/read_test.go
index 8eb6fd9d..fbb025a3 100644
--- a/test/read_test.go
+++ b/test/read_test.go
@@ -37,6 +37,7 @@ func TestReadPlannedAssetsCoverage(t *testing.T) {
 		// {name: "example_compute_forwarding_rule"},
 		{name: "example_compute_global_forwarding_rule"},
 		{name: "example_container_cluster"},
+		{name: "example_dns_managed_zone"},
 		{name: "example_filestore_instance"},
 		{name: "example_kms_crypto_key"},
 		{name: "example_kms_crypto_key_iam_binding"},
diff --git a/testdata/templates/example_dns_managed_zone.json b/testdata/templates/example_dns_managed_zone.json
new file mode 100644
index 00000000..f52ebd03
--- /dev/null
+++ b/testdata/templates/example_dns_managed_zone.json
@@ -0,0 +1,31 @@
+[{
+	"name": "//dns.googleapis.com/projects/{{.Provider.project}}/managedZones/publiczone",
+	"asset_type": "dns.googleapis.com/ManagedZone",
+	"ancestry_path": "{{.Ancestry}}/project/{{.Provider.project}}",
+	"resource": {
+		"version": "v1",
+		"discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/dns/v1/rest",
+		"discovery_name": "ManagedZone",
+		"parent": "//cloudresourcemanager.googleapis.com/projects/{{.Provider.project}}",
+		"data": {
+			"description": "Managed by Terraform",
+			"dnsName": "publiczone.gsecurity.net.",
+			"dnssecConfig": {
+				"defaultKeySpecs": [{
+					"algorithm": "rsasha1",
+					"keyLength": 1024,
+					"keyType": "zoneSigning",
+					"kind": "dns#dnsKeySpec"
+				}],
+				"kind": "dns#managedZoneDnsSecConfig",
+				"nonExistence": "nsec3",
+				"state": "on"
+			},
+			"name": "publiczone",
+			"privateVisibilityConfig": {
+				"networks": []
+			},
+			"visibility": "public"
+		}
+	}
+}]
\ No newline at end of file
diff --git a/testdata/templates/example_dns_managed_zone.tf b/testdata/templates/example_dns_managed_zone.tf
new file mode 100644
index 00000000..137a34a8
--- /dev/null
+++ b/testdata/templates/example_dns_managed_zone.tf
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2021 Google LLC
+ *
+ * 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.
+ */
+
+terraform {
+  required_providers {
+    google = {
+      source = "hashicorp/google"
+      version = "~> {{.Provider.version}}"
+    }
+  }
+}
+
+provider "google" {
+  {{if .Provider.credentials }}credentials = "{{.Provider.credentials}}"{{end}}
+}
+
+resource "google_dns_managed_zone" "zone1" {
+  name        = "publiczone"
+  dns_name    = "publiczone.gsecurity.net."
+  
+  force_destroy = true
+  visibility = "public"
+
+  dnssec_config {
+    state         = "on"
+    kind          = "dns#managedZoneDnsSecConfig"
+    non_existence = "nsec3"
+    default_key_specs {
+      //      key_type = "keySigning"
+      key_type   = "zoneSigning" //      ZONE_SIGNING / RSASHA1 / 1024
+      key_length = 1024
+      kind       = "dns#dnsKeySpec"
+      algorithm  = "rsasha1"
+      //      ecdsap256sha256 ecdsap384sha384 rsasha1 rsasha256 rsasha512   //algorithm allowed values
+    }
+  }
+}
diff --git a/testdata/templates/example_dns_managed_zone.tfplan.json b/testdata/templates/example_dns_managed_zone.tfplan.json
new file mode 100644
index 00000000..ad087b5d
--- /dev/null
+++ b/testdata/templates/example_dns_managed_zone.tfplan.json
@@ -0,0 +1,156 @@
+{
+	"format_version": "0.1",
+	"terraform_version": "0.15.3",
+	"planned_values": {
+		"root_module": {
+			"resources": [{
+				"address": "google_dns_managed_zone.zone1",
+				"mode": "managed",
+				"type": "google_dns_managed_zone",
+				"name": "zone1",
+				"provider_name": "registry.terraform.io/hashicorp/google",
+				"schema_version": 0,
+				"values": {
+					"description": "Managed by Terraform",
+					"dns_name": "publiczone.gsecurity.net.",
+					"dnssec_config": [{
+						"default_key_specs": [{
+							"algorithm": "rsasha1",
+							"key_length": 1024,
+							"key_type": "zoneSigning",
+							"kind": "dns#dnsKeySpec"
+						}],
+						"kind": "dns#managedZoneDnsSecConfig",
+						"non_existence": "nsec3",
+						"state": "on"
+					}],
+					"force_destroy": true,
+					"forwarding_config": [],
+					"labels": null,
+					"name": "publiczone",
+					"peering_config": [],
+					"private_visibility_config": [],
+					"timeouts": null,
+					"visibility": "public"
+				}
+			}]
+		}
+	},
+	"resource_changes": [{
+		"address": "google_dns_managed_zone.zone1",
+		"mode": "managed",
+		"type": "google_dns_managed_zone",
+		"name": "zone1",
+		"provider_name": "registry.terraform.io/hashicorp/google",
+		"change": {
+			"actions": ["create"],
+			"before": null,
+			"after": {
+				"description": "Managed by Terraform",
+				"dns_name": "publiczone.gsecurity.net.",
+				"dnssec_config": [{
+					"default_key_specs": [{
+						"algorithm": "rsasha1",
+						"key_length": 1024,
+						"key_type": "zoneSigning",
+						"kind": "dns#dnsKeySpec"
+					}],
+					"kind": "dns#managedZoneDnsSecConfig",
+					"non_existence": "nsec3",
+					"state": "on"
+				}],
+				"force_destroy": true,
+				"forwarding_config": [],
+				"labels": null,
+				"name": "publiczone",
+				"peering_config": [],
+				"private_visibility_config": [],
+				"timeouts": null,
+				"visibility": "public"
+			},
+			"after_unknown": {
+				"dnssec_config": [{
+					"default_key_specs": [{}]
+				}],
+				"forwarding_config": [],
+				"id": true,
+				"name_servers": true,
+				"peering_config": [],
+				"private_visibility_config": [],
+				"project": true
+			},
+			"before_sensitive": false,
+			"after_sensitive": {
+				"dnssec_config": [{
+					"default_key_specs": [{}]
+				}],
+				"forwarding_config": [],
+				"name_servers": [],
+				"peering_config": [],
+				"private_visibility_config": []
+			}
+		}
+	}],
+	"configuration": {
+		"provider_config": {
+			"google": {
+				"name": "google",
+				"version_constraint": "~\u003e 3.84.0",
+				"expressions": {
+					"project": {
+						"constant_value": "{{.Provider.project}}"
+					}
+				}
+			}
+		},
+		"root_module": {
+			"resources": [{
+				"address": "google_dns_managed_zone.zone1",
+				"mode": "managed",
+				"type": "google_dns_managed_zone",
+				"name": "zone1",
+				"provider_config_key": "google",
+				"expressions": {
+					"dns_name": {
+						"constant_value": "publiczone.gsecurity.net."
+					},
+					"dnssec_config": [{
+						"default_key_specs": [{
+							"algorithm": {
+								"constant_value": "rsasha1"
+							},
+							"key_length": {
+								"constant_value": 1024
+							},
+							"key_type": {
+								"constant_value": "zoneSigning"
+							},
+							"kind": {
+								"constant_value": "dns#dnsKeySpec"
+							}
+						}],
+						"kind": {
+							"constant_value": "dns#managedZoneDnsSecConfig"
+						},
+						"non_existence": {
+							"constant_value": "nsec3"
+						},
+						"state": {
+							"constant_value": "on"
+						}
+					}],
+					"force_destroy": {
+						"constant_value": true
+					},
+					"name": {
+						"constant_value": "publiczone"
+					},
+					"visibility": {
+						"constant_value": "public"
+					}
+				},
+				"schema_version": 0
+			}]
+		}
+	}
+}
\ No newline at end of file