From 2936c3ba867221c9bfcdeb2a82b5542b0da91897 Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Tue, 10 Dec 2024 13:08:46 -0800 Subject: [PATCH 01/25] Fix settings.data_cache_config permadiff when set to false (#12496) --- .../resource_sql_database_instance.go.tmpl | 12 +++++- .../resource_sql_database_instance_test.go | 40 ++++++++++++++----- 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.tmpl b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.tmpl index e6e542fde6d1..3081fd57af5d 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.tmpl +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.tmpl @@ -2247,6 +2247,12 @@ func flattenSettings(settings *sqladmin.Settings, d *schema.ResourceData) []map[ if settings.DataCacheConfig != nil { data["data_cache_config"] = flattenDataCacheConfig(settings.DataCacheConfig) + } else { + data["data_cache_config"] = []map[string]interface{}{ + { + "data_cache_enabled": false, + }, + } } if settings.AdvancedMachineFeatures != nil { @@ -2258,7 +2264,11 @@ func flattenSettings(settings *sqladmin.Settings, d *schema.ResourceData) []map[ func flattenDataCacheConfig(d *sqladmin.DataCacheConfig) []map[string]interface{} { if d == nil { - return nil + return []map[string]interface{}{ + { + "data_cache_enabled": false, + }, + } } return []map[string]interface{}{ { diff --git a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go index 240d181d2639..fc5954744177 100644 --- a/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go +++ b/mmv1/third_party/terraform/services/sql/resource_sql_database_instance_test.go @@ -1755,9 +1755,9 @@ func TestAccSQLDatabaseInstance_sqlMysqlDataCacheConfig(t *testing.T) { CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testGoogleSqlDatabaseInstance_sqlMysqlDataCacheConfig(instanceName), + Config: testGoogleSqlDatabaseInstance_sqlMysqlDataCacheConfig(instanceName, false), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("google_sql_database_instance.instance", "settings.0.data_cache_config.0.data_cache_enabled", "true"), + resource.TestCheckResourceAttr("google_sql_database_instance.instance", "settings.0.data_cache_config.0.data_cache_enabled", "false"), ), }, { @@ -1766,6 +1766,12 @@ func TestAccSQLDatabaseInstance_sqlMysqlDataCacheConfig(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"deletion_protection"}, }, + { + Config: testGoogleSqlDatabaseInstance_sqlMysqlDataCacheConfig(instanceName, true), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("google_sql_database_instance.instance", "settings.0.data_cache_config.0.data_cache_enabled", "true"), + ), + }, }, }) } @@ -1782,7 +1788,7 @@ func TestAccSQLDatabaseInstance_sqlPostgresDataCacheConfig(t *testing.T) { CheckDestroy: testAccSqlDatabaseInstanceDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testGoogleSqlDatabaseInstance_sqlPostgresDataCacheConfig(enterprisePlusInstanceName, enterprisePlusTier, "ENTERPRISE_PLUS"), + Config: testGoogleSqlDatabaseInstance_sqlPostgresDataCacheConfig(enterprisePlusInstanceName, enterprisePlusTier, "ENTERPRISE_PLUS", true), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("google_sql_database_instance.instance", "settings.0.data_cache_config.0.data_cache_enabled", "true"), ), @@ -1794,7 +1800,19 @@ func TestAccSQLDatabaseInstance_sqlPostgresDataCacheConfig(t *testing.T) { ImportStateVerifyIgnore: []string{"deletion_protection"}, }, { - Config: testGoogleSqlDatabaseInstance_sqlPostgresDataCacheConfig(enterpriseInstanceName, enterpriseTier, "ENTERPRISE"), + Config: testGoogleSqlDatabaseInstance_sqlPostgresDataCacheConfig(enterprisePlusInstanceName, enterprisePlusTier, "ENTERPRISE_PLUS", false), + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("google_sql_database_instance.instance", "settings.0.data_cache_config.0.data_cache_enabled", "false"), + ), + }, + { + ResourceName: "google_sql_database_instance.instance", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"deletion_protection"}, + }, + { + Config: testGoogleSqlDatabaseInstance_sqlPostgresDataCacheConfig(enterpriseInstanceName, enterpriseTier, "ENTERPRISE", true), ExpectError: regexp.MustCompile( fmt.Sprintf("Error, failed to create instance %s: googleapi: Error 400: Invalid request: Only ENTERPRISE PLUS edition supports data cache", enterpriseInstanceName)), }, @@ -1824,7 +1842,7 @@ func TestAccSqlDatabaseInstance_Mysql_Edition_Upgrade(t *testing.T) { ImportStateVerifyIgnore: []string{"deletion_protection"}, }, { - Config: testGoogleSqlDatabaseInstance_sqlMysqlDataCacheConfig(editionUpgrade), + Config: testGoogleSqlDatabaseInstance_sqlMysqlDataCacheConfig(editionUpgrade, true), Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("google_sql_database_instance.instance", "settings.0.edition", "ENTERPRISE_PLUS"), resource.TestCheckResourceAttr("google_sql_database_instance.instance", "settings.0.data_cache_config.0.data_cache_enabled", "true"), @@ -2899,7 +2917,7 @@ resource "google_sql_database_instance" "instance" { }`, databaseName, tier) } -func testGoogleSqlDatabaseInstance_sqlMysqlDataCacheConfig(instanceName string) string { +func testGoogleSqlDatabaseInstance_sqlMysqlDataCacheConfig(instanceName string, datacache bool) string { return fmt.Sprintf(` resource "google_sql_database_instance" "instance" { @@ -2911,13 +2929,13 @@ resource "google_sql_database_instance" "instance" { tier = "db-perf-optimized-N-2" edition = "ENTERPRISE_PLUS" data_cache_config { - data_cache_enabled = true + data_cache_enabled = "%t" } } -}`, instanceName) +}`, instanceName, datacache) } -func testGoogleSqlDatabaseInstance_sqlPostgresDataCacheConfig(instanceName, tier, edition string) string { +func testGoogleSqlDatabaseInstance_sqlPostgresDataCacheConfig(instanceName, tier, edition string, datacache bool) string { return fmt.Sprintf(` resource "google_sql_database_instance" "instance" { @@ -2929,10 +2947,10 @@ resource "google_sql_database_instance" "instance" { tier = "%s" edition = "%s" data_cache_config { - data_cache_enabled = true + data_cache_enabled = "%t" } } -}`, instanceName, tier, edition) +}`, instanceName, tier, edition, datacache) } func testGoogleSqlDatabaseInstance_SqlServerTimezone(instance, rootPassword, timezone string) string { From 1faadb6e2dcb325c1724ef14090df9c69bd3360f Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:57:07 +0000 Subject: [PATCH 02/25] Make `private_endpoint_label` unique per test run of `TestAccOracleDatabaseAutonomousDatabase_oracledatabaseAutonomousDatabaseFullExample` (#12523) --- mmv1/products/oracledatabase/AutonomousDatabase.yaml | 2 ++ .../examples/oracledatabase_autonomous_database_full.tf.tmpl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mmv1/products/oracledatabase/AutonomousDatabase.yaml b/mmv1/products/oracledatabase/AutonomousDatabase.yaml index 5df6b386eb81..efac72d3178f 100644 --- a/mmv1/products/oracledatabase/AutonomousDatabase.yaml +++ b/mmv1/products/oracledatabase/AutonomousDatabase.yaml @@ -63,6 +63,7 @@ examples: project: 'my-project' autonomous_database_id: 'my-instance' database_name: 'mydatabase' + endpoint_name: 'myendpoint' deletion_protection: 'true' ignore_read_extra: - 'deletion_protection' @@ -70,6 +71,7 @@ examples: project: '"oci-terraform-testing"' deletion_protection: 'false' database_name: 'fmt.Sprintf("tftestdatabase%s", acctest.RandString(t, 10))' + endpoint_name: 'fmt.Sprintf("tftestendpoint%s", acctest.RandString(t, 10))' virtual_fields: - name: 'deletion_protection' type: Boolean diff --git a/mmv1/templates/terraform/examples/oracledatabase_autonomous_database_full.tf.tmpl b/mmv1/templates/terraform/examples/oracledatabase_autonomous_database_full.tf.tmpl index a24372b73635..37837ee9bc32 100644 --- a/mmv1/templates/terraform/examples/oracledatabase_autonomous_database_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/oracledatabase_autonomous_database_full.tf.tmpl @@ -29,7 +29,7 @@ resource "google_oracle_database_autonomous_database" "{{$.PrimaryResourceId}}"{ email = "xyz@example.com" } private_endpoint_ip = "10.5.0.11" - private_endpoint_label = "testhost" + private_endpoint_label = "{{index $.Vars "endpoint_name"}}" } deletion_protection = "{{index $.Vars "deletion_protection"}}" } From 0e2101b1e1865afc928ea557785f6bdd0ad77968 Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Wed, 11 Dec 2024 12:08:48 -0800 Subject: [PATCH 03/25] Marked failing dataproc GDC tests for skipping (#12542) --- mmv1/products/dataprocgdc/ApplicationEnvironment.yaml | 2 ++ mmv1/products/dataprocgdc/SparkApplication.yaml | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/mmv1/products/dataprocgdc/ApplicationEnvironment.yaml b/mmv1/products/dataprocgdc/ApplicationEnvironment.yaml index 1913e7a4498b..23c9f14f2aac 100644 --- a/mmv1/products/dataprocgdc/ApplicationEnvironment.yaml +++ b/mmv1/products/dataprocgdc/ApplicationEnvironment.yaml @@ -50,6 +50,7 @@ examples: project: "my-project" test_vars_overrides: 'project': '"gdce-cluster-monitoring"' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20419 - name: "dataprocgdc_applicationenvironment" primary_resource_id: "application-environment" vars: @@ -57,6 +58,7 @@ examples: project: "my-project" test_vars_overrides: 'project': '"gdce-cluster-monitoring"' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20419 update_verb: PATCH update_mask: true autogen_async: false diff --git a/mmv1/products/dataprocgdc/SparkApplication.yaml b/mmv1/products/dataprocgdc/SparkApplication.yaml index 55024aac6f31..92d81def627c 100644 --- a/mmv1/products/dataprocgdc/SparkApplication.yaml +++ b/mmv1/products/dataprocgdc/SparkApplication.yaml @@ -51,6 +51,7 @@ examples: project: "my-project" test_vars_overrides: 'project': '"gdce-cluster-monitoring"' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20418 - name: "dataprocgdc_sparkapplication" primary_resource_id: "spark-application" vars: @@ -59,6 +60,7 @@ examples: project: "my-project" test_vars_overrides: 'project': '"gdce-cluster-monitoring"' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20418 - name: "dataprocgdc_sparkapplication_pyspark" primary_resource_id: "spark-application" vars: @@ -66,6 +68,7 @@ examples: project: "my-project" test_vars_overrides: 'project': '"gdce-cluster-monitoring"' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20418 - name: "dataprocgdc_sparkapplication_sparkr" primary_resource_id: "spark-application" vars: @@ -73,6 +76,7 @@ examples: project: "my-project" test_vars_overrides: 'project': '"gdce-cluster-monitoring"' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20418 - name: "dataprocgdc_sparkapplication_sparksql" primary_resource_id: "spark-application" vars: @@ -80,6 +84,7 @@ examples: project: "my-project" test_vars_overrides: 'project': '"gdce-cluster-monitoring"' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20418 - name: "dataprocgdc_sparkapplication_sparksql_query_file" primary_resource_id: "spark-application" vars: @@ -87,6 +92,7 @@ examples: project: "my-project" test_vars_overrides: 'project': '"gdce-cluster-monitoring"' + skip_test: https://github.com/hashicorp/terraform-provider-google/issues/20418 base_url: projects/{{project}}/locations/{{location}}/serviceInstances/{{serviceinstance}}/sparkApplications create_url: projects/{{project}}/locations/{{location}}/serviceInstances/{{serviceinstance}}/sparkApplications?sparkApplicationId={{spark_application_id}} self_link: projects/{{project}}/locations/{{location}}/serviceInstances/{{serviceinstance}}/sparkApplications/{{spark_application_id}} From 904cffa35eb0843b9e593fef0b151f5c6d41e3e9 Mon Sep 17 00:00:00 2001 From: Damon Date: Wed, 11 Dec 2024 12:59:51 -0800 Subject: [PATCH 04/25] Fix IAM role race condition (#12467) --- .../resource_dataflow_flex_template_job_test.go.tmpl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.tmpl b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.tmpl index a8d095fe46f7..917f1b8a674d 100644 --- a/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataflow/resource_dataflow_flex_template_job_test.go.tmpl @@ -136,6 +136,9 @@ func TestAccDataflowFlexTemplateJob_FullUpdate(t *testing.T) { PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), + ExternalProviders: map[string]resource.ExternalProvider{ + "time": {}, + }, Steps: []resource.TestStep{ { Config: testAccDataflowFlexTemplateJob_dataflowFlexTemplateJobFull(job, bucket, topic, randStr), @@ -870,7 +873,13 @@ resource "google_storage_bucket_object" "schema" { EOF } +resource "time_sleep" "wait_bind_iam_roles" { + depends_on = [google_project_iam_member.dataflow-worker, google_project_iam_member.dataflow-storage] + create_duration = "300s" +} + resource "google_dataflow_flex_template_job" "flex_job_fullupdate" { + depends_on = [time_sleep.wait_bind_iam_roles] name = "%s" container_spec_gcs_path = "gs://${data.google_storage_bucket_object.flex_template.bucket}/${data.google_storage_bucket_object.flex_template.name}" on_delete = "cancel" From 85d05029ab559f03b4c8cdfc199bd70a25a25618 Mon Sep 17 00:00:00 2001 From: Will Yardley Date: Wed, 11 Dec 2024 13:02:35 -0800 Subject: [PATCH 05/25] compute: added `subnetwork_id` to compute subnet data source (#12461) --- .../compute/data_source_google_compute_subnetwork.go.tmpl | 8 ++++++++ .../compute/data_source_google_compute_subnetwork_test.go | 1 + .../website/docs/d/compute_subnetwork.html.markdown | 2 ++ 3 files changed, 11 insertions(+) diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork.go.tmpl b/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork.go.tmpl index 4315751f0b08..cfd54e7e8895 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork.go.tmpl @@ -31,6 +31,10 @@ func DataSourceGoogleComputeSubnetwork() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "subnetwork_id": { + Type: schema.TypeInt, + Computed: true, + }, "ip_cidr_range": { Type: schema.TypeString, Computed: true, @@ -100,6 +104,10 @@ func dataSourceGoogleComputeSubnetworkRead(d *schema.ResourceData, meta interfac return transport_tpg.HandleDataSourceNotFoundError(err, d, fmt.Sprintf("Subnetwork Not Found : %s", name), id) } + if err := d.Set("subnetwork_id", subnetwork.Id); err != nil { + return fmt.Errorf("Error setting subnetwork_id: %s", err) + } + if err := d.Set("ip_cidr_range", subnetwork.IpCidrRange); err != nil { return fmt.Errorf("Error setting ip_cidr_range: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork_test.go index 4b7f39a5979a..a2e2d293c8c8 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_subnetwork_test.go @@ -47,6 +47,7 @@ func testAccDataSourceGoogleSubnetworkCheck(data_source_name string, resource_na "id", "name", "description", + "subnetwork_id", "ip_cidr_range", "private_ip_google_access", "internal_ipv6_prefix", diff --git a/mmv1/third_party/terraform/website/docs/d/compute_subnetwork.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_subnetwork.html.markdown index 3a2b43e35fdc..34e8b5f4f3a0 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_subnetwork.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_subnetwork.html.markdown @@ -40,6 +40,8 @@ In addition to the arguments listed above, the following attributes are exported * `network` - The network name or resource link to the parent network of this subnetwork. +* `subnetwork_id` - The numeric ID of the resource. + * `description` - Description of this subnetwork. * `ip_cidr_range` - The IP address range that machines in this From ea2e527d54d8e3558ccae91cf8b28684e3c47330 Mon Sep 17 00:00:00 2001 From: Will Yardley Date: Wed, 11 Dec 2024 13:41:59 -0800 Subject: [PATCH 06/25] refactor: resolve downstream gosimple warnings (#12539) --- .../universe/universe_domain_compute_test.go | 6 ++--- .../universe/universe_domain_pubsub_test.go | 2 +- .../universe/universe_domain_storage_test.go | 2 +- ..._bigtable_authorized_view_internal_test.go | 26 +++++++++---------- .../bigtable/resource_bigtable_gc_policy.go | 2 -- ...esource_bigtable_instance_internal_test.go | 2 +- .../bigtable/resource_bigtable_table.go | 2 +- .../services/container/node_config.go.tmpl | 6 ++--- .../netapp/resource_netapp_volume_test.go | 4 +-- ...esource_tags_location_tag_bindings.go.tmpl | 1 - tpgtools/documentation.go | 2 +- tpgtools/sample.go | 2 +- tpgtools/templates/resource.go.tmpl | 6 ++--- 13 files changed, 29 insertions(+), 34 deletions(-) diff --git a/mmv1/third_party/terraform/provider/universe/universe_domain_compute_test.go b/mmv1/third_party/terraform/provider/universe/universe_domain_compute_test.go index 8ea474505ac4..ea2703508e3b 100644 --- a/mmv1/third_party/terraform/provider/universe/universe_domain_compute_test.go +++ b/mmv1/third_party/terraform/provider/universe/universe_domain_compute_test.go @@ -26,7 +26,7 @@ func TestAccUniverseDomainDisk(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccUniverseDomain_basic_disk(universeDomain), }, }, @@ -41,7 +41,7 @@ func TestAccDefaultUniverseDomainDisk(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComputeDiskDestroyProducer(t), Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccUniverseDomain_basic_disk(universeDomain), }, }, @@ -55,7 +55,7 @@ func TestAccDefaultUniverseDomain_doesNotMatchExplicit(t *testing.T) { PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccUniverseDomain_basic_disk(universeDomainFake), ExpectError: regexp.MustCompile("Universe domain mismatch"), }, diff --git a/mmv1/third_party/terraform/provider/universe/universe_domain_pubsub_test.go b/mmv1/third_party/terraform/provider/universe/universe_domain_pubsub_test.go index 92a55e5d2b72..09fbfd05baa7 100644 --- a/mmv1/third_party/terraform/provider/universe/universe_domain_pubsub_test.go +++ b/mmv1/third_party/terraform/provider/universe/universe_domain_pubsub_test.go @@ -27,7 +27,7 @@ func TestAccUniverseDomainPubSub(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccUniverseDomain_basic_pubsub(universeDomain, topic, subscription), }, }, diff --git a/mmv1/third_party/terraform/provider/universe/universe_domain_storage_test.go b/mmv1/third_party/terraform/provider/universe/universe_domain_storage_test.go index 889edc716a57..259fe944968c 100644 --- a/mmv1/third_party/terraform/provider/universe/universe_domain_storage_test.go +++ b/mmv1/third_party/terraform/provider/universe/universe_domain_storage_test.go @@ -24,7 +24,7 @@ func TestAccUniverseDomainStorage(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccStorageBucketDestroyProducer(t), Steps: []resource.TestStep{ - resource.TestStep{ + { Config: testAccUniverseDomain_bucket(universeDomain, bucketName), }, }, diff --git a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_authorized_view_internal_test.go b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_authorized_view_internal_test.go index 7b431838426b..9168bcc380e4 100644 --- a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_authorized_view_internal_test.go +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_authorized_view_internal_test.go @@ -18,7 +18,7 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) { "empty subset view": { sv: bigtable.SubsetViewInfo{}, want: []map[string]interface{}{ - map[string]interface{}{}, + {}, }, orWant: nil, }, @@ -27,7 +27,7 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) { RowPrefixes: [][]byte{[]byte("row1"), []byte("row2")}, }, want: []map[string]interface{}{ - map[string]interface{}{ + { "row_prefixes": []string{"cm93MQ==", "cm93Mg=="}, }, }, @@ -45,12 +45,12 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) { }, }, want: []map[string]interface{}{ - map[string]interface{}{ + { "family_subsets": []map[string]interface{}{ - map[string]interface{}{ + { "family_name": "fam1", "qualifier_prefixes": []string{"Y29s"}, - }, map[string]interface{}{ + }, { "family_name": "fam2", "qualifiers": []string{"Y29sMQ==", "Y29sMg=="}, }, @@ -58,13 +58,13 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) { }, }, orWant: []map[string]interface{}{ - map[string]interface{}{ + { "family_subsets": []map[string]interface{}{ - map[string]interface{}{ + { "family_name": "fam2", "qualifiers": []string{"Y29sMQ==", "Y29sMg=="}, }, - map[string]interface{}{ + { "family_name": "fam1", "qualifier_prefixes": []string{"Y29s"}, }, @@ -81,9 +81,9 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) { }, }, want: []map[string]interface{}{ - map[string]interface{}{ + { "family_subsets": []map[string]interface{}{ - map[string]interface{}{ + { "family_name": "fam", "qualifiers": []string{"Y29s"}, }, @@ -101,9 +101,9 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) { }, }, want: []map[string]interface{}{ - map[string]interface{}{ + { "family_subsets": []map[string]interface{}{ - map[string]interface{}{ + { "family_name": "fam", "qualifier_prefixes": []string{"Y29s"}, }, @@ -118,7 +118,7 @@ func TestUnitBigtable_flattenSubsetViewInfo(t *testing.T) { FamilySubsets: map[string]bigtable.FamilySubset{}, }, want: []map[string]interface{}{ - map[string]interface{}{}, + {}, }, orWant: nil, }, diff --git a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy.go b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy.go index c9d710371664..dfad246c917d 100644 --- a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy.go +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_gc_policy.go @@ -402,7 +402,6 @@ func GcPolicyToGCRuleString(gc bigtable.GCPolicy, topLevel bool) (map[string]int } else { result["max_version"] = version } - break case bigtable.PolicyUnion: result["mode"] = "union" rules := []interface{}{} @@ -414,7 +413,6 @@ func GcPolicyToGCRuleString(gc bigtable.GCPolicy, topLevel bool) (map[string]int rules = append(rules, gcRuleString) } result["rules"] = rules - break case bigtable.PolicyIntersection: result["mode"] = "intersection" rules := []interface{}{} diff --git a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_internal_test.go b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_internal_test.go index 6d0b26f61f76..7490932c314b 100644 --- a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_internal_test.go +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_instance_internal_test.go @@ -160,7 +160,7 @@ func TestUnitBigtable_flattenBigtableCluster(t *testing.T) { "kms_key_name": "KMS", "state": "CREATING", "autoscaling_config": []map[string]interface{}{ - map[string]interface{}{ + { "min_nodes": 3, "max_nodes": 7, "cpu_target": 50, diff --git a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table.go b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table.go index 3cd659cb58d7..453e68790a49 100644 --- a/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table.go +++ b/mmv1/third_party/terraform/services/bigtable/resource_bigtable_table.go @@ -457,7 +457,7 @@ func resourceBigtableTableUpdate(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error creating column family %q: %s", cfn, err) } } - for cfn, _ := range familyMapDiffKeys(oMap, nMap) { + for cfn := range familyMapDiffKeys(oMap, nMap) { log.Printf("[DEBUG] removing column family %q", cfn) if err := c.DeleteColumnFamily(ctx, name, cfn); err != nil { return fmt.Errorf("Error deleting column family %q: %s", cfn, err) diff --git a/mmv1/third_party/terraform/services/container/node_config.go.tmpl b/mmv1/third_party/terraform/services/container/node_config.go.tmpl index af01c0d42d65..6b54e3a49c95 100644 --- a/mmv1/third_party/terraform/services/container/node_config.go.tmpl +++ b/mmv1/third_party/terraform/services/container/node_config.go.tmpl @@ -1601,10 +1601,8 @@ func flattenResourceManagerTags(c *container.ResourceManagerTags) map[string]int rmt := make(map[string]interface{}) - if c != nil { - for k, v := range c.Tags { - rmt[k] = v - } + for k, v := range c.Tags { + rmt[k] = v } return rmt diff --git a/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_test.go b/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_test.go index 45f465ce0797..6925ec048983 100644 --- a/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_test.go +++ b/mmv1/third_party/terraform/services/netapp/resource_netapp_volume_test.go @@ -618,7 +618,7 @@ func testAccNetappVolume_volumeBasicExample_cleanupScheduledBackup(t *testing.T, createTime time.Time } var backupDataList []BackupData - for i, _ := range backups { + for i := range backups { backup := backups[i].(map[string]interface{}) backupName := backup["name"].(string) backupCreateTimeStr := backup["createTime"].(string) @@ -635,7 +635,7 @@ func testAccNetappVolume_volumeBasicExample_cleanupScheduledBackup(t *testing.T, sort.Slice(backupDataList, func(i, j int) bool { return backupDataList[i].createTime.After(backupDataList[j].createTime) }) - for i, _ := range backupDataList { + for i := range backupDataList { baseUrl, err := tpgresource.ReplaceVarsForTest(config, rs, "{{NetappBasePath}}") if err != nil { return fmt.Errorf("Error : %v", err) diff --git a/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_bindings.go.tmpl b/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_bindings.go.tmpl index d05333b94808..c729994f45b5 100644 --- a/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_bindings.go.tmpl +++ b/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_bindings.go.tmpl @@ -352,7 +352,6 @@ func flattenNestedTagsLocationTagBinding(d *schema.ResourceData, meta interface{ switch v.(type) { case []interface{}: log.Printf("[DEBUG] Hey it's in break = %#v,)", v) - break case map[string]interface{}: // Construct list out of single nested resource v = []interface{}{v} diff --git a/tpgtools/documentation.go b/tpgtools/documentation.go index 25c225817d00..aaa8c12eb43c 100644 --- a/tpgtools/documentation.go +++ b/tpgtools/documentation.go @@ -69,7 +69,7 @@ func mergeProperties(ga, beta []Property) []Property { betaProps[p.title] = p } inOrder := make([]string, 0) - for k, _ := range betaProps { + for k := range betaProps { inOrder = append(inOrder, k) } sort.Strings(inOrder) diff --git a/tpgtools/sample.go b/tpgtools/sample.go index c934575ea8bd..337776018744 100644 --- a/tpgtools/sample.go +++ b/tpgtools/sample.go @@ -161,7 +161,7 @@ func findDCLReferencePackage(product SnakeCaseProductName) (DCLPackageName, erro // Otherwise, just return an error. var productOverrideKeys []Filepath - for k, _ := range productOverrides { + for k := range productOverrides { productOverrideKeys = append(productOverrideKeys, k) } return DCLPackageName(""), fmt.Errorf("can't find %q in the overrides map, which contains %v", product, productOverrideKeys) diff --git a/tpgtools/templates/resource.go.tmpl b/tpgtools/templates/resource.go.tmpl index b65085ba771f..4b58719bac91 100644 --- a/tpgtools/templates/resource.go.tmpl +++ b/tpgtools/templates/resource.go.tmpl @@ -792,7 +792,7 @@ func flatten{{$.PathType}}Labels(v map[string]string, d *schema.ResourceData) in transformed := make(map[string]interface{}) if l, ok := d.Get("labels").(map[string]interface{}); ok { - for k, _ := range l { + for k := range l { transformed[k] = v[k] } } @@ -807,7 +807,7 @@ func flatten{{$.PathType}}TerraformLabels(v map[string]string, d *schema.Resourc transformed := make(map[string]interface{}) if l, ok := d.Get("terraform_labels").(map[string]interface{}); ok { - for k, _ := range l { + for k := range l { transformed[k] = v[k] } } @@ -824,7 +824,7 @@ func flatten{{$.PathType}}Annotations(v map[string]string, d *schema.ResourceDat transformed := make(map[string]interface{}) if l, ok := d.Get("annotations").(map[string]interface{}); ok { - for k, _ := range l { + for k := range l { transformed[k] = v[k] } } From 5c6b808540e627bfb4099550b07ad740872a1e4e Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Wed, 11 Dec 2024 14:45:14 -0800 Subject: [PATCH 07/25] Update membership_data.go (#12545) --- .ci/magician/github/membership_data.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/magician/github/membership_data.go b/.ci/magician/github/membership_data.go index a1443f58c99e..23043482634c 100644 --- a/.ci/magician/github/membership_data.go +++ b/.ci/magician/github/membership_data.go @@ -57,8 +57,8 @@ var ( }, { id: "melinath", - startDate: newDate(2024, 9, 18, pdtLoc), - endDate: newDate(2024, 9, 23, pdtLoc), + startDate: newDate(2024, 12, 19, pdtLoc), + endDate: newDate(2025, 1, 7, pdtLoc), }, { id: "slevenick", From eaecd07b1c667ba20bc0f95a807169a57f04dc0d Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Thu, 12 Dec 2024 08:22:46 -0800 Subject: [PATCH 08/25] Removed TestAccComposer1Environment_withNodeConfig (#12544) --- ...resource_composer_environment_test.go.tmpl | 100 ------------------ 1 file changed, 100 deletions(-) diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.tmpl b/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.tmpl index b3dc586c9e2e..a236947c3b16 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/resource_composer_environment_test.go.tmpl @@ -760,43 +760,6 @@ func TestAccComposerEnvironment_composerV2MasterAuthNetworksUpdate(t *testing.T) }) } -func TestAccComposer1Environment_withNodeConfig(t *testing.T) { - t.Parallel() - - envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, acctest.RandInt(t)) - network := fmt.Sprintf("%s-%d", testComposerNetworkPrefix, acctest.RandInt(t)) - subnetwork := network + "-1" - serviceAccount := fmt.Sprintf("tf-test-%d", acctest.RandInt(t)) - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccComposerEnvironmentDestroyProducer(t), - ExternalProviders: map[string]resource.ExternalProvider{ - "time": {}, - }, - Steps: []resource.TestStep{ - { - Config: testAccComposer1Environment_nodeCfg(envName, network, subnetwork, serviceAccount), - }, - { - ResourceName: "google_composer_environment.test", - ImportState: true, - ImportStateVerify: true, - }, - // This is a terrible clean-up step in order to get destroy to succeed, - // due to dangling firewall rules left by the Composer Environment blocking network deletion. - // TODO: Remove this check if firewall rules bug gets fixed by Composer. - { - PlanOnly: true, - ExpectNonEmptyPlan: false, - Config: testAccComposer1Environment_nodeCfg(envName, network, subnetwork, serviceAccount), - Check: testAccCheckClearComposerEnvironmentFirewalls(t, network), - }, - }, - }) -} - func TestAccComposer2Environment_withNodeConfig(t *testing.T) { t.Parallel() @@ -2510,69 +2473,6 @@ resource "google_compute_subnetwork" "test" { `, name, network, subnetwork) } -func testAccComposer1Environment_nodeCfg(environment, network, subnetwork, serviceAccount string) string { - return fmt.Sprintf(` -data "google_project" "project" {} - -resource "google_composer_environment" "test" { - name = "%s" - region = "us-central1" - config { - node_config { - network = google_compute_network.test.self_link - subnetwork = google_compute_subnetwork.test.self_link - zone = "us-central1-a" - - service_account = google_service_account.test.name -{{- if ne $.TargetVersionName "ga" }} - max_pods_per_node = 33 -{{- end }} - ip_allocation_policy { - use_ip_aliases = true - cluster_ipv4_cidr_block = "10.0.0.0/16" - } - tags = toset(["t1", "t2"]) - machine_type = "n2-highcpu-2" - disk_size_gb = 20 - oauth_scopes = toset(["https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/bigquery"]) - } - software_config { - image_version = "composer-1-airflow-2" - } - } - depends_on = [time_sleep.wait_3_minutes] -} - -resource "google_compute_network" "test" { - name = "%s" - auto_create_subnetworks = false -} - -resource "google_compute_subnetwork" "test" { - name = "%s" - ip_cidr_range = "10.2.0.0/16" - region = "us-central1" - network = google_compute_network.test.self_link -} - -resource "time_sleep" "wait_3_minutes" { - depends_on = [google_project_iam_member.composer-worker] - create_duration = "3m" -} - -resource "google_service_account" "test" { - account_id = "%s" - display_name = "Test Service Account for Composer Environment" -} - -resource "google_project_iam_member" "composer-worker" { - project = data.google_project.project.project_id - role = "roles/composer.worker" - member = "serviceAccount:${google_service_account.test.email}" -} -`, environment, network, subnetwork, serviceAccount) -} - func testAccComposer2Environment_nodeCfg(environment, network, subnetwork, serviceAccount string) string { return fmt.Sprintf(` data "google_project" "project" {} From dd1aae63d3f051ff455c211e7d5ac5175864c7ac Mon Sep 17 00:00:00 2001 From: KamiBruin Date: Thu, 12 Dec 2024 08:28:44 -0800 Subject: [PATCH 09/25] =?UTF-8?q?Fixes=20documentation=20of=20vpc=5Fip=5Fs?= =?UTF-8?q?ubnetworks=20in=20google=5Faccess=5Fcontext=5Fma=E2=80=A6=20(#1?= =?UTF-8?q?2333)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kaiming Wang --- mmv1/products/accesscontextmanager/AccessLevel.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/accesscontextmanager/AccessLevel.yaml b/mmv1/products/accesscontextmanager/AccessLevel.yaml index 9d476ddf4221..98ddda93908f 100644 --- a/mmv1/products/accesscontextmanager/AccessLevel.yaml +++ b/mmv1/products/accesscontextmanager/AccessLevel.yaml @@ -275,7 +275,7 @@ properties: required: true - name: 'vpcIpSubnetworks' type: Array - description: 'CIDR block IP subnetwork specification. Must be IPv4.' + description: 'A list of CIDR block IP subnetwork specification. Must be IPv4.' item_type: type: String min_size: 1 From 4c90928a4efbfeaecf1babdf5a3ac524a2554981 Mon Sep 17 00:00:00 2001 From: nityaravi <32396647+nityaravi@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:04:07 -0500 Subject: [PATCH 10/25] Updates for b/382524574 (#12554) Co-authored-by: Stephen Lewis (Burrows) --- docs/content/breaking-changes/_index.md | 2 +- docs/content/breaking-changes/make-a-breaking-change.md | 2 +- docs/content/develop/add-fields.md | 2 +- docs/content/develop/add-handwritten-datasource.md | 2 +- docs/content/develop/add-iam-support.md | 6 +++--- docs/content/develop/add-resource.md | 2 +- docs/content/develop/custom-code.md | 2 +- docs/content/document/_index.md | 4 ++++ docs/content/{develop => document}/add-documentation.md | 6 ++++-- .../{develop => document}/handwritten-docs-style-guide.md | 4 +++- 10 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 docs/content/document/_index.md rename docs/content/{develop => document}/add-documentation.md (94%) rename docs/content/{develop => document}/handwritten-docs-style-guide.md (98%) diff --git a/docs/content/breaking-changes/_index.md b/docs/content/breaking-changes/_index.md index 4602f5421491..b40ee5dc5a81 100644 --- a/docs/content/breaking-changes/_index.md +++ b/docs/content/breaking-changes/_index.md @@ -1,4 +1,4 @@ --- title: "Breaking changes" -weight: 45 +weight: 46 --- diff --git a/docs/content/breaking-changes/make-a-breaking-change.md b/docs/content/breaking-changes/make-a-breaking-change.md index 11233dc42981..d9d3a8c82e77 100644 --- a/docs/content/breaking-changes/make-a-breaking-change.md +++ b/docs/content/breaking-changes/make-a-breaking-change.md @@ -116,7 +116,7 @@ The deprecation message will automatically show up in the resource documentation ``` Replace the second sentence with an appropriate short description of the replacement path and/or the reason for deprecation. -2. Update the [documentation for the field]({{< ref "/develop/add-documentation" >}}) to include the deprecation notice. For example: +2. Update the [documentation for the field]({{< ref "/document/add-documentation" >}}) to include the deprecation notice. For example: ```markdown * `api_field_name` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Deprecated) FIELD_DESCRIPTION. `api_field_name` is deprecated and will be removed in a future major release. Use `other_field_name` instead. diff --git a/docs/content/develop/add-fields.md b/docs/content/develop/add-fields.md index 0f6f9875c3d0..0e3234ffbdc9 100644 --- a/docs/content/develop/add-fields.md +++ b/docs/content/develop/add-fields.md @@ -210,7 +210,7 @@ For `key_name` and `key_description`, provide a domain-appropriate name and desc ## What's next? + [Add IAM support]({{< ref "/develop/add-iam-support" >}}) -+ [Add documentation]({{< ref "/develop/add-documentation" >}}) ++ [Add documentation]({{< ref "/document/add-documentation" >}}) + [Add custom resource code]({{< ref "/develop/custom-code" >}}) + [Add tests]({{< ref "/test/test" >}}) + [Run tests]({{< ref "/test/run-tests" >}}) diff --git a/docs/content/develop/add-handwritten-datasource.md b/docs/content/develop/add-handwritten-datasource.md index 173a7acb1e5d..3b798ef862d2 100644 --- a/docs/content/develop/add-handwritten-datasource.md +++ b/docs/content/develop/add-handwritten-datasource.md @@ -51,6 +51,6 @@ library, or the raw HTTP client used in MMV1 through `SendRequest`. 1. Open the data source documentation in [`magic-modules/third_party/terraform/website/docs/d/`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/d) using an editor of your choice. - The name of the file is the name of the data source without a `google_` prefix. For example, for `google_compute_instance`, the file is called `compute_instance.html.markdown` -2. Modify the documentation as needed according to [Handwritten documentation style guide]({{< ref "/develop/handwritten-docs-style-guide" >}}). +2. Modify the documentation as needed according to [Handwritten documentation style guide]({{< ref "/document/handwritten-docs-style-guide" >}}). 4. [Generate the providers]({{< ref "/develop/generate-providers" >}}) 5. Copy and paste the generated documentation into the Hashicorp Registry's [Doc Preview Tool](https://registry.terraform.io/tools/doc-preview) to see how it is rendered. diff --git a/docs/content/develop/add-iam-support.md b/docs/content/develop/add-iam-support.md index 28527343659e..8b39abe7d88d 100644 --- a/docs/content/develop/add-iam-support.md +++ b/docs/content/develop/add-iam-support.md @@ -68,7 +68,7 @@ iam_policy: ### Add support in MMv1 -1. Follow the MMv1 directions in [Add a resource]({{}}) to create a skeleton ResourceName.yaml file for the handwritten resource, but set only the following top-level fields: +1. Follow the MMv1 directions in [Add a resource]({{}}) to create a skeleton ResourceName.yaml file for the handwritten resource, but set only the following top-level fields: - `name` - `description` (required but unused) - `base_url` (set to URL of IAM parent resource) @@ -112,7 +112,7 @@ Documentation is autogenerated based on the resource and field configurations. T 1. Open the resource documentation in [`magic-modules/third_party/terraform/website/docs/r/`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) using an editor of your choice. - The name of the file is the name of the resource without a `google_` prefix. For example, for `google_compute_instance`, the file is called `compute_instance.html.markdown` -2. Modify the documentation as needed according to [Handwritten documentation style guide]({{< ref "/develop/handwritten-docs-style-guide" >}}). +2. Modify the documentation as needed according to [Handwritten documentation style guide]({{< ref "/document/handwritten-docs-style-guide" >}}). 3. [Generate the providers]({{< ref "/develop/generate-providers" >}}) 4. Copy and paste the generated documentation into the Hashicorp Registry's [Doc Preview Tool](https://registry.terraform.io/tools/doc-preview) to see how it is rendered. {{< /tab >}} @@ -120,7 +120,7 @@ Documentation is autogenerated based on the resource and field configurations. T ## What's next? -+ [Add documentation]({{< ref "/develop/add-documentation" >}}) ++ [Add documentation]({{< ref "/document/add-documentation" >}}) + [Add custom resource code]({{< ref "/develop/custom-code" >}}) + [Add tests]({{< ref "/test/test" >}}) + [Run tests]({{< ref "/test/run-tests" >}}) diff --git a/docs/content/develop/add-resource.md b/docs/content/develop/add-resource.md index 10fdea0d6cf6..cfc03f132c33 100644 --- a/docs/content/develop/add-resource.md +++ b/docs/content/develop/add-resource.md @@ -178,7 +178,7 @@ For more information about types of resources and the generation process overall + [Add a field to an existing resource]({{< ref "/develop/add-fields" >}}) + [Add IAM support]({{< ref "/develop/add-iam-support" >}}) -+ [Add documentation]({{< ref "/develop/add-documentation" >}}) ++ [Add documentation]({{< ref "/document/add-documentation" >}}) + [Add custom resource code]({{< ref "/develop/custom-code" >}}) + [Add tests]({{< ref "/test/test" >}}) + [Run tests]({{< ref "/test/run-tests" >}}) diff --git a/docs/content/develop/custom-code.md b/docs/content/develop/custom-code.md index e1d19d37caf9..5e9254efd8d4 100644 --- a/docs/content/develop/custom-code.md +++ b/docs/content/develop/custom-code.md @@ -264,7 +264,7 @@ docs: * `FIELD_NAME` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) FIELD_DESCRIPTION ``` -See [Add documentation (Handwritten)]({{< ref "/develop/add-documentation" >}}) for more information about what to include in the field documentation. +See [Add documentation (Handwritten)]({{< ref "/document/add-documentation" >}}) for more information about what to include in the field documentation. ## What's next? diff --git a/docs/content/document/_index.md b/docs/content/document/_index.md new file mode 100644 index 000000000000..b8be1d6b2f1b --- /dev/null +++ b/docs/content/document/_index.md @@ -0,0 +1,4 @@ +--- +title: "Document" +weight: 45 +--- \ No newline at end of file diff --git a/docs/content/develop/add-documentation.md b/docs/content/document/add-documentation.md similarity index 94% rename from docs/content/develop/add-documentation.md rename to docs/content/document/add-documentation.md index ab7898e3da94..3bc4c529b536 100644 --- a/docs/content/develop/add-documentation.md +++ b/docs/content/document/add-documentation.md @@ -1,6 +1,8 @@ --- title: "Add documentation" -weight: 50 +weight: 10 +aliases: + - /develop/add-documentation --- # Add documentation @@ -37,7 +39,7 @@ To preview the documentation: 1. Open the resource documentation in [`magic-modules/third_party/terraform/website/docs/r/`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) using an editor of your choice. - The name of the file is the name of the resource without a `google_` prefix. For example, for `google_compute_instance`, the file is called `compute_instance.html.markdown` -2. Modify the documentation as needed according to [Handwritten documentation style guide]({{< ref "/develop/handwritten-docs-style-guide" >}}). +2. Modify the documentation as needed according to [Handwritten documentation style guide]({{< ref "/document/handwritten-docs-style-guide" >}}). 3. [Generate the providers]({{< ref "/develop/generate-providers" >}}) 4. Copy and paste the generated documentation into the Hashicorp Registry's [Doc Preview Tool](https://registry.terraform.io/tools/doc-preview) to see how it is rendered. {{< /tab >}} diff --git a/docs/content/develop/handwritten-docs-style-guide.md b/docs/content/document/handwritten-docs-style-guide.md similarity index 98% rename from docs/content/develop/handwritten-docs-style-guide.md rename to docs/content/document/handwritten-docs-style-guide.md index 4dd7eb54fbc7..d3f093594fd0 100644 --- a/docs/content/develop/handwritten-docs-style-guide.md +++ b/docs/content/document/handwritten-docs-style-guide.md @@ -1,6 +1,8 @@ --- title: Handwritten docs style guide -weight: 140 +weight: 20 +aliases: + - /develop/handwritten-docs-style-guide --- # Handwritten documentation style guide From 3b4140704b27c4bcecf83f1b37158e97aa34e300 Mon Sep 17 00:00:00 2001 From: Will Yardley Date: Thu, 12 Dec 2024 09:06:58 -0800 Subject: [PATCH 11/25] Fixes typos and misspellings (#12543) --- mmv1/products/dialogflowcx/Agent.yaml | 2 +- mmv1/products/firebasehosting/CustomDomain.yaml | 2 +- mmv1/products/firestore/Database.yaml | 2 +- mmv1/products/integrationconnectors/Connection.yaml | 2 +- .../terraform/custom_expand/empty_object_if_set.go.tmpl | 2 +- .../terraform/fwvalidators/framework_validators_test.go | 2 +- .../alloydb/resource_alloydb_secondary_cluster_test.go | 2 +- .../services/bigquery/resource_bigquery_table_test.go | 4 ++-- .../services/compute/compute_instance_helpers.go.tmpl | 2 +- .../services/compute/resource_compute_network_test.go.tmpl | 6 +++--- .../data_source_secret_manager_secrets_test.go | 2 +- .../services/sql/data_source_sql_database_instances_test.go | 4 ++-- .../services/sql/data_source_sql_databases_test.go | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/mmv1/products/dialogflowcx/Agent.yaml b/mmv1/products/dialogflowcx/Agent.yaml index 8d3f2b006552..ef9fe6f7e087 100644 --- a/mmv1/products/dialogflowcx/Agent.yaml +++ b/mmv1/products/dialogflowcx/Agent.yaml @@ -164,7 +164,7 @@ properties: - name: 'useTimeoutBasedEndpointing' type: Boolean description: | - Use timeout based endpointing, interpreting endpointer sensitivy as seconds of timeout value. + Use timeout based endpointing, interpreting endpointer sensitivity as seconds of timeout value. - name: 'models' type: KeyValuePairs description: | diff --git a/mmv1/products/firebasehosting/CustomDomain.yaml b/mmv1/products/firebasehosting/CustomDomain.yaml index 286ff29717d7..26541ebb608d 100644 --- a/mmv1/products/firebasehosting/CustomDomain.yaml +++ b/mmv1/products/firebasehosting/CustomDomain.yaml @@ -555,7 +555,7 @@ properties: - name: 'reconciling' type: Boolean description: | - if true, indicates that Hosting's systems are attmepting to + if true, indicates that Hosting's systems are attempting to make the `CustomDomain`'s state match your preferred state. This is most frequently `true` when initially provisioning a `CustomDomain` or when creating a new SSL certificate to match an updated `cert_preference` diff --git a/mmv1/products/firestore/Database.yaml b/mmv1/products/firestore/Database.yaml index 2925c054d8cd..ec8c89a9de18 100644 --- a/mmv1/products/firestore/Database.yaml +++ b/mmv1/products/firestore/Database.yaml @@ -274,7 +274,7 @@ properties: This value should be the KMS key resource ID in the format of `projects/{project_id}/locations/{kms_location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}`. - How to retrive this resource ID is listed at + How to retrieve this resource ID is listed at https://cloud.google.com/kms/docs/getting-resource-ids#getting_the_id_for_a_key_and_version. required: true immutable: true diff --git a/mmv1/products/integrationconnectors/Connection.yaml b/mmv1/products/integrationconnectors/Connection.yaml index 30221bc7c78a..da85803f02a9 100644 --- a/mmv1/products/integrationconnectors/Connection.yaml +++ b/mmv1/products/integrationconnectors/Connection.yaml @@ -137,7 +137,7 @@ properties: - name: 'description' type: String description: | - An arbitrary description for the Conection. + An arbitrary description for the Connection. - name: 'labels' type: KeyValueLabels description: | diff --git a/mmv1/templates/terraform/custom_expand/empty_object_if_set.go.tmpl b/mmv1/templates/terraform/custom_expand/empty_object_if_set.go.tmpl index 7bd0c2ac381c..bec0dc3e6f13 100644 --- a/mmv1/templates/terraform/custom_expand/empty_object_if_set.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/empty_object_if_set.go.tmpl @@ -1,7 +1,7 @@ /* * Expands an empty terraform config into an empty object. * - * Used to differentate a user specifying an empty block versus a null/unset block. + * Used to differentiate a user specifying an empty block versus a null/unset block. * * This is unique from send_empty_value, which will send an explicit null value * for empty configuration blocks. diff --git a/mmv1/third_party/terraform/fwvalidators/framework_validators_test.go b/mmv1/third_party/terraform/fwvalidators/framework_validators_test.go index 6aa1a0c558a3..07e2378e8bf3 100644 --- a/mmv1/third_party/terraform/fwvalidators/framework_validators_test.go +++ b/mmv1/third_party/terraform/fwvalidators/framework_validators_test.go @@ -25,7 +25,7 @@ func TestFrameworkProvider_CredentialsValidator(t *testing.T) { "configuring credentials as a path to a credentials JSON file is valid": { ConfigValue: types.StringValue(transport_tpg.TestFakeCredentialsPath), // Path to a test fixture }, - "configuring credentials as a path to a non-existant file is NOT valid": { + "configuring credentials as a path to a non-existent file is NOT valid": { ConfigValue: types.StringValue("./this/path/doesnt/exist.json"), // Doesn't exist ExpectedErrorCount: 1, }, diff --git a/mmv1/third_party/terraform/services/alloydb/resource_alloydb_secondary_cluster_test.go b/mmv1/third_party/terraform/services/alloydb/resource_alloydb_secondary_cluster_test.go index 6bb2ff2ab9b2..470a1ef6e7ed 100644 --- a/mmv1/third_party/terraform/services/alloydb/resource_alloydb_secondary_cluster_test.go +++ b/mmv1/third_party/terraform/services/alloydb/resource_alloydb_secondary_cluster_test.go @@ -1229,7 +1229,7 @@ data "google_compute_global_address" "private_ip_alloc" { `, context) } -// This test passes if automated backup policy and inital user can be added and deleted from the promoted secondary cluster +// This test passes if automated backup policy and initial user can be added and deleted from the promoted secondary cluster func TestAccAlloydbCluster_secondaryClusterPromoteAndAddAndDeleteAutomatedBackupPolicyAndInitialUser(t *testing.T) { t.Parallel() diff --git a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_test.go b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_test.go index 484f1a21a21e..4c7198963057 100644 --- a/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_test.go +++ b/mmv1/third_party/terraform/services/bigquery/resource_bigquery_table_test.go @@ -902,7 +902,7 @@ func TestAccBigQueryExternalDataTable_queryAcceleration(t *testing.T) { connectionID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) metadataCacheMode := "AUTOMATIC" - // including an optional field. Should work without specifiying. + // including an optional field. Should work without specifying. // Has to follow google sql IntervalValue encoding maxStaleness := "0-0 0 10:0:0" @@ -927,7 +927,7 @@ func TestAccBigQueryExternalDataTable_objectTable(t *testing.T) { datasetID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) tableID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) connectionID := fmt.Sprintf("tf_test_%s", acctest.RandString(t, 10)) - // including an optional field. Should work without specifiying. + // including an optional field. Should work without specifying. // Has to follow google sql IntervalValue encoding maxStaleness := "0-0 0 10:0:0" diff --git a/mmv1/third_party/terraform/services/compute/compute_instance_helpers.go.tmpl b/mmv1/third_party/terraform/services/compute/compute_instance_helpers.go.tmpl index a46a8403f1cb..5a5267ab8eab 100644 --- a/mmv1/third_party/terraform/services/compute/compute_instance_helpers.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/compute_instance_helpers.go.tmpl @@ -515,7 +515,7 @@ func expandNetworkInterfaces(d tpgresource.TerraformResourceData, config *transp if networkAttachmentObj, ok := data["network_attachment"]; ok { networkAttachment = networkAttachmentObj.(string) } - // Checks if networkAttachment is not specified in resource, network or subnetwork have to be specifed. + // Checks if networkAttachment is not specified in resource, network or subnetwork have to be specified. if networkAttachment == "" && network == "" && subnetwork == "" { return nil, fmt.Errorf("exactly one of network, subnetwork, or network_attachment must be provided") } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl index a98832c9e8b6..079c80455819 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl @@ -335,7 +335,7 @@ func TestAccComputeNetwork_default_bgp_always_compare_med(t *testing.T) { var network compute.Network suffixName := acctest.RandString(t, 10) - networkName := fmt.Sprintf("tf-test-bgp-always-comapre-med-default-routes-%s", suffixName) + networkName := fmt.Sprintf("tf-test-bgp-always-compare-med-default-routes-%s", suffixName) expectedBgpAlwaysCompareMed := false @@ -768,7 +768,7 @@ resource "google_compute_network" "acc_network_bgp_best_path_selection_mode" { `, networkName, bgpBestPathSelection) } -func testAccComputeNetwork_bgp_always_compare_med(networkName string, bgpAlwaysComapreMed bool) string { +func testAccComputeNetwork_bgp_always_compare_med(networkName string, bgpAlwaysCompareMed bool) string { return fmt.Sprintf(` resource "google_compute_network" "acc_network_bgp_always_compare_med" { provider = google-beta @@ -777,7 +777,7 @@ resource "google_compute_network" "acc_network_bgp_always_compare_med" { bgp_best_path_selection_mode = "STANDARD" bgp_always_compare_med = %t } -`, networkName, bgpAlwaysComapreMed) +`, networkName, bgpAlwaysCompareMed) } func testAccComputeNetwork_bgp_inter_region_cost(networkName, bgpInterRegionCost string) string { diff --git a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go index d457afe6a505..a58b2cfd1bba 100644 --- a/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go +++ b/mmv1/third_party/terraform/services/secretmanager/data_source_secret_manager_secrets_test.go @@ -231,7 +231,7 @@ func checkFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr map[strin return nil } -// This function checks state match for resourceName and asserts the absense of resourceName2 in data source +// This function checks state match for resourceName and asserts the absence of resourceName2 in data source func checkListDataSourceStateMatchesResourceStateWithIgnoresForAppliedFilter(dataSourceName, resourceName, resourceName2 string, ignoreFields map[string]struct{}) func(*terraform.State) error { return func(s *terraform.State) error { ds, ok := s.RootModule().Resources[dataSourceName] diff --git a/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances_test.go b/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances_test.go index 4224dc317810..859204026991 100644 --- a/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances_test.go +++ b/mmv1/third_party/terraform/services/sql/data_source_sql_database_instances_test.go @@ -327,7 +327,7 @@ func checkListDataSourceStateMatchesResourceStateWithIgnores(dataSourceName, res } } -// This function checks state match for resorceName2 and asserts the absense of resorceName in data source +// This function checks state match for resorceName2 and asserts the absence of resorceName in data source func checkListDataSourceStateMatchesResourceStateWithIgnoresForAppliedFilter(dataSourceName, resourceName, resourceName2 string, ignoreFields map[string]struct{}) func(*terraform.State) error { return func(s *terraform.State) error { ds, ok := s.RootModule().Resources[dataSourceName] @@ -373,7 +373,7 @@ func checkResourceAbsentInDataSourceAfterFilterApllied(dsAttr, rsAttr map[string return nil } -// This function checks whether all the attributes of the database instance resource and the attributes of the datbase instance inside the data source list are the same +// This function checks whether all the attributes of the database instance resource and the attributes of the database instance inside the data source list are the same func checkFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr map[string]string, ignoreFields map[string]struct{}) error { totalInstances, err := strconv.Atoi(dsAttr["instances.#"]) if err != nil { diff --git a/mmv1/third_party/terraform/services/sql/data_source_sql_databases_test.go b/mmv1/third_party/terraform/services/sql/data_source_sql_databases_test.go index c08450c43e64..1b476d03a5b8 100644 --- a/mmv1/third_party/terraform/services/sql/data_source_sql_databases_test.go +++ b/mmv1/third_party/terraform/services/sql/data_source_sql_databases_test.go @@ -107,7 +107,7 @@ func checkDatabasesListDataSourceStateMatchesResourceStateWithIgnores(dataSource } } -// This function checks whether all the attributes of the database instance resource and the attributes of the datbase instance inside the data source list are the same +// This function checks whether all the attributes of the database instance resource and the attributes of the database instance inside the data source list are the same func checkDatabaseFieldsMatchForDataSourceStateAndResourceState(dsAttr, rsAttr map[string]string, ignoreFields map[string]struct{}) error { totalInstances, err := strconv.Atoi(dsAttr["databases.#"]) if err != nil { From 5c029adc5b18bc0f13f45e7731b2caf20161fd99 Mon Sep 17 00:00:00 2001 From: nityaravi <32396647+nityaravi@users.noreply.github.com> Date: Thu, 12 Dec 2024 12:40:29 -0500 Subject: [PATCH 12/25] Moverefpages (#12555) --- docs/content/best-practices/common-resource-patterns.md | 4 ++-- docs/content/best-practices/deletion-behaviors.md | 2 +- docs/content/develop/add-fields.md | 2 +- docs/content/develop/add-iam-support.md | 2 +- docs/content/develop/add-resource.md | 2 +- docs/content/develop/custom-code.md | 4 ++-- docs/content/develop/diffs.md | 2 +- docs/content/{develop => reference}/field-reference.md | 9 +++++---- docs/content/reference/make-commands.md | 2 +- .../content/{develop => reference}/resource-reference.md | 7 ++++--- docs/content/reference/ruby-go-changes.md | 2 +- docs/content/test/test.md | 4 ++-- 12 files changed, 22 insertions(+), 20 deletions(-) rename docs/content/{develop => reference}/field-reference.md (98%) rename docs/content/{develop => reference}/resource-reference.md (97%) diff --git a/docs/content/best-practices/common-resource-patterns.md b/docs/content/best-practices/common-resource-patterns.md index 8b3950dff6c1..9cdc5e9f7f7d 100644 --- a/docs/content/best-practices/common-resource-patterns.md +++ b/docs/content/best-practices/common-resource-patterns.md @@ -11,7 +11,7 @@ Singletons are resources – often config or settings objects – that can only Implementing resources like this may require some or all of the following: -1. If there _isn't_ a create endpoint, set the [create_url]({{< ref "/develop/resource-reference/#create_url" >}}) to point to the update endpoint. +1. If there _isn't_ a create endpoint, set the [create_url]({{< ref "/reference/resource-reference/#create_url" >}}) to point to the update endpoint. 1. If there _is_ a create endpoint, add [pre-create custom code]({{< ref "/develop/custom-code/#pre_post_injection" >}}) that implements "acquire-on-create" logic. The custom code should check whether the resource already exists with a read request, and if it does, run the update logic and return early. For example, see [mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl](https://github.com/GoogleCloudPlatform/magic-modules/blob/dc4d9755cb9288177e0996c1c3b3fa9738ebdf89/mmv1/templates/terraform/pre_create/firebasehosting_site.go.tmpl). * Note: The main disadvantage of "acquire-on-create" logic is that users will not be presented with a diff between the resource's old and new states – because from the terraform perspective, the resource is only being created. Please upvote https://github.com/hashicorp/terraform/issues/19017 to request better support for this workflow. -1. If there is no delete endpoint, set [`exclude_delete: true`]({{< ref "/develop/resource-reference/#create_url" >}}) at the top level of the resource. \ No newline at end of file +1. If there is no delete endpoint, set [`exclude_delete: true`]({{< ref "/reference/resource-reference/#create_url" >}}) at the top level of the resource. \ No newline at end of file diff --git a/docs/content/best-practices/deletion-behaviors.md b/docs/content/best-practices/deletion-behaviors.md index 433010cc7ee0..bb97ffdf64d8 100644 --- a/docs/content/best-practices/deletion-behaviors.md +++ b/docs/content/best-practices/deletion-behaviors.md @@ -40,4 +40,4 @@ See [Client-side fields]({{< ref "/develop/client-side-fields" >}}) for informat ## Exclude deletion {#exclude_delete} -Some resources do not support deletion in the API and can only be removed from state. For these resources, the best practice is to set [`exclude_delete: true`]({{< ref "/develop/resource-reference#exclude_delete" >}}) on the resource. +Some resources do not support deletion in the API and can only be removed from state. For these resources, the best practice is to set [`exclude_delete: true`]({{< ref "/reference/resource-reference#exclude_delete" >}}) on the resource. diff --git a/docs/content/develop/add-fields.md b/docs/content/develop/add-fields.md index 0e3234ffbdc9..12d0642982fd 100644 --- a/docs/content/develop/add-fields.md +++ b/docs/content/develop/add-fields.md @@ -186,7 +186,7 @@ For `key_name` and `key_description`, provide a domain-appropriate name and desc 2. Modify the field configuration according to the API documentation and behavior. -> **Note:** The templates in this section only include the most commonly-used fields. For a comprehensive reference, see [MMv1 field reference]({{}}). For information about modifying the values sent and received for a field, see [Modify the API request or response]({{}}). +> **Note:** The templates in this section only include the most commonly-used fields. For a comprehensive reference, see [MMv1 field reference]({{}}). For information about modifying the values sent and received for a field, see [Modify the API request or response]({{}}). {{< /tab >}} {{< tab "Handwritten" >}} 1. Add the field to the handwritten resource's schema. diff --git a/docs/content/develop/add-iam-support.md b/docs/content/develop/add-iam-support.md index 8b39abe7d88d..b0d4339d4d12 100644 --- a/docs/content/develop/add-iam-support.md +++ b/docs/content/develop/add-iam-support.md @@ -60,7 +60,7 @@ iam_policy: # min_version: beta ``` -2. Modify the template as needed to match the API resource's documented behavior. These are the most commonly-used fields. For a comprehensive reference, see [MMv1 resource reference: `iam_policy` ↗]({{}}). +2. Modify the template as needed to match the API resource's documented behavior. These are the most commonly-used fields. For a comprehensive reference, see [MMv1 resource reference: `iam_policy` ↗]({{}}). 3. Delete all remaining comments in the IAM configuration (including attribute descriptions) that were copied from the above template. {{< /tab >}} {{< tab "Handwritten" >}} diff --git a/docs/content/develop/add-resource.md b/docs/content/develop/add-resource.md index cfc03f132c33..4b7ce9702800 100644 --- a/docs/content/develop/add-resource.md +++ b/docs/content/develop/add-resource.md @@ -146,7 +146,7 @@ For more information about types of resources and the generation process overall 3. Modify the template as needed to match the API resource's documented behavior. 4. Delete all remaining comments in the resource configuration (including attribute descriptions) that were copied from the above template. -> **Note:** The template includes the most commonly-used fields. For a comprehensive reference, see [MMv1 resource reference ↗]({{}}). +> **Note:** The template includes the most commonly-used fields. For a comprehensive reference, see [MMv1 resource reference ↗]({{}}). {{< /tab >}} {{< tab "Handwritten" >}} > **Warning:** Handwritten resources are more difficult to develop and maintain. New handwritten resources will only be accepted if implementing the resource in MMv1 would require entirely overriding two or more CRUD methods. diff --git a/docs/content/develop/custom-code.md b/docs/content/develop/custom-code.md index 5e9254efd8d4..52a62cae5acd 100644 --- a/docs/content/develop/custom-code.md +++ b/docs/content/develop/custom-code.md @@ -32,8 +32,8 @@ Use `custom_code.constants` to inject top-level code in a resource file. This is - Constants - Regexes compiled at build time -- Functions, such as [diff suppress functions]({{}}), - [validation functions]({{}}), +- Functions, such as [diff suppress functions]({{}}), + [validation functions]({{}}), CustomizeDiff functions, and so on. - Methods diff --git a/docs/content/develop/diffs.md b/docs/content/develop/diffs.md index 4707f10bb40e..1248ab0baf64 100644 --- a/docs/content/develop/diffs.md +++ b/docs/content/develop/diffs.md @@ -176,7 +176,7 @@ See [SDKv2 Schema Behaviors - DiffSuppressFunc ↗](https://developer.hashicorp. ## API field that is never included in the response {#ignore_read} -This is common for fields that store credentials or similar information. Such fields should also be marked as [`sensitive`]({{< ref "/develop/field-reference#sensitive" >}}). +This is common for fields that store credentials or similar information. Such fields should also be marked as [`sensitive`]({{< ref "/reference/field-reference#sensitive" >}}). In the flattener for the field, return the value of the field in the user's configuration. diff --git a/docs/content/develop/field-reference.md b/docs/content/reference/field-reference.md similarity index 98% rename from docs/content/develop/field-reference.md rename to docs/content/reference/field-reference.md index 313d1335280d..36e61f3e243f 100644 --- a/docs/content/develop/field-reference.md +++ b/docs/content/reference/field-reference.md @@ -1,8 +1,9 @@ --- title: "MMv1 field reference" -weight: 120 +weight: 20 aliases: - /reference/field-reference + - /develop/field-reference --- # MMv1 field reference @@ -280,7 +281,7 @@ This property has two mutually exclusive child properties: [`function: verify.ValidateRegexp(REGEX_STRING)`](https://github.com/hashicorp/terraform-provider-google-beta/blob/0ef51142a4dd1c1a4fc308c1eb09dce307ebe5f5/google-beta/verify/validation.go#L425). `validation` is not supported for Array fields (including sets); however, individual -elements in the array can be validated using [`item_validation`]({{}}). +elements in the array can be validated using [`item_validation`]({{}}). Example: Provider-specific function @@ -331,7 +332,7 @@ stating the current allowed values in the String field's description. Do not include UNSPECIFIED values in this list. Enums will validate that the provided field is in the allowed list unless a -custom [`validation`]({{}}) is provided. +custom [`validation`]({{}}) is provided. Example: @@ -380,7 +381,7 @@ item_type: ### `item_validation` Array only. Controls the [`ValidateFunc`](https://developer.hashicorp.com/terraform/plugin/sdkv2/schemas/schema-behaviors#validatefunc) -used to validate individual items in the array. Behaves like [`validation`]({{}}). +used to validate individual items in the array. Behaves like [`validation`]({{}}). For arrays of enums, this will override the default validation (that the provided value is one of the enum [`values`](#values)). If you need additional validation on top of an enum, ensure that the supplied validation func also verifies the enum diff --git a/docs/content/reference/make-commands.md b/docs/content/reference/make-commands.md index cc35715feb8a..6742b44173a8 100644 --- a/docs/content/reference/make-commands.md +++ b/docs/content/reference/make-commands.md @@ -1,6 +1,6 @@ --- title: "make commands" -weight: 10 +weight: 30 --- # `make` commands reference diff --git a/docs/content/develop/resource-reference.md b/docs/content/reference/resource-reference.md similarity index 97% rename from docs/content/develop/resource-reference.md rename to docs/content/reference/resource-reference.md index 3ca0dbad4081..73aec50bd3d8 100644 --- a/docs/content/develop/resource-reference.md +++ b/docs/content/reference/resource-reference.md @@ -1,9 +1,10 @@ --- title: "MMv1 resource reference" -weight: 130 +weight: 10 aliases: - /reference/resource-reference - /reference/iam-policy-reference + - /develop/resource-reference --- # MMv1 resource reference @@ -334,12 +335,12 @@ the behavior of a Terraform resource such as `deletion_protection`. ### `parameters` -Contains a list of [fields]({{< ref "/develop/field-reference" >}}). By convention, +Contains a list of [fields]({{< ref "/reference/field-reference" >}}). By convention, these should be the fields that are part URL parameters such as `location` and `name`. ### `properties` -Contains a list of [fields]({{< ref "/develop/field-reference" >}}). By convention, +Contains a list of [fields]({{< ref "/reference/field-reference" >}}). By convention, these should be fields that aren't part of the URL parameters. Example: diff --git a/docs/content/reference/ruby-go-changes.md b/docs/content/reference/ruby-go-changes.md index ee4f8070f0bd..eac38ea6c090 100644 --- a/docs/content/reference/ruby-go-changes.md +++ b/docs/content/reference/ruby-go-changes.md @@ -1,6 +1,6 @@ --- title: "Ruby to Go Migration" -weight: 10 +weight: 40 --- # What has changed in the MMv1 Go migration diff --git a/docs/content/test/test.md b/docs/content/test/test.md index fe83cb47088c..47a2ebe04273 100644 --- a/docs/content/test/test.md +++ b/docs/content/test/test.md @@ -241,8 +241,8 @@ An update test is a test that creates the target resource and then makes updates ## Add unit tests A unit test verifies functionality that is not related to interactions with the API, such as -[diff suppress functions]({{}}), -[validation functions]({{}}), +[diff suppress functions]({{}}), +[validation functions]({{}}), CustomizeDiff functions, and so on. Unit tests should be added to the appropriate folder in [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) in the file called `resource_PRODUCT_RESOURCE_test.go`. (You may need to create this file if it does not already exist. Replace PRODUCT with the product name and RESOURCE with the resource name; it should match the name of the generated resource file.) From a5b703532272a4c25c473c12dc59764a5408a954 Mon Sep 17 00:00:00 2001 From: Matt Ng Date: Thu, 12 Dec 2024 12:44:32 -0500 Subject: [PATCH 13/25] Promote BackupDR Backup and Data Source to GA (#12435) --- .../provider/provider_mmv1_resources.go.tmpl | 4 +-- .../data_source_backup_dr_backup.go.tmpl | 3 -- .../data_source_backup_dr_backup_test.go.tmpl | 3 -- .../data_source_backup_dr_data_source.go.tmpl | 2 -- ..._source_backup_dr_data_source_test.go.tmpl | 2 -- .../docs/d/backup_dr_backup.html.markdown | 29 +++++++++++++++++++ .../d/backup_dr_data_source.html.markdown | 29 +++++++++++++++++++ 7 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 mmv1/third_party/terraform/website/docs/d/backup_dr_backup.html.markdown create mode 100644 mmv1/third_party/terraform/website/docs/d/backup_dr_data_source.html.markdown diff --git a/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl b/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl index 9be2669436c8..6f1643252c7e 100644 --- a/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl +++ b/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl @@ -33,11 +33,11 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_apphub_discovered_service": apphub.DataSourceApphubDiscoveredService(), {{- if ne $.TargetVersionName "ga" }} "google_backup_dr_management_server": backupdr.DataSourceGoogleCloudBackupDRService(), - "google_backup_dr_backup": backupdr.DataSourceGoogleCloudBackupDRBackup(), "google_backup_dr_backup_plan_association": backupdr.DataSourceGoogleCloudBackupDRBackupPlanAssociation(), "google_backup_dr_backup_plan": backupdr.DataSourceGoogleCloudBackupDRBackupPlan(), - "google_backup_dr_data_source": backupdr.DataSourceGoogleCloudBackupDRDataSource(), {{- end }} + "google_backup_dr_backup": backupdr.DataSourceGoogleCloudBackupDRBackup(), + "google_backup_dr_data_source": backupdr.DataSourceGoogleCloudBackupDRDataSource(), "google_backup_dr_backup_vault": backupdr.DataSourceGoogleCloudBackupDRBackupVault(), "google_beyondcorp_app_connection": beyondcorp.DataSourceGoogleBeyondcorpAppConnection(), "google_beyondcorp_app_connector": beyondcorp.DataSourceGoogleBeyondcorpAppConnector(), diff --git a/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_backup.go.tmpl b/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_backup.go.tmpl index 2ddbda633a51..944e547352d3 100644 --- a/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_backup.go.tmpl +++ b/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_backup.go.tmpl @@ -1,5 +1,4 @@ package backupdr -{{- if ne $.TargetVersionName "ga" }} import ( "fmt" @@ -171,5 +170,3 @@ func flattenDataSourceBackupDRBackupsBackupVaultId(v interface{}, d *schema.Reso func flattenDataSourceBackupDRBackupsDataSourceId(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return v } - -{{- end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_backup_test.go.tmpl b/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_backup_test.go.tmpl index 6e7ae42087a9..ffa95639e75d 100644 --- a/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_backup_test.go.tmpl +++ b/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_backup_test.go.tmpl @@ -1,5 +1,4 @@ package backupdr_test -{{- if ne $.TargetVersionName "ga" }} import ( "fmt" @@ -51,5 +50,3 @@ data "google_backup_dr_backup" "foo" { `, context) } - -{{- end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_data_source.go.tmpl b/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_data_source.go.tmpl index 32e498c5244f..1f477edfe4ee 100644 --- a/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_data_source.go.tmpl +++ b/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_data_source.go.tmpl @@ -1,5 +1,4 @@ package backupdr -{{- if ne $.TargetVersionName "ga" }} import ( "fmt" @@ -619,4 +618,3 @@ func flattenBackupDRDataSourceDataSourceBackupApplianceApplicationApplicationHos func flattenBackupDRDataSourceDataSourceBackupApplianceApplicationApplicationHostId(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return v } -{{- end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_data_source_test.go.tmpl b/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_data_source_test.go.tmpl index dd08709e42c9..d2efbc74e2cc 100644 --- a/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_data_source_test.go.tmpl +++ b/mmv1/third_party/terraform/services/backupdr/data_source_backup_dr_data_source_test.go.tmpl @@ -1,5 +1,4 @@ package backupdr_test -{{- if ne $.TargetVersionName "ga" }} import ( "fmt" @@ -54,4 +53,3 @@ data "google_backup_dr_data_source" "foo" { `, context) } -{{- end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/website/docs/d/backup_dr_backup.html.markdown b/mmv1/third_party/terraform/website/docs/d/backup_dr_backup.html.markdown new file mode 100644 index 000000000000..ca31d46d9824 --- /dev/null +++ b/mmv1/third_party/terraform/website/docs/d/backup_dr_backup.html.markdown @@ -0,0 +1,29 @@ +--- +subcategory: "Backup and DR Backup" +description: |- + Get information about a Backupdr Backup. +--- + +# google_backup_dr_backup + +A Backup and DR Backup. + +## Example Usage + +```hcl +data "google_backup_dr_backup" "foo" { + location = "us-central1" + project = "project-test" + data_source_id = "ds-test" + backup_vault_id = "bv-test" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `location` - (Required) The location in which the Backup belongs. +* `project` - (Required) The Google Cloud Project in which the Backup belongs. +* `data_source_id` - (Required) The ID of the Data Source in which the Backup belongs. +* `backup_vault_id` - (Required) The ID of the Backup Vault of the Data Source in which the Backup belongs. \ No newline at end of file diff --git a/mmv1/third_party/terraform/website/docs/d/backup_dr_data_source.html.markdown b/mmv1/third_party/terraform/website/docs/d/backup_dr_data_source.html.markdown new file mode 100644 index 000000000000..13d794e27721 --- /dev/null +++ b/mmv1/third_party/terraform/website/docs/d/backup_dr_data_source.html.markdown @@ -0,0 +1,29 @@ +--- +subcategory: "Backup and DR Data Source" +description: |- + Get information about a Backupdr Data Source. +--- + +# google_backup_dr_data_source + +A Backup and DR Data Source. + +## Example Usage + +```hcl +data "google_backup_dr_data_source" "foo" { + location = "us-central1" + project = "project-test" + data_source_id = "ds-test" + backup_vault_id = "bv-test" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `location` - (Required) The location in which the Data Source belongs. +* `project` - (Required) The Google Cloud Project in which the Data Source belongs. +* `data_source_id` - (Required) The ID of the Data Source. +* `backup_vault_id` - (Required) The ID of the Backup Vault in which the Data Source belongs. \ No newline at end of file From fb5aa39ba66c9b7cc7c29be560cf889fe19d8b3e Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Thu, 12 Dec 2024 11:12:12 -0800 Subject: [PATCH 14/25] Delete .ruby-version (#12557) --- .ruby-version | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index fd2a01863fdd..000000000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -3.1.0 From d6141b66d912a3893f2a58b046ff241b6dac674e Mon Sep 17 00:00:00 2001 From: Ryan Oaks Date: Thu, 12 Dec 2024 14:24:36 -0500 Subject: [PATCH 15/25] Fix resources with incorrect filenames (#12556) --- ...lias_pkcs12.go => resource_apigee_keystores_aliases_pkcs12.go} | 0 ...ta.yaml => resource_apigee_keystores_aliases_pkcs12_meta.yaml} | 0 ...2_test.go => resource_apigee_keystores_aliases_pkcs12_test.go} | 0 ...ucket.go.tmpl => resource_project_usage_export_bucket.go.tmpl} | 0 ...l.tmpl => resource_project_usage_export_bucket_meta.yaml.tmpl} | 0 ...ucket_test.go => resource_project_usage_export_bucket_test.go} | 0 ...indings.go.tmpl => resource_tags_location_tag_binding.go.tmpl} | 0 ...ngs_meta.yaml => resource_tags_location_tag_binding_meta.yaml} | 0 ...et.html.markdown => project_usage_export_bucket.html.markdown} | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename mmv1/third_party/terraform/services/apigee/{resource_apigee_env_keystore_alias_pkcs12.go => resource_apigee_keystores_aliases_pkcs12.go} (100%) rename mmv1/third_party/terraform/services/apigee/{resource_apigee_env_keystore_alias_pkcs12_meta.yaml => resource_apigee_keystores_aliases_pkcs12_meta.yaml} (100%) rename mmv1/third_party/terraform/services/apigee/{resource_apigee_env_keystore_alias_pkcs12_test.go => resource_apigee_keystores_aliases_pkcs12_test.go} (100%) rename mmv1/third_party/terraform/services/compute/{resource_usage_export_bucket.go.tmpl => resource_project_usage_export_bucket.go.tmpl} (100%) rename mmv1/third_party/terraform/services/compute/{resource_usage_export_bucket_meta.yaml.tmpl => resource_project_usage_export_bucket_meta.yaml.tmpl} (100%) rename mmv1/third_party/terraform/services/compute/{resource_usage_export_bucket_test.go => resource_project_usage_export_bucket_test.go} (100%) rename mmv1/third_party/terraform/services/tags/{resource_tags_location_tag_bindings.go.tmpl => resource_tags_location_tag_binding.go.tmpl} (100%) rename mmv1/third_party/terraform/services/tags/{resource_tags_location_tag_bindings_meta.yaml => resource_tags_location_tag_binding_meta.yaml} (100%) rename mmv1/third_party/terraform/website/docs/r/{usage_export_bucket.html.markdown => project_usage_export_bucket.html.markdown} (100%) diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_env_keystore_alias_pkcs12.go b/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12.go similarity index 100% rename from mmv1/third_party/terraform/services/apigee/resource_apigee_env_keystore_alias_pkcs12.go rename to mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12.go diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_env_keystore_alias_pkcs12_meta.yaml b/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12_meta.yaml similarity index 100% rename from mmv1/third_party/terraform/services/apigee/resource_apigee_env_keystore_alias_pkcs12_meta.yaml rename to mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12_meta.yaml diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_env_keystore_alias_pkcs12_test.go b/mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12_test.go similarity index 100% rename from mmv1/third_party/terraform/services/apigee/resource_apigee_env_keystore_alias_pkcs12_test.go rename to mmv1/third_party/terraform/services/apigee/resource_apigee_keystores_aliases_pkcs12_test.go diff --git a/mmv1/third_party/terraform/services/compute/resource_usage_export_bucket.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket.go.tmpl similarity index 100% rename from mmv1/third_party/terraform/services/compute/resource_usage_export_bucket.go.tmpl rename to mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket.go.tmpl diff --git a/mmv1/third_party/terraform/services/compute/resource_usage_export_bucket_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket_meta.yaml.tmpl similarity index 100% rename from mmv1/third_party/terraform/services/compute/resource_usage_export_bucket_meta.yaml.tmpl rename to mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket_meta.yaml.tmpl diff --git a/mmv1/third_party/terraform/services/compute/resource_usage_export_bucket_test.go b/mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket_test.go similarity index 100% rename from mmv1/third_party/terraform/services/compute/resource_usage_export_bucket_test.go rename to mmv1/third_party/terraform/services/compute/resource_project_usage_export_bucket_test.go diff --git a/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_bindings.go.tmpl b/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_binding.go.tmpl similarity index 100% rename from mmv1/third_party/terraform/services/tags/resource_tags_location_tag_bindings.go.tmpl rename to mmv1/third_party/terraform/services/tags/resource_tags_location_tag_binding.go.tmpl diff --git a/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_bindings_meta.yaml b/mmv1/third_party/terraform/services/tags/resource_tags_location_tag_binding_meta.yaml similarity index 100% rename from mmv1/third_party/terraform/services/tags/resource_tags_location_tag_bindings_meta.yaml rename to mmv1/third_party/terraform/services/tags/resource_tags_location_tag_binding_meta.yaml diff --git a/mmv1/third_party/terraform/website/docs/r/usage_export_bucket.html.markdown b/mmv1/third_party/terraform/website/docs/r/project_usage_export_bucket.html.markdown similarity index 100% rename from mmv1/third_party/terraform/website/docs/r/usage_export_bucket.html.markdown rename to mmv1/third_party/terraform/website/docs/r/project_usage_export_bucket.html.markdown From 2905156431af01acf9eaf0e1d3ec5181e3bec801 Mon Sep 17 00:00:00 2001 From: Akshat Jindal <67505646+akshat-jindal-nit@users.noreply.github.com> Date: Fri, 13 Dec 2024 00:55:25 +0530 Subject: [PATCH 16/25] TF: plan -refresh=false for google_compute_ha_vpn_gateway with gcs backend has resource replacement (#12422) --- mmv1/products/compute/HaVpnGateway.yaml | 2 + .../compute_ha_vpn_gateway.go.tmpl | 119 ++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 mmv1/templates/terraform/state_migrations/compute_ha_vpn_gateway.go.tmpl diff --git a/mmv1/products/compute/HaVpnGateway.yaml b/mmv1/products/compute/HaVpnGateway.yaml index 9d07ad62c0e2..34e01079df17 100644 --- a/mmv1/products/compute/HaVpnGateway.yaml +++ b/mmv1/products/compute/HaVpnGateway.yaml @@ -41,6 +41,8 @@ async: resource_inside_response: false collection_url_key: 'items' custom_code: +schema_version: 1 +state_upgraders: true examples: - name: 'ha_vpn_gateway_basic' primary_resource_id: 'ha_gateway1' diff --git a/mmv1/templates/terraform/state_migrations/compute_ha_vpn_gateway.go.tmpl b/mmv1/templates/terraform/state_migrations/compute_ha_vpn_gateway.go.tmpl new file mode 100644 index 000000000000..7b5e40fc3697 --- /dev/null +++ b/mmv1/templates/terraform/state_migrations/compute_ha_vpn_gateway.go.tmpl @@ -0,0 +1,119 @@ +func resourceComputeHaVpnGatewayResourceV0() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: verify.ValidateGCEName, + Description: `Name of the resource. Provided by the client when the resource is +created. The name must be 1-63 characters long, and comply with +RFC1035. Specifically, the name must be 1-63 characters long and +match the regular expression '[a-z]([-a-z0-9]*[a-z0-9])?' which means +the first character must be a lowercase letter, and all following +characters must be a dash, lowercase letter, or digit, except the last +character, which cannot be a dash.`, + }, + "network": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, + Description: `The network this VPN gateway is accepting traffic for.`, + }, + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: `An optional description of this resource.`, + }, + "gateway_ip_version": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: verify.ValidateEnum([]string{"IPV4", "IPV6", ""}), + Description: `The IP family of the gateway IPs for the HA-VPN gateway interfaces. If not specified, IPV4 will be used. Default value: "IPV4" Possible values: ["IPV4", "IPV6"]`, + Default: "IPV4", + }, + "region": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, + Description: `The region this gateway should sit in.`, + }, + "stack_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: verify.ValidateEnum([]string{"IPV4_ONLY", "IPV4_IPV6", "IPV6_ONLY", ""}), + Description: `The stack type for this VPN gateway to identify the IP protocols that are enabled. +If not specified, IPV4_ONLY will be used. Default value: "IPV4_ONLY" Possible values: ["IPV4_ONLY", "IPV4_IPV6", "IPV6_ONLY"]`, + Default: "IPV4_ONLY", + }, + "vpn_interfaces": { + Type: schema.TypeList, + Computed: true, + Optional: true, + ForceNew: true, + Description: `A list of interfaces on this VPN gateway.`, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: `The numeric ID of this VPN gateway interface.`, + }, + "interconnect_attachment": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, + Description: `URL of the interconnect attachment resource. When the value +of this field is present, the VPN Gateway will be used for +IPsec-encrypted Cloud Interconnect; all Egress or Ingress +traffic for this VPN Gateway interface will go through the +specified interconnect attachment resource. + +Not currently available publicly.`, + }, + "ip_address": { + Type: schema.TypeString, + Computed: true, + Description: `The external IP address for this VPN gateway interface.`, + }, + }, + }, + }, + "project": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "self_link": { + Type: schema.TypeString, + Computed: true, + }, + }, + UseJSONNumber: true, + } +} + +func ResourceComputeHaVpnGatewayUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + log.Printf("[DEBUG] Attributes before migration: %#v", rawState) + + + // Check if "gateway_ip_version" already exists + if _, ok := rawState["gateway_ip_version"]; !ok { + // Add the missing attribute with the default value + rawState["gateway_ip_version"] = "IPV4" + } else { + log.Printf("[DEBUG] 'gateway_ip_version' already exists: %#v", rawState["gateway_ip_version"]) + } + + log.Printf("[DEBUG] Attributes after migration: %#v", rawState) + return rawState, nil +} \ No newline at end of file From 4840e0281100531863952bac0185395d27b72c3f Mon Sep 17 00:00:00 2001 From: unnatinadupalli <156947936+unnatinadupalli@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:28:34 -0800 Subject: [PATCH 17/25] Parallelstore: adding deployment type to beta provider and making network field required. (#12558) --- mmv1/products/parallelstore/Instance.yaml | 19 ++++++++- .../parallelstore_instance_baic_beta.tmpl | 40 +++++++++++++++++++ ...source_parallelstore_instance_test.go.tmpl | 15 ++++++- 3 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl diff --git a/mmv1/products/parallelstore/Instance.yaml b/mmv1/products/parallelstore/Instance.yaml index 7fd33f0f00af..79ca222dfd5f 100644 --- a/mmv1/products/parallelstore/Instance.yaml +++ b/mmv1/products/parallelstore/Instance.yaml @@ -37,6 +37,13 @@ async: resource_inside_response: true custom_code: examples: + - name: 'parallelstore_instance_basic_beta' + primary_resource_id: 'instance' + min_version: 'beta' + vars: + name: 'instance' + network_name: 'network' + address_name: 'address' - name: 'parallelstore_instance_basic' primary_resource_id: 'instance' vars: @@ -141,8 +148,9 @@ properties: type: String - name: 'network' type: String + required: true description: | - Immutable. The name of the Google Compute Engine [VPC network](https://cloud.google.com/vpc/docs/vpc) + Required. Immutable. The name of the Google Compute Engine [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the instance is connected. immutable: true - name: 'reservedIpRange' @@ -184,3 +192,12 @@ properties: DIRECTORY_STRIPE_LEVEL_MIN DIRECTORY_STRIPE_LEVEL_BALANCED DIRECTORY_STRIPE_LEVEL_MAX + - name: deploymentType + type: String + min_version: 'beta' + description: | + Parallelstore Instance deployment type. + Possible values: + DEPLOYMENT_TYPE_UNSPECIFIED + SCRATCH + PERSISTENT diff --git a/mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl b/mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl new file mode 100644 index 000000000000..c54aebc317cd --- /dev/null +++ b/mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl @@ -0,0 +1,40 @@ +resource "google_parallelstore_instance" "{{$.PrimaryResourceId}}" { + instance_id = "{{index $.Vars "name"}}" + location = "us-central1-a" + description = "test instance" + capacity_gib = 12000 + network = google_compute_network.network.name + file_stripe_level = "FILE_STRIPE_LEVEL_MIN" + directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN" + deployment_type = "SCRATCH" + labels = { + test = "value" + } + provider = google-beta + depends_on = [google_service_networking_connection.default] +} + +resource "google_compute_network" "network" { + name = "{{index $.Vars "network_name"}}" + auto_create_subnetworks = true + mtu = 8896 + provider = google-beta +} + +# Create an IP address +resource "google_compute_global_address" "private_ip_alloc" { + name = "{{index $.Vars "address_name"}}" + purpose = "VPC_PEERING" + address_type = "INTERNAL" + prefix_length = 24 + provider = google-beta + network = google_compute_network.network.id +} + +# Create a private connection +resource "google_service_networking_connection" "default" { + network = google_compute_network.network.id + service = "servicenetworking.googleapis.com" + provider = google-beta + reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl b/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl index 87fb1e74fdee..a31351169094 100644 --- a/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl +++ b/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl @@ -18,6 +18,7 @@ package parallelstore_test +{{ if ne $.TargetVersionName `ga` -}} import ( "testing" @@ -34,7 +35,7 @@ func TestAccParallelstoreInstance_parallelstoreInstanceBasicExample_update(t *te acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckParallelstoreInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -70,6 +71,7 @@ resource "google_parallelstore_instance" "instance" { network = google_compute_network.network.name reserved_ip_range = google_compute_global_address.private_ip_alloc.name file_stripe_level = "FILE_STRIPE_LEVEL_MIN" + provider = google-beta directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN" labels = { test = "value" @@ -80,6 +82,7 @@ resource "google_parallelstore_instance" "instance" { resource "google_compute_network" "network" { name = "network%{random_suffix}" auto_create_subnetworks = true + provider = google-beta mtu = 8896 } @@ -90,6 +93,7 @@ resource "google_compute_global_address" "private_ip_alloc" { name = "address%{random_suffix}" purpose = "VPC_PEERING" address_type = "INTERNAL" + provider = google-beta prefix_length = 24 network = google_compute_network.network.id } @@ -98,6 +102,7 @@ resource "google_compute_global_address" "private_ip_alloc" { resource "google_service_networking_connection" "default" { network = google_compute_network.network.id service = "servicenetworking.googleapis.com" + provider = google-beta reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] } `, context) @@ -111,7 +116,7 @@ resource "google_parallelstore_instance" "instance" { description = "test instance updated" capacity_gib = 12000 network = google_compute_network.network.name - + provider = google-beta labels = { test = "value23" } @@ -122,6 +127,7 @@ resource "google_compute_network" "network" { name = "network%{random_suffix}" auto_create_subnetworks = true mtu = 8896 + provider = google-beta } @@ -132,14 +138,19 @@ resource "google_compute_global_address" "private_ip_alloc" { purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 24 + provider = google-beta network = google_compute_network.network.id } # Create a private connection resource "google_service_networking_connection" "default" { network = google_compute_network.network.id + provider = google-beta service = "servicenetworking.googleapis.com" reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] } `, context) +} + +{{ end }} } \ No newline at end of file From b1a07f096ff2c97d168959981db99ba0cb0ae42c Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Thu, 12 Dec 2024 11:40:40 -0800 Subject: [PATCH 18/25] Revert "Parallelstore: adding deployment type to beta provider and making network field required. " (#12559) --- mmv1/products/parallelstore/Instance.yaml | 19 +-------- .../parallelstore_instance_baic_beta.tmpl | 40 ------------------- ...source_parallelstore_instance_test.go.tmpl | 15 +------ 3 files changed, 3 insertions(+), 71 deletions(-) delete mode 100644 mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl diff --git a/mmv1/products/parallelstore/Instance.yaml b/mmv1/products/parallelstore/Instance.yaml index 79ca222dfd5f..7fd33f0f00af 100644 --- a/mmv1/products/parallelstore/Instance.yaml +++ b/mmv1/products/parallelstore/Instance.yaml @@ -37,13 +37,6 @@ async: resource_inside_response: true custom_code: examples: - - name: 'parallelstore_instance_basic_beta' - primary_resource_id: 'instance' - min_version: 'beta' - vars: - name: 'instance' - network_name: 'network' - address_name: 'address' - name: 'parallelstore_instance_basic' primary_resource_id: 'instance' vars: @@ -148,9 +141,8 @@ properties: type: String - name: 'network' type: String - required: true description: | - Required. Immutable. The name of the Google Compute Engine [VPC network](https://cloud.google.com/vpc/docs/vpc) + Immutable. The name of the Google Compute Engine [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the instance is connected. immutable: true - name: 'reservedIpRange' @@ -192,12 +184,3 @@ properties: DIRECTORY_STRIPE_LEVEL_MIN DIRECTORY_STRIPE_LEVEL_BALANCED DIRECTORY_STRIPE_LEVEL_MAX - - name: deploymentType - type: String - min_version: 'beta' - description: | - Parallelstore Instance deployment type. - Possible values: - DEPLOYMENT_TYPE_UNSPECIFIED - SCRATCH - PERSISTENT diff --git a/mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl b/mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl deleted file mode 100644 index c54aebc317cd..000000000000 --- a/mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl +++ /dev/null @@ -1,40 +0,0 @@ -resource "google_parallelstore_instance" "{{$.PrimaryResourceId}}" { - instance_id = "{{index $.Vars "name"}}" - location = "us-central1-a" - description = "test instance" - capacity_gib = 12000 - network = google_compute_network.network.name - file_stripe_level = "FILE_STRIPE_LEVEL_MIN" - directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN" - deployment_type = "SCRATCH" - labels = { - test = "value" - } - provider = google-beta - depends_on = [google_service_networking_connection.default] -} - -resource "google_compute_network" "network" { - name = "{{index $.Vars "network_name"}}" - auto_create_subnetworks = true - mtu = 8896 - provider = google-beta -} - -# Create an IP address -resource "google_compute_global_address" "private_ip_alloc" { - name = "{{index $.Vars "address_name"}}" - purpose = "VPC_PEERING" - address_type = "INTERNAL" - prefix_length = 24 - provider = google-beta - network = google_compute_network.network.id -} - -# Create a private connection -resource "google_service_networking_connection" "default" { - network = google_compute_network.network.id - service = "servicenetworking.googleapis.com" - provider = google-beta - reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] -} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl b/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl index a31351169094..87fb1e74fdee 100644 --- a/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl +++ b/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl @@ -18,7 +18,6 @@ package parallelstore_test -{{ if ne $.TargetVersionName `ga` -}} import ( "testing" @@ -35,7 +34,7 @@ func TestAccParallelstoreInstance_parallelstoreInstanceBasicExample_update(t *te acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckParallelstoreInstanceDestroyProducer(t), Steps: []resource.TestStep{ { @@ -71,7 +70,6 @@ resource "google_parallelstore_instance" "instance" { network = google_compute_network.network.name reserved_ip_range = google_compute_global_address.private_ip_alloc.name file_stripe_level = "FILE_STRIPE_LEVEL_MIN" - provider = google-beta directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN" labels = { test = "value" @@ -82,7 +80,6 @@ resource "google_parallelstore_instance" "instance" { resource "google_compute_network" "network" { name = "network%{random_suffix}" auto_create_subnetworks = true - provider = google-beta mtu = 8896 } @@ -93,7 +90,6 @@ resource "google_compute_global_address" "private_ip_alloc" { name = "address%{random_suffix}" purpose = "VPC_PEERING" address_type = "INTERNAL" - provider = google-beta prefix_length = 24 network = google_compute_network.network.id } @@ -102,7 +98,6 @@ resource "google_compute_global_address" "private_ip_alloc" { resource "google_service_networking_connection" "default" { network = google_compute_network.network.id service = "servicenetworking.googleapis.com" - provider = google-beta reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] } `, context) @@ -116,7 +111,7 @@ resource "google_parallelstore_instance" "instance" { description = "test instance updated" capacity_gib = 12000 network = google_compute_network.network.name - provider = google-beta + labels = { test = "value23" } @@ -127,7 +122,6 @@ resource "google_compute_network" "network" { name = "network%{random_suffix}" auto_create_subnetworks = true mtu = 8896 - provider = google-beta } @@ -138,19 +132,14 @@ resource "google_compute_global_address" "private_ip_alloc" { purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 24 - provider = google-beta network = google_compute_network.network.id } # Create a private connection resource "google_service_networking_connection" "default" { network = google_compute_network.network.id - provider = google-beta service = "servicenetworking.googleapis.com" reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] } `, context) -} - -{{ end }} } \ No newline at end of file From ab44a8a000bc83e5d8c286a508705c7392e7c50b Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Thu, 12 Dec 2024 13:08:27 -0800 Subject: [PATCH 19/25] Magician vcr eap (#12547) --- .ci/magician/cmd/interfaces.go | 1 + .ci/magician/cmd/test_eap_vcr.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.ci/magician/cmd/interfaces.go b/.ci/magician/cmd/interfaces.go index 71f0f05218e8..61219ef38472 100644 --- a/.ci/magician/cmd/interfaces.go +++ b/.ci/magician/cmd/interfaces.go @@ -48,6 +48,7 @@ type ExecRunner interface { RemoveAll(path string) error PushDir(path string) error PopDir() error + ReadFile(name string) (string, error) WriteFile(name, data string) error AppendFile(name, data string) error // Not used (yet). Run(name string, args []string, env map[string]string) (string, error) diff --git a/.ci/magician/cmd/test_eap_vcr.go b/.ci/magician/cmd/test_eap_vcr.go index 06419e6b23eb..8c8c1ce863e1 100644 --- a/.ci/magician/cmd/test_eap_vcr.go +++ b/.ci/magician/cmd/test_eap_vcr.go @@ -104,9 +104,9 @@ func execTestEAPVCR(changeNumber, genPath, kokoroArtifactsDir, modifiedFilePath return fmt.Errorf("error changing to gen path: %w", err) } - changedFiles, err := rnr.Run("git", []string{"diff", "--name-only"}, nil) + changedFiles, err := rnr.ReadFile("diff.log") if err != nil { - return fmt.Errorf("error diffing gen path: %w", err) + return fmt.Errorf("error reading diff log: %w", err) } services, runFullVCR := modifiedPackages(strings.Split(changedFiles, "\n"), provider.Private) From 3b3cb68702ce1f619ff98998560c381d570527c9 Mon Sep 17 00:00:00 2001 From: Margubur Rahman <150442997+googlyrahman@users.noreply.github.com> Date: Fri, 13 Dec 2024 03:00:45 +0530 Subject: [PATCH 20/25] Make resource_google_storage_bucket_object generate diff for md5hash, generation, crc32c if content changes (#12541) --- .../storage/resource_storage_bucket_object.go | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object.go b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object.go index eb6ee62ca0b2..1023a9b3d067 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object.go +++ b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object.go @@ -3,6 +3,7 @@ package storage import ( "bytes" + "context" "fmt" "io" "log" @@ -24,10 +25,11 @@ import ( func ResourceStorageBucketObject() *schema.Resource { return &schema.Resource{ - Create: resourceStorageBucketObjectCreate, - Read: resourceStorageBucketObjectRead, - Update: resourceStorageBucketObjectUpdate, - Delete: resourceStorageBucketObjectDelete, + Create: resourceStorageBucketObjectCreate, + Read: resourceStorageBucketObjectRead, + Update: resourceStorageBucketObjectUpdate, + Delete: resourceStorageBucketObjectDelete, + CustomizeDiff: resourceStorageBucketObjectCustomizeDiff, Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(4 * time.Minute), @@ -603,3 +605,35 @@ func flattenObjectRetention(objectRetention *storage.ObjectRetention) []map[stri retentions = append(retentions, retention) return retentions } + +func resourceStorageBucketObjectCustomizeDiff(ctx context.Context, d *schema.ResourceDiff, meta interface{}) error { + localMd5Hash := "" + if source, ok := d.GetOkExists("source"); ok { + localMd5Hash = tpgresource.GetFileMd5Hash(source.(string)) + } + if content, ok := d.GetOkExists("content"); ok { + localMd5Hash = tpgresource.GetContentMd5Hash([]byte(content.(string))) + } + if localMd5Hash == "" { + return nil + } + + oldMd5Hash, ok := d.GetOkExists("md5hash") + if ok && oldMd5Hash == localMd5Hash { + return nil + } + + err := d.SetNewComputed("md5hash") + if err != nil { + return fmt.Errorf("Error re-setting md5hash: %s", err) + } + err = d.SetNewComputed("crc32c") + if err != nil { + return fmt.Errorf("Error re-setting crc32c: %s", err) + } + err = d.SetNewComputed("generation") + if err != nil { + return fmt.Errorf("Error re-setting generation: %s", err) + } + return nil +} From 9e83dc2be24eda2f1e3beb89b0153b06a49bea05 Mon Sep 17 00:00:00 2001 From: septikus Date: Fri, 13 Dec 2024 08:20:45 -0800 Subject: [PATCH 21/25] Add `group` field to `google_network_connectivity_spoke` (#12537) --- mmv1/products/networkconnectivity/Spoke.yaml | 11 +++++ ...ity_spoke_linked_vpc_network_group.tf.tmpl | 40 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_group.tf.tmpl diff --git a/mmv1/products/networkconnectivity/Spoke.yaml b/mmv1/products/networkconnectivity/Spoke.yaml index b30943cd5866..4ab3309a7845 100644 --- a/mmv1/products/networkconnectivity/Spoke.yaml +++ b/mmv1/products/networkconnectivity/Spoke.yaml @@ -44,6 +44,12 @@ examples: network_name: 'net' hub_name: 'hub1' spoke_name: 'spoke1' + - name: 'network_connectivity_spoke_linked_vpc_network_group' + primary_resource_id: 'primary' + vars: + network_name: 'net-spoke' + hub_name: 'hub1-spoke' + spoke_name: 'group-spoke1' - name: 'network_connectivity_spoke_router_appliance_basic' primary_resource_id: 'primary' vars: @@ -122,6 +128,11 @@ properties: immutable: true resource: 'hub' imports: 'name' + - name: 'group' + type: String + description: The name of the group that this spoke is associated with. + immutable: true + default_from_api: true - name: 'linkedVpnTunnels' type: NestedObject description: The URIs of linked VPN tunnel resources diff --git a/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_group.tf.tmpl b/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_group.tf.tmpl new file mode 100644 index 000000000000..1ff1a1695edc --- /dev/null +++ b/mmv1/templates/terraform/examples/network_connectivity_spoke_linked_vpc_network_group.tf.tmpl @@ -0,0 +1,40 @@ +resource "google_compute_network" "network" { + name = "{{index $.Vars "network_name"}}" + auto_create_subnetworks = false +} + +resource "google_network_connectivity_hub" "basic_hub" { + name = "{{index $.Vars "hub_name"}}" + description = "A sample hub" + labels = { + label-two = "value-one" + } +} + +resource "google_network_connectivity_group" "default_group" { + hub = google_network_connectivity_hub.basic_hub.id + name = "default" + description = "A sample hub group" +} + +resource "google_network_connectivity_spoke" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "spoke_name"}}" + location = "global" + description = "A sample spoke with a linked VPC" + labels = { + label-one = "value-one" + } + hub = google_network_connectivity_hub.basic_hub.id + linked_vpc_network { + exclude_export_ranges = [ + "198.51.100.0/24", + "10.10.0.0/16" + ] + include_export_ranges = [ + "198.51.100.0/23", + "10.0.0.0/8" + ] + uri = google_compute_network.network.self_link + } + group = google_network_connectivity_group.default_group.id +} From d7d5bdf5c24003db1b6a165ada7d85015f6e1e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20Niesiob=C4=99dzki?= Date: Fri, 13 Dec 2024 19:01:33 +0100 Subject: [PATCH 22/25] Document `auth_string` output parameter for google_redis_instance (#12344) --- mmv1/products/redis/Instance.yaml | 2 ++ mmv1/templates/terraform/resource.html.markdown.tmpl | 3 +++ 2 files changed, 5 insertions(+) diff --git a/mmv1/products/redis/Instance.yaml b/mmv1/products/redis/Instance.yaml index 8eff54a1863c..419ae6c60bb7 100644 --- a/mmv1/products/redis/Instance.yaml +++ b/mmv1/products/redis/Instance.yaml @@ -20,6 +20,8 @@ references: 'Official Documentation': 'https://cloud.google.com/memorystore/docs/redis/' api: 'https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances' docs: + attributes: | + * `auth_string` - AUTH String set on the instance. This field will only be populated if auth_enabled is true. base_url: 'projects/{{project}}/locations/{{region}}/instances' create_url: 'projects/{{project}}/locations/{{region}}/instances?instanceId={{name}}' update_verb: 'PATCH' diff --git a/mmv1/templates/terraform/resource.html.markdown.tmpl b/mmv1/templates/terraform/resource.html.markdown.tmpl index 1ae18803e773..112e6c098780 100644 --- a/mmv1/templates/terraform/resource.html.markdown.tmpl +++ b/mmv1/templates/terraform/resource.html.markdown.tmpl @@ -148,6 +148,9 @@ In addition to the arguments listed above, the following computed attributes are * `self_link` - The URI of the created resource. {{ "" }} {{- end }} +{{- if $.Docs.Attributes }} +{{ $.Docs.Attributes }} +{{- end }} {{ range $p := $.AllUserProperties }} {{- if $p.Output }} {{- trimTemplate "nested_property_documentation.html.markdown.tmpl" $p }} From 87f392596aa1431322e8f341011561e171e2329f Mon Sep 17 00:00:00 2001 From: coder-221 <185867912+coder-221@users.noreply.github.com> Date: Fri, 13 Dec 2024 12:10:40 -0800 Subject: [PATCH 23/25] Revert "Etag support for ACM service perimeters" (#12568) --- mmv1/products/accesscontextmanager/ServicePerimeter.yaml | 8 -------- mmv1/products/accesscontextmanager/ServicePerimeters.yaml | 7 ------- ...ontextmanager_serviceperimeters_custom_flatten.go.tmpl | 5 ----- .../access_context_manager_service_perimeter.go.tmpl | 5 ----- ..._access_context_manager_service_perimeter_test.go.tmpl | 1 - 5 files changed, 26 deletions(-) delete mode 100644 mmv1/templates/terraform/pre_update/access_context_manager_service_perimeter.go.tmpl diff --git a/mmv1/products/accesscontextmanager/ServicePerimeter.yaml b/mmv1/products/accesscontextmanager/ServicePerimeter.yaml index 6981e3369fe3..ce323709e7ca 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeter.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeter.yaml @@ -65,7 +65,6 @@ async: custom_code: constants: 'templates/terraform/constants/access_context_manager.go.tmpl' encoder: 'templates/terraform/encoders/access_level_never_send_parent.go.tmpl' - pre_update: 'templates/terraform/pre_update/access_context_manager_service_perimeter.go.tmpl' custom_import: 'templates/terraform/custom_import/set_access_policy_parent_from_self_link.go.tmpl' # Skipping the sweeper due to the non-standard base_url exclude_sweeper: true @@ -783,10 +782,3 @@ properties: actually enforcing them. This testing is done through analyzing the differences between currently enforced and suggested restrictions. useExplicitDryRunSpec must bet set to True if any of the fields in the spec are set to non-default values. - - name: 'etag' - type: Fingerprint - description: | - An opaque identifier for the current version of the ServicePerimeter. This - identifier does not follow any specific format. If an etag is not provided, the - operation will be performed as if a valid etag is provided. - output: true diff --git a/mmv1/products/accesscontextmanager/ServicePerimeters.yaml b/mmv1/products/accesscontextmanager/ServicePerimeters.yaml index 7f77cb8333fc..0c3b5a0ca944 100644 --- a/mmv1/products/accesscontextmanager/ServicePerimeters.yaml +++ b/mmv1/products/accesscontextmanager/ServicePerimeters.yaml @@ -94,13 +94,6 @@ properties: description: | Description of the ServicePerimeter and its use. Does not affect behavior. - - name: 'etag' - type: Fingerprint - description: | - An opaque identifier for the current version of the ServicePerimeter. This - identifier does not follow any specific format. If an etag is not provided, the - operation will be performed as if a valid etag is provided. - output: true - name: 'createTime' type: Time description: | diff --git a/mmv1/templates/terraform/custom_flatten/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl b/mmv1/templates/terraform/custom_flatten/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl index c6db1de5f7e7..231fc3f35c04 100644 --- a/mmv1/templates/terraform/custom_flatten/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl +++ b/mmv1/templates/terraform/custom_flatten/accesscontextmanager_serviceperimeters_custom_flatten.go.tmpl @@ -18,7 +18,6 @@ func flatten{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d *schema.Reso "perimeter_type": flattenAccessContextManagerServicePerimetersServicePerimetersPerimeterType(original["perimeterType"], d, config), "status": flattenAccessContextManagerServicePerimetersServicePerimetersStatus(original["status"], d, config), "spec": flattenAccessContextManagerServicePerimetersServicePerimetersSpec(original["spec"], d, config), - "etag": flattenAccessContextManagerServicePerimetersServicePerimetersEtag(original["etag"], d, config), "use_explicit_dry_run_spec": flattenAccessContextManagerServicePerimetersServicePerimetersUseExplicitDryRunSpec(original["useExplicitDryRunSpec"], d, config), }) } @@ -39,10 +38,6 @@ func flattenAccessContextManagerServicePerimetersServicePerimetersName(v interfa return v } -func flattenAccessContextManagerServicePerimetersServicePerimetersEtag(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { - return v -} - func flattenAccessContextManagerServicePerimetersServicePerimetersTitle(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { return v } diff --git a/mmv1/templates/terraform/pre_update/access_context_manager_service_perimeter.go.tmpl b/mmv1/templates/terraform/pre_update/access_context_manager_service_perimeter.go.tmpl deleted file mode 100644 index f1204301fd06..000000000000 --- a/mmv1/templates/terraform/pre_update/access_context_manager_service_perimeter.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -if _, ok := d.GetOkExists("etag"); ok { - updateMask = append(updateMask, "etag") - - url, err = transport_tpg.AddQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")}) -} diff --git a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go.tmpl b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go.tmpl index 7007104794ec..754f2479e154 100644 --- a/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go.tmpl +++ b/mmv1/third_party/terraform/services/accesscontextmanager/resource_access_context_manager_service_perimeter_test.go.tmpl @@ -26,7 +26,6 @@ func testAccAccessContextManagerServicePerimeter_basicTest(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccAccessContextManagerServicePerimeter_basic(org, "my policy", "level", "perimeter"), - Check: resource.TestCheckResourceAttrSet("google_access_context_manager_service_perimeter.test-access", "etag"), }, { ResourceName: "google_access_context_manager_service_perimeter.test-access", From 9ffbaefa36297db91b4e79927bd62e5afe260207 Mon Sep 17 00:00:00 2001 From: Daniel Dubnikov Date: Fri, 13 Dec 2024 22:25:16 +0200 Subject: [PATCH 24/25] Add Intercept Endpoint Group resource to Network Security. (#12522) --- .../InterceptEndpointGroup.yaml | 106 ++++++++++++++++++ ...ity_intercept_endpoint_group_basic.tf.tmpl | 22 ++++ ...cept_endpoint_group_generated_test.go.tmpl | 105 +++++++++++++++++ 3 files changed, 233 insertions(+) create mode 100644 mmv1/products/networksecurity/InterceptEndpointGroup.yaml create mode 100644 mmv1/templates/terraform/examples/network_security_intercept_endpoint_group_basic.tf.tmpl create mode 100644 mmv1/third_party/terraform/services/networksecurity/resource_network_security_intercept_endpoint_group_generated_test.go.tmpl diff --git a/mmv1/products/networksecurity/InterceptEndpointGroup.yaml b/mmv1/products/networksecurity/InterceptEndpointGroup.yaml new file mode 100644 index 000000000000..f15d3c3a7d62 --- /dev/null +++ b/mmv1/products/networksecurity/InterceptEndpointGroup.yaml @@ -0,0 +1,106 @@ +# Copyright 2024 Google Inc. +# 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. + +--- +name: 'InterceptEndpointGroup' +description: An intercept endpoint group is a global resource in the consumer account representing the producer’s deployment group. +min_version: 'beta' +docs: +id_format: 'projects/{{project}}/locations/{{location}}/interceptEndpointGroups/{{intercept_endpoint_group_id}}' +base_url: 'projects/{{project}}/locations/{{location}}/interceptEndpointGroups' +self_link: 'projects/{{project}}/locations/{{location}}/interceptEndpointGroups/{{intercept_endpoint_group_id}}' +create_url: 'projects/{{project}}/locations/{{location}}/interceptEndpointGroups?interceptEndpointGroupId={{intercept_endpoint_group_id}}' +update_verb: 'PATCH' +update_mask: true +import_format: + - 'projects/{{project}}/locations/{{location}}/interceptEndpointGroups/{{intercept_endpoint_group_id}}' +timeouts: + insert_minutes: 20 + update_minutes: 20 + delete_minutes: 20 +autogen_async: true +async: + actions: ['create', 'delete', 'update'] + type: 'OpAsync' + operation: + base_url: '{{op_id}}' + path: 'name' + wait_ms: 1000 + result: + path: 'response' + resource_inside_response: true + error: + path: 'error' + message: 'message' +custom_code: +examples: + - name: 'network_security_intercept_endpoint_group_basic' + config_path: 'templates/terraform/examples/network_security_intercept_endpoint_group_basic.tf.tmpl' + primary_resource_id: 'default' + vars: + network_name: 'example-network' + deployment_group_id: 'example-dg' + endpoint_group_id: 'example-eg' +parameters: + - name: 'location' + type: String + description: 'The location of the Intercept Endpoint Group, currently restricted to `global`.' + min_version: 'beta' + url_param_only: true + required: true + immutable: true + - name: 'interceptEndpointGroupId' + type: String + description: "ID of the Intercept Endpoint Group." + min_version: 'beta' + url_param_only: true + required: true + immutable: true +properties: + - name: 'name' + type: String + description: 'Identifier. The name of the Intercept Endpoint Group.' + min_version: 'beta' + output: true + - name: 'createTime' + type: String + description: 'Create time stamp.' + min_version: 'beta' + output: true + - name: 'updateTime' + type: String + description: 'Update time stamp.' + min_version: 'beta' + output: true + - name: 'labels' + type: KeyValueLabels + description: 'Optional. Labels as key value pairs' + min_version: 'beta' + - name: 'interceptDeploymentGroup' + type: String + description: "Immutable. The Intercept Deployment Group that this resource + is connected to. Format\nis:\n`projects/{project}/locations/global/interceptDeploymentGroups/{interceptDeploymentGroup}`" + min_version: 'beta' + required: true + immutable: true + - name: 'state' + type: String + description: "Current state of the endpoint group. \n Possible values:\n + STATE_UNSPECIFIED\nACTIVE\nCLOSED\nCREATING\nDELETING\nOUT_OF_SYNC" + min_version: 'beta' + output: true + - name: 'reconciling' + type: Boolean + description: "Whether reconciling is in progress, recommended per\nhttps://google.aip.dev/128." + min_version: 'beta' + output: true diff --git a/mmv1/templates/terraform/examples/network_security_intercept_endpoint_group_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_security_intercept_endpoint_group_basic.tf.tmpl new file mode 100644 index 000000000000..6019c0a487cc --- /dev/null +++ b/mmv1/templates/terraform/examples/network_security_intercept_endpoint_group_basic.tf.tmpl @@ -0,0 +1,22 @@ +resource "google_compute_network" "network" { + provider = google-beta + name = "{{index $.Vars "network_name"}}" + auto_create_subnetworks = false +} + +resource "google_network_security_intercept_deployment_group" "deployment_group" { + provider = google-beta + intercept_deployment_group_id = "{{index $.Vars "deployment_group_id"}}" + location = "global" + network = google_compute_network.network.id +} + +resource "google_network_security_intercept_endpoint_group" "{{$.PrimaryResourceId}}" { + provider = google-beta + intercept_endpoint_group_id = "{{index $.Vars "endpoint_group_id"}}" + location = "global" + intercept_deployment_group = google_network_security_intercept_deployment_group.deployment_group.id + labels = { + foo = "bar" + } +} diff --git a/mmv1/third_party/terraform/services/networksecurity/resource_network_security_intercept_endpoint_group_generated_test.go.tmpl b/mmv1/third_party/terraform/services/networksecurity/resource_network_security_intercept_endpoint_group_generated_test.go.tmpl new file mode 100644 index 000000000000..d6841abee235 --- /dev/null +++ b/mmv1/third_party/terraform/services/networksecurity/resource_network_security_intercept_endpoint_group_generated_test.go.tmpl @@ -0,0 +1,105 @@ +package networksecurity_test +{{- if ne $.TargetVersionName "ga" }} + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + + "github.com/hashicorp/terraform-provider-google/google/acctest" +) + +func TestAccNetworkSecurityInterceptEndpointGroup_update(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), + Steps: []resource.TestStep{ + { + Config: testAccNetworkSecurityInterceptEndpointGroup_basic(context), + }, + { + ResourceName: "google_network_security_intercept_endpoint_group.default", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "terraform_labels"}, + }, + { + Config: testAccNetworkSecurityInterceptEndpointGroup_update(context), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction("google_network_security_intercept_endpoint_group.default", plancheck.ResourceActionUpdate), + }, + }, + }, + { + ResourceName: "google_network_security_intercept_endpoint_group.default", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"update_time", "labels", "terraform_labels"}, + }, + }, + }) +} + +func testAccNetworkSecurityInterceptEndpointGroup_basic(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_compute_network" "network" { + provider = google-beta + name = "tf-test-example-network%{random_suffix}" + auto_create_subnetworks = false +} + +resource "google_network_security_intercept_deployment_group" "deployment_group" { + provider = google-beta + intercept_deployment_group_id = "tf-test-example-dg%{random_suffix}" + location = "global" + network = google_compute_network.network.id +} + +resource "google_network_security_intercept_endpoint_group" "default" { + provider = google-beta + intercept_endpoint_group_id = "tf-test-example-eg%{random_suffix}" + location = "global" + intercept_deployment_group = google_network_security_intercept_deployment_group.deployment_group.id + labels = { + foo = "bar" + } +} +`, context) +} + +func testAccNetworkSecurityInterceptEndpointGroup_update(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_compute_network" "network" { + provider = google-beta + name = "tf-test-example-network%{random_suffix}" + auto_create_subnetworks = false +} + +resource "google_network_security_intercept_deployment_group" "deployment_group" { + provider = google-beta + intercept_deployment_group_id = "tf-test-example-dg%{random_suffix}" + location = "global" + network = google_compute_network.network.id +} + +resource "google_network_security_intercept_endpoint_group" "default" { + provider = google-beta + intercept_endpoint_group_id = "tf-test-example-eg%{random_suffix}" + location = "global" + intercept_deployment_group = google_network_security_intercept_deployment_group.deployment_group.id + labels = { + foo = "goo" + } +} +`, context) +} + +{{ end }} From ee0266255be4fd1cf6032a52cc1aba003cea8f36 Mon Sep 17 00:00:00 2001 From: Eric Zhao Date: Sat, 14 Dec 2024 06:30:10 +1000 Subject: [PATCH 25/25] fix: update spanner terraform doc (#12564) Co-authored-by: Eric Zhao --- .../terraform/website/docs/r/spanner_instance_iam.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mmv1/third_party/terraform/website/docs/r/spanner_instance_iam.html.markdown b/mmv1/third_party/terraform/website/docs/r/spanner_instance_iam.html.markdown index f093e8d0878b..f5745dfc9e7e 100644 --- a/mmv1/third_party/terraform/website/docs/r/spanner_instance_iam.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/spanner_instance_iam.html.markdown @@ -73,6 +73,8 @@ The following arguments are supported: * **allAuthenticatedUsers**: A special identifier that represents anyone who is authenticated with a Google account or a service account. * **user:{emailid}**: An email address that represents a specific Google account. For example, alice@gmail.com or joe@example.com. * **serviceAccount:{emailid}**: An email address that represents a service account. For example, my-other-app@appspot.gserviceaccount.com. + * **principal:{principal}**: Federated single identity. For example, principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/PROJECT_ID.svc.id.goog/subject/ns/NAMESPACE/sa/SERVICEACCOUNT + * **principalSet:{principalSet}**: Federated identity group. For example, principalSet://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/PROJECT_ID.svc.id.goog/namespace/NAMESPACE * **group:{emailid}**: An email address that represents a Google group. For example, admins@example.com. * **domain:{domain}**: A G Suite domain (primary, instead of alias) name that represents all the users of that domain. For example, google.com or example.com.