From 6e63cbb89c64d07ef24486ead904f0856159933e Mon Sep 17 00:00:00 2001 From: Sam Levenick Date: Wed, 13 Nov 2024 12:29:48 -0500 Subject: [PATCH 01/44] Add update method checking to autogen parser (#12317) --- mmv1/api/resource.go | 8 ++++---- mmv1/openapi_generate/parser.go | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/mmv1/api/resource.go b/mmv1/api/resource.go index 771c780bb48b..8cc2743787b4 100644 --- a/mmv1/api/resource.go +++ b/mmv1/api/resource.go @@ -296,6 +296,10 @@ type Resource struct { Async *Async + // Tag autogen resources so that we can track them. In the future this will + // control if a resource is continuously generated from public OpenAPI docs + AutogenStatus string `yaml:"autogen_status"` + // The three groups of []*Type fields are expected to be strictly ordered within a yaml file // in the sequence of Virtual Fields -> Parameters -> Properties @@ -330,10 +334,6 @@ type Resource struct { ApiResourceTypeKind string `yaml:"api_resource_type_kind,omitempty"` ImportPath string `yaml:"-"` - - // Tag autogen resources so that we can track them. In the future this will - // control if a resource is continuously generated from public OpenAPI docs - AutogenStatus string `yaml:"autogen_status"` } func (r *Resource) UnmarshalYAML(unmarshal func(any) error) error { diff --git a/mmv1/openapi_generate/parser.go b/mmv1/openapi_generate/parser.go index 3c2a63344e89..efc542837270 100644 --- a/mmv1/openapi_generate/parser.go +++ b/mmv1/openapi_generate/parser.go @@ -253,6 +253,13 @@ func buildResource(filePath, resourcePath, resourceName string, root *openapi3.T async.Result.ResourceInsideResponse = true resource.Async = async + if hasUpdate(resourceName, root) { + resource.UpdateVerb = "PATCH" + resource.UpdateMask = true + } else { + resource.Immutable = true + } + example := r.Examples{} example.Name = "name_of_example_file" example.PrimaryResourceId = "example" @@ -268,6 +275,20 @@ func buildResource(filePath, resourcePath, resourceName string, root *openapi3.T return resource } +func hasUpdate(resourceName string, root *openapi3.T) bool { + // Create and Update have different paths in the OpenAPI spec, so look + // through all paths to find one that matches the expected operation name + for _, pathValue := range root.Paths.Map() { + if pathValue.Patch == nil { + continue + } + if pathValue.Patch.OperationID == fmt.Sprintf("Update%s", resourceName) { + return true + } + } + return false +} + func parseOpenApi(resourcePath, resourceName string, root *openapi3.T) []any { returnArray := []any{} path := root.Paths.Find(resourcePath) From 7936dccef4c44adfed8cb11f41de80eb5ab575f8 Mon Sep 17 00:00:00 2001 From: Will Yardley Date: Wed, 13 Nov 2024 10:25:05 -0800 Subject: [PATCH 02/44] networkservices: increased `path_matcher` and `host_rule` limits (#12260) --- .../networkservices/EdgeCacheService.yaml | 4 +- ...etwork_services_edge_cache_service_test.go | 194 +++++++++--------- 2 files changed, 100 insertions(+), 98 deletions(-) diff --git a/mmv1/products/networkservices/EdgeCacheService.yaml b/mmv1/products/networkservices/EdgeCacheService.yaml index ccf534758f9a..8dc29e7098a5 100644 --- a/mmv1/products/networkservices/EdgeCacheService.yaml +++ b/mmv1/products/networkservices/EdgeCacheService.yaml @@ -191,7 +191,7 @@ properties: The name of the pathMatcher associated with this hostRule. required: true min_size: 1 - max_size: 10 + max_size: 50 - name: 'path_matcher' type: Array description: | @@ -891,7 +891,7 @@ properties: min_size: 1 max_size: 200 min_size: 1 - max_size: 10 + max_size: 50 - name: 'logConfig' type: NestedObject description: | diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_edge_cache_service_test.go b/mmv1/third_party/terraform/services/networkservices/resource_network_services_edge_cache_service_test.go index 350520a1c357..fadd14ede05c 100644 --- a/mmv1/third_party/terraform/services/networkservices/resource_network_services_edge_cache_service_test.go +++ b/mmv1/third_party/terraform/services/networkservices/resource_network_services_edge_cache_service_test.go @@ -37,107 +37,109 @@ func TestAccNetworkServicesEdgeCacheService_updateAndImport(t *testing.T) { }, }) } + func testAccNetworkServicesEdgeCacheService_update_0(bktName, originName, serviceName string) string { return fmt.Sprintf(` - resource "google_storage_bucket" "dest" { - name = "%s" - location = "US" - force_destroy = true - } - resource "google_network_services_edge_cache_origin" "instance" { - name = "%s" - origin_address = google_storage_bucket.dest.url - description = "The default bucket for media edge test" - max_attempts = 2 - timeout { - connect_timeout = "10s" - } - } - resource "google_network_services_edge_cache_service" "served" { - name = "%s" - description = "some description" - routing { - host_rule { - description = "host rule description" - hosts = ["sslcert.tf-test.club"] - path_matcher = "routes" - } - path_matcher { - name = "routes" - route_rule { - description = "a route rule to match against" - priority = 1 - match_rule { - prefix_match = "/" - } - origin = google_network_services_edge_cache_origin.instance.name - route_action { - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = "3600s" - } - } - header_action { - response_header_to_add { - header_name = "x-cache-status" - header_value = "{cdn_cache_status}" - } - } - } - } - } - } +resource "google_storage_bucket" "dest" { + name = "%s" + location = "US" + force_destroy = true +} +resource "google_network_services_edge_cache_origin" "instance" { + name = "%s" + origin_address = google_storage_bucket.dest.url + description = "The default bucket for media edge test" + max_attempts = 2 + timeout { + connect_timeout = "10s" + } +} +resource "google_network_services_edge_cache_service" "served" { + name = "%s" + description = "some description" + routing { + host_rule { + description = "host rule description" + hosts = ["sslcert.tf-test.club"] + path_matcher = "routes" + } + path_matcher { + name = "routes" + route_rule { + description = "a route rule to match against" + priority = 1 + match_rule { + prefix_match = "/" + } + origin = google_network_services_edge_cache_origin.instance.name + route_action { + cdn_policy { + cache_mode = "CACHE_ALL_STATIC" + default_ttl = "3600s" + } + } + header_action { + response_header_to_add { + header_name = "x-cache-status" + header_value = "{cdn_cache_status}" + } + } + } + } + } +} `, bktName, originName, serviceName) } + func testAccNetworkServicesEdgeCacheService_update_1(bktName, originName, serviceName string) string { return fmt.Sprintf(` - resource "google_storage_bucket" "dest" { - name = "%s" - location = "US" - force_destroy = true - } - resource "google_network_services_edge_cache_origin" "instance" { - name = "%s" - origin_address = google_storage_bucket.dest.url - description = "The default bucket for media edge test" - max_attempts = 2 - timeout { - connect_timeout = "10s" - } - } - resource "google_network_services_edge_cache_service" "served" { - name = "%s" - description = "some description" - routing { - host_rule { - description = "host rule description" - hosts = ["sslcert.tf-test.club"] - path_matcher = "routes" - } - path_matcher { - name = "routes" - route_rule { - description = "a route rule to match against" - priority = 1 - match_rule { - prefix_match = "/" - } - origin = google_network_services_edge_cache_origin.instance.name - route_action { - cdn_policy { - cache_mode = "CACHE_ALL_STATIC" - default_ttl = "3600s" - } - } - header_action { - response_header_to_add { - header_name = "x-cache-status" - header_value = "{cdn_cache_status}" - } - } - } - } - } - } +resource "google_storage_bucket" "dest" { + name = "%s" + location = "US" + force_destroy = true +} +resource "google_network_services_edge_cache_origin" "instance" { + name = "%s" + origin_address = google_storage_bucket.dest.url + description = "The default bucket for media edge test" + max_attempts = 2 + timeout { + connect_timeout = "10s" + } +} +resource "google_network_services_edge_cache_service" "served" { + name = "%s" + description = "some description" + routing { + host_rule { + description = "host rule description" + hosts = ["sslcert.tf-test.club"] + path_matcher = "routes" + } + path_matcher { + name = "routes" + route_rule { + description = "a route rule to match against" + priority = 1 + match_rule { + prefix_match = "/" + } + origin = google_network_services_edge_cache_origin.instance.name + route_action { + cdn_policy { + cache_mode = "CACHE_ALL_STATIC" + default_ttl = "3600s" + } + } + header_action { + response_header_to_add { + header_name = "x-cache-status" + header_value = "{cdn_cache_status}" + } + } + } + } + } +} `, bktName, originName, serviceName) } From a39b35536d101b5a79e24457fa81c3d6ceddeb2c Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Wed, 13 Nov 2024 11:36:31 -0800 Subject: [PATCH 03/44] Migrate compute firewall policy rule in GA (#12310) --- mmv1/products/compute/FirewallPolicyRule.yaml | 1 - .../terraform/examples/firewall_policy_rule.tf.tmpl | 8 -------- .../terraform/services/compute/compute_operation.go.tmpl | 9 --------- tpgtools/overrides/compute/firewall_policy_rule.yaml | 8 -------- 4 files changed, 26 deletions(-) delete mode 100644 tpgtools/overrides/compute/firewall_policy_rule.yaml diff --git a/mmv1/products/compute/FirewallPolicyRule.yaml b/mmv1/products/compute/FirewallPolicyRule.yaml index 28e3674a2911..1264e8cd3345 100644 --- a/mmv1/products/compute/FirewallPolicyRule.yaml +++ b/mmv1/products/compute/FirewallPolicyRule.yaml @@ -16,7 +16,6 @@ name: 'FirewallPolicyRule' kind: 'compute#firewallPolicyRule' description: | Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny). -min_version: 'beta' references: guides: api: 'https://cloud.google.com/compute/docs/reference/rest/v1/firewallPolicies/addRule' diff --git a/mmv1/templates/terraform/examples/firewall_policy_rule.tf.tmpl b/mmv1/templates/terraform/examples/firewall_policy_rule.tf.tmpl index 3309cb78d89e..5a8b09187625 100644 --- a/mmv1/templates/terraform/examples/firewall_policy_rule.tf.tmpl +++ b/mmv1/templates/terraform/examples/firewall_policy_rule.tf.tmpl @@ -1,6 +1,4 @@ resource "google_network_security_address_group" "basic_global_networksecurity_address_group" { - provider = google-beta - name = "{{index $.Vars "address"}}" parent = "organizations/{{index $.TestEnvVars "org_id"}}" description = "Sample global networksecurity_address_group" @@ -11,24 +9,18 @@ resource "google_network_security_address_group" "basic_global_networksecurity_a } resource "google_folder" "folder" { - provider = google-beta - display_name = "{{index $.Vars "folder"}}" parent = "organizations/{{index $.TestEnvVars "org_id"}}" deletion_protection = false } resource "google_compute_firewall_policy" "default" { - provider = google-beta - parent = google_folder.folder.id short_name = "{{index $.Vars "fw_policy"}}" description = "Resource created for Terraform acceptance testing" } resource "google_compute_firewall_policy_rule" "{{$.PrimaryResourceId}}" { - provider = google-beta - firewall_policy = google_compute_firewall_policy.default.name description = "Resource created for Terraform acceptance testing" priority = 9000 diff --git a/mmv1/third_party/terraform/services/compute/compute_operation.go.tmpl b/mmv1/third_party/terraform/services/compute/compute_operation.go.tmpl index 1c9b176575e5..1b0fe8319a8f 100644 --- a/mmv1/third_party/terraform/services/compute/compute_operation.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/compute_operation.go.tmpl @@ -3,9 +3,7 @@ package compute import ( "bytes" "context" -{{- if ne $.TargetVersionName "ga" }} "encoding/json" -{{- end }} "errors" "fmt" "io" @@ -27,9 +25,7 @@ type ComputeOperationWaiter struct { Op *compute.Operation Context context.Context Project string -{{- if ne $.TargetVersionName "ga" }} Parent string -{{- end }} } func (w *ComputeOperationWaiter) State() string { @@ -86,10 +82,8 @@ func (w *ComputeOperationWaiter) QueryOp() (interface{}, error) { } else if w.Op.Region != "" { region := tpgresource.GetResourceNameFromSelfLink(w.Op.Region) return w.Service.RegionOperations.Get(w.Project, region, w.Op.Name).Do() -{{- if ne $.TargetVersionName "ga" }} } else if w.Parent != "" { return w.Service.GlobalOrganizationOperations.Get(w.Op.Name).ParentId(w.Parent).Do() -{{- end }} } return w.Service.GlobalOperations.Get(w.Project, w.Op.Name).Do() } @@ -130,7 +124,6 @@ func ComputeOperationWaitTime(config *transport_tpg.Config, res interface{}, pro return tpgresource.OperationWait(w, activity, timeout, config.PollInterval) } -{{ if ne $.TargetVersionName `ga` -}} func ComputeOrgOperationWaitTimeWithResponse(config *transport_tpg.Config, res interface{}, response *map[string]interface{}, parent, activity, userAgent string, timeout time.Duration) error { op := &compute.Operation{} err := tpgresource.Convert(res, op) @@ -157,8 +150,6 @@ func ComputeOrgOperationWaitTimeWithResponse(config *transport_tpg.Config, res i return json.Unmarshal(e, response) } -{{ end }} - // ComputeOperationError wraps compute.OperationError and implements the // error interface so it can be returned. type ComputeOperationError compute.OperationError diff --git a/tpgtools/overrides/compute/firewall_policy_rule.yaml b/tpgtools/overrides/compute/firewall_policy_rule.yaml deleted file mode 100644 index fb5004c97989..000000000000 --- a/tpgtools/overrides/compute/firewall_policy_rule.yaml +++ /dev/null @@ -1,8 +0,0 @@ -- type: DIFF_SUPPRESS_FUNC - field: target_resources - details: - diffsuppressfunc: tpgresource.CompareSelfLinkOrResourceName -- type: CUSTOMIZE_DIFF - details: - functions: - - tpgresource.DefaultProviderProject \ No newline at end of file From 4f92f5973c486d0bb16679e5f31352ebd5bf1019 Mon Sep 17 00:00:00 2001 From: Will Yardley Date: Wed, 13 Nov 2024 12:25:12 -0800 Subject: [PATCH 04/44] container: fix `TestAccContainerCluster_withFleetConfig` failure (#12307) --- .../services/container/resource_container_cluster_test.go.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl index cdbe59ad610d..67d6655fa2ba 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl @@ -5232,7 +5232,8 @@ func TestAccContainerCluster_withFleetConfig(t *testing.T) { ImportStateVerifyIgnore: []string{"min_master_version", "deletion_protection"}, }, { - Config: testAccContainerCluster_withFleetConfig(clusterName, "random-project", networkName, subnetworkName), + // This project must exist, though no permissions are needed on it. + Config: testAccContainerCluster_withFleetConfig(clusterName, "tdx-guest-images", networkName, subnetworkName), ExpectError: regexp.MustCompile(`changing existing fleet host project is not supported`), }, { From 4dc6dd682322acd250fcbf5c2f7950a71dc0f5af Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Wed, 13 Nov 2024 12:27:10 -0800 Subject: [PATCH 05/44] Remove unused id list from ImportIdFormatsFromResource function (#12321) --- mmv1/api/resource.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mmv1/api/resource.go b/mmv1/api/resource.go index 8cc2743787b4..3edcd10210c1 100644 --- a/mmv1/api/resource.go +++ b/mmv1/api/resource.go @@ -1007,11 +1007,6 @@ func (r Resource) TerraformName() string { } func (r Resource) ImportIdFormatsFromResource() []string { - - var ids []string - for _, id := range r.GetIdentity() { - ids = append(ids, google.Underscore(id.Name)) - } return ImportIdFormats(r.ImportFormat, r.Identity, r.BaseUrl) } From b27a58f8e22ee1e01f7e7914b21974e478437bd7 Mon Sep 17 00:00:00 2001 From: Iris Chen <10179943+iyabchen@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:53:27 -0800 Subject: [PATCH 06/44] support skip_test option in yaml file (#12273) Co-authored-by: Stephen Lewis (Burrows) --- mmv1/api/resource/examples.go | 4 ++++ .../terraform/examples/base_configs/test_file.go.tmpl | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/mmv1/api/resource/examples.go b/mmv1/api/resource/examples.go index 7130c5b0d655..e01d1c48dc5c 100644 --- a/mmv1/api/resource/examples.go +++ b/mmv1/api/resource/examples.go @@ -149,6 +149,10 @@ type Examples struct { // Or a config with two fine grained resources that have a race condition during create SkipVcr bool `yaml:"skip_vcr,omitempty"` + // The reason to skip a test. For example, a link to a ticket explaining the issue that needs to be resolved before + // unskipping the test. If this is not empty, the test will be skipped. + SkipTest string `yaml:"skip_test,omitempty"` + // Specify which external providers are needed for the testcase. // Think before adding as there is latency and adds an external dependency to // your test so avoid if you can. diff --git a/mmv1/templates/terraform/examples/base_configs/test_file.go.tmpl b/mmv1/templates/terraform/examples/base_configs/test_file.go.tmpl index 140166e339db..197407eb4bcc 100644 --- a/mmv1/templates/terraform/examples/base_configs/test_file.go.tmpl +++ b/mmv1/templates/terraform/examples/base_configs/test_file.go.tmpl @@ -38,6 +38,10 @@ import ( ) {{ range $e := $.Res.TestExamples }} func TestAcc{{ $e.TestSlug $.Res.ProductMetadata.Name $.Res.Name }}(t *testing.T) { + {{- if $e.SkipTest }} + t.Skip("{{$e.SkipTest}}") + {{- end }} + {{- if $e.SkipVcr }} acctest.SkipIfVcr(t) {{- end }} From d1c06aec3336adcaca9cc0ffa12b090a9517d8fd Mon Sep 17 00:00:00 2001 From: nityaravi <32396647+nityaravi@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:32:24 -0500 Subject: [PATCH 07/44] addressing b/378725229 (#12322) Co-authored-by: Nitya Ravi Co-authored-by: Stephen Lewis (Burrows) --- docs/content/_index.md | 104 ++++++++++++++++-- .../{get-started => }/contribution-process.md | 5 +- .../make-a-breaking-change.md | 2 +- docs/content/develop/custom-code.md | 2 +- docs/content/develop/promote-to-ga.md | 2 +- docs/content/develop/resource.md | 6 +- docs/content/develop/test/test.md | 2 +- .../content/get-started/generate-providers.md | 6 +- .../get-started/how-magic-modules-works.md | 59 ---------- 9 files changed, 110 insertions(+), 78 deletions(-) rename docs/content/{get-started => }/contribution-process.md (92%) delete mode 100644 docs/content/get-started/how-magic-modules-works.md diff --git a/docs/content/_index.md b/docs/content/_index.md index 294e44cb1440..ef60d84e8dc7 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -1,12 +1,16 @@ --- title: "Overview" +weight: 20 +aliases: + - /docs/how-to/types-of-resources + - /how-to/types-of-resources + - /get-started/how-magic-modules-works --- - # Magic Modules Magic Modules is a code generator and CI system that's used to develop the Terraform providers -for Google Platform, [`google`](https://github.com/hashicorp/terraform-provider-google) (or TPG) and +for Google Cloud, [`google`](https://github.com/hashicorp/terraform-provider-google) (or TPG) and [`google-beta`](https://github.com/hashicorp/terraform-provider-google-beta) (or TPGB). Magic Modules allows contributors to make changes against a single codebase and develop both @@ -15,13 +19,97 @@ provider versions simultaneously. After sending a pull request against this repo complete output, running presubmit tests, and updating the providers following your change. -## Getting started +## How Magic Modules works + +Magic Modules can be thought of as a source of truth for how to map a Google Cloud API resource +representation to a Terraform resource (or datasource) representation. Magic Modules uses that mapping +(and additional handwritten code where necessary) to generate "downstream" repositories - in particular, +the Terraform providers for Google Cloud: [`google`](https://github.com/hashicorp/terraform-provider-google) +(or TPG) and [`google-beta`](https://github.com/hashicorp/terraform-provider-google-beta) (or TPGB). + +Generation of the downstream repositories happens for every new commit in a PR (to a temporary branch owned by +the [`modular-magician`](https://github.com/modular-magician/) robot user) and on every merge into the main branch +(to the main branch of downstreams). Generation for PR commits allows contributors to manually examine the changes, +as well as allowing automatic running of unit tests, acceptance tests, and automated checks such as breaking change +detection. + +### Resource types + +There are three types of resources supported by Magic Modules: + ++ MMv1 ++ Handwritten ++ DCL/tpgtools + +The following sections describe these tools in detail. + +#### MMv1 + +MMv1 consists of a set of "products"; each product contains one or more "resources". + +Each product has a folder in +[`magic-modules/mmv1/products`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products). +The name of the folder is the "product name", which usually corresponds to the API subdomain covered by the +product (such as `compute.googleapis.com`). Each product folder contains a product configuration file +(`product.yaml`) and one or more resource configuration files (`ResourceName.yaml`). The actual name of a +`ResourceName.yaml` file usually matches the name of a GCP API resource in the product's subdomain. + +MMv1 resource configurations may reference handwritten code stored in +[`magic-modules/mmv1/templates/terraform`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform), +which will be injected into the generated resource file. Many MMv1 resources also have one or more handwritten tests, +which are stored in the appropriate service folder inside +[`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services). + +In the providers, MMv1-based resources are stored in `PROVIDER/services/PRODUCT/resource_PRODUCT_RESOURCE.go`, where `PROVIDER` +is `google` or `google-beta`, `PRODUCT` is the product name, and RESOURCE is the GCP API resource's name converted to +[snake case ↗](https://en.wikipedia.org/wiki/Snake_case). + +MMv1-based files start with the following header: + +``` +***     AUTO GENERATED CODE    ***    Type: MMv1     *** +``` + +#### Handwritten + +Handwritten resources and datasources are technically part of MMv1; however, they are not generated from YAML configurations. +Instead, they are written as Go code with minimal go template "version guards" to exclude beta-only features from the `google` +provider. + +Handwritten resources and datasources can be grouped by "service", which generally corresponds to the API subdomain the resource +or datasource interacts with. + +In addition to the core implementation, handwritten resources and datasources will also have documentation, tests, and sweepers +(which clean up stray resources left behind by tests). Each type of code is stored in the following locations: + ++ Resource & datasource implementation: In the appropriate service folder inside + [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) ++ Resource documentation: + [`magic-modules/mmv1/third_party/terraform/website/docs/r`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) ++ Datasource documentation: + [`magic-modules/mmv1/third_party/terraform/website/docs/d`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/d) ++ Tests: In the appropriate service folder inside + [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) ++ Sweepers: [`magic-modules/mmv1/third_party/terraform/utils`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/utils) + +In the providers, handwritten resources and datasources are stored in `PROVIDER/services/SERVICE/FILENAME.go`, where `PROVIDER` +is `google` or `google-beta`, `SERVICE` is the service name, and `FILENAME` is the name of the handwritten file in magic-modules. +Handwritten files do not have an `AUTO GENERATED CODE` header. + +#### DCL aka tpgtools (maintenance mode) + +DCL / tpgtools is similar to MMv1; however, it is in maintenance mode, which means that new resources using the DCL are not being added. + +DCL-based files start with the following header: + +``` +***     AUTO GENERATED CODE    ***    Type: DCL     *** +``` -Check out the [setup guide]({{< ref "/get-started/generate-providers" >}}) for information on how to set up your environment. ## Other Resources -* [Extending Terraform](https://www.terraform.io/plugin) - * [How Terraform Works](https://www.terraform.io/plugin/how-terraform-works) - * [Writing Custom Providers / Calling APIs with Terraform Providers](https://learn.hashicorp.com/collections/terraform/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) -* [Terraform Glossary](https://www.terraform.io/docs/glossary) ++ [Extending Terraform](https://www.terraform.io/plugin) + + [How Terraform Works](https://www.terraform.io/plugin/how-terraform-works) + + [Writing Custom Providers / Calling APIs with Terraform Providers](https://learn.hashicorp.com/collections/terraform/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) ++ [Terraform Glossary](https://www.terraform.io/docs/glossary) diff --git a/docs/content/get-started/contribution-process.md b/docs/content/contribution-process.md similarity index 92% rename from docs/content/get-started/contribution-process.md rename to docs/content/contribution-process.md index bda0300dfbdd..89ff42a68ed0 100644 --- a/docs/content/get-started/contribution-process.md +++ b/docs/content/contribution-process.md @@ -1,14 +1,17 @@ --- title: "Contribution process" -weight: 50 +weight: 9 aliases: - /docs/getting-started/contributing - /getting-started/contributing - /get-started/contributing + - /get-started/contribution-process --- # Contribution process +This page explains how you can contribute code and documentation to the `magic-modules` repository. + ## Before you begin 1. Familiarize yourself with [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow) diff --git a/docs/content/develop/breaking-changes/make-a-breaking-change.md b/docs/content/develop/breaking-changes/make-a-breaking-change.md index 47f3e09d227c..bb4e62499955 100644 --- a/docs/content/develop/breaking-changes/make-a-breaking-change.md +++ b/docs/content/develop/breaking-changes/make-a-breaking-change.md @@ -174,7 +174,7 @@ or resource. It is also great to log warnings at runtime if possible. When working on your breaking change, make sure that your base branch is `FEATURE-BRANCH-major-release-{{% param "majorVersion" %}}`. This means that you will follow the standard -[contribution process]({{< ref "/get-started/contribution-process" >}}) +[contribution process]({{< ref "/contribution-process" >}}) with the following changes: 1. Before you start, check out and sync your local `magic-modules` and provider diff --git a/docs/content/develop/custom-code.md b/docs/content/develop/custom-code.md index b769ce1bf83f..c5ae9dea9996 100644 --- a/docs/content/develop/custom-code.md +++ b/docs/content/develop/custom-code.md @@ -5,7 +5,7 @@ weight: 39 # Add custom resource code -This document covers how to add "custom code" to [MMv1 resources]({{< ref "/get-started/how-magic-modules-works#mmv1" >}}). Custom code can be used to add arbitrary logic to a resource while still generating most of the code; it allows for a balance between maintainability and supporting real-worlds APIs that deviate from what MMv1 can support. Custom code should only be added if the desired behavior can't be achieved otherwise. +This document covers how to add "custom code" to [MMv1 resources]({{< ref "/#mmv1" >}}). Custom code can be used to add arbitrary logic to a resource while still generating most of the code; it allows for a balance between maintainability and supporting real-worlds APIs that deviate from what MMv1 can support. Custom code should only be added if the desired behavior can't be achieved otherwise. Most custom code attributes are strings that contain a path to a template file relative to the `mmv1` directory. For example: diff --git a/docs/content/develop/promote-to-ga.md b/docs/content/develop/promote-to-ga.md index 91c64fb3252e..c03bcefcc83f 100644 --- a/docs/content/develop/promote-to-ga.md +++ b/docs/content/develop/promote-to-ga.md @@ -9,7 +9,7 @@ This document describes how to promote an existing resource or field that uses M Handwritten code (including `custom_code`) commonly uses "version guards" in the form of `{{- if ne $.TargetVersionName "ga" }}...{{- end }}` to wrap code that is beta-specific, which need to be removed during promotion. -For more information about types of resources and the generation process overall, see [How Magic Modules works]({{< ref "/get-started/how-magic-modules-works.md" >}}). +For more information about types of resources and the generation process overall, see [How Magic Modules works]({{< ref "/" >}}). ## Before you begin diff --git a/docs/content/develop/resource.md b/docs/content/develop/resource.md index c6ccb54ce843..eaf9dfe454c2 100644 --- a/docs/content/develop/resource.md +++ b/docs/content/develop/resource.md @@ -27,11 +27,11 @@ aliases: This page describes how to add a new resource to the `google` or `google-beta` Terraform provider using MMv1 and/or handwritten code. -For more information about types of resources and the generation process overall, see [How Magic Modules works]({{< ref "/get-started/how-magic-modules-works.md" >}}). +For more information about types of resources and the generation process overall, see [How Magic Modules works]({{< ref "/" >}}). ## Before you begin -1. Complete the [Generate the providers]({{< ref "/get-started/generate-providers" >}}) quickstart to set up your environment and your Google Cloud project. +1. Complete the steps in [Generate the providers]({{< ref "/get-started/generate-providers" >}}) to set up your environment and your Google Cloud project. 2. Ensure that your `magic-modules`, `terraform-provider-google`, and `terraform-provider-google-beta` repositories are up to date. ``` cd ~/magic-modules @@ -46,7 +46,7 @@ For more information about types of resources and the generation process overall {{< tabs "resource" >}} {{< tab "MMv1" >}} -1. Using an editor of your choice, in the appropriate [product folder]({{}}), create a file called `RESOURCE_NAME.yaml`. Replace `RESOURCE_NAME` with the name of the API resource you are adding support for. For example, a configuration file for [NatAddress](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.instances.natAddresses) would be called `NatAddress.yaml`. +1. Using an editor of your choice, in the appropriate [product folder]({{}}), create a file called `RESOURCE_NAME.yaml`. Replace `RESOURCE_NAME` with the name of the API resource you are adding support for. For example, a configuration file for [NatAddress](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.instances.natAddresses) would be called `NatAddress.yaml`. 2. Copy the following template into the new file: ```yaml # Copyright 2024 Google Inc. diff --git a/docs/content/develop/test/test.md b/docs/content/develop/test/test.md index 4d3bc2c6343b..d6e55784cf1b 100644 --- a/docs/content/develop/test/test.md +++ b/docs/content/develop/test/test.md @@ -26,7 +26,7 @@ For more information about testing, see the [official Terraform documentation](h ## Before you begin -1. Determine whether your resources is using [MMv1 generation or handwritten]({{}}). +1. Determine whether your resources is using [MMv1 generation or handwritten]({{}}). 2. If you are not adding tests to an in-progress PR, ensure that your `magic-modules`, `terraform-provider-google`, and `terraform-provider-google-beta` repositories are up to date. ```bash cd ~/magic-modules diff --git a/docs/content/get-started/generate-providers.md b/docs/content/get-started/generate-providers.md index 41beb7a57c3c..eaf0e1ae109e 100644 --- a/docs/content/get-started/generate-providers.md +++ b/docs/content/get-started/generate-providers.md @@ -192,6 +192,6 @@ gcloud auth revoke ## What's next -- [Learn about Magic Modules]({{< ref "/get-started/how-magic-modules-works.md" >}}) -- [Learn about the contribution process]({{< ref "/get-started/contribution-process.md" >}}) -- [Learn about make commands]({{< ref "/reference/make-commands.md" >}}) +- [Learn about Magic Modules]({{< ref "/" >}}) +- [Learn about the contribution process]({{< ref "/contribution-process.md" >}}) +- [Learn about make commands]({{< ref "/reference/make-commands.md" >}}) \ No newline at end of file diff --git a/docs/content/get-started/how-magic-modules-works.md b/docs/content/get-started/how-magic-modules-works.md deleted file mode 100644 index 520bf739eb70..000000000000 --- a/docs/content/get-started/how-magic-modules-works.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: "How Magic Modules works" -weight: 20 -aliases: - - /docs/how-to/types-of-resources - - /how-to/types-of-resources ---- - -# How Magic Modules works - -Magic Modules can be thought of as a source of truth for how to map a GCP API resource representation to a Terraform resource (or datasource) representation. Magic Modules uses that mapping (and additional handwritten code where necessary) to generate "downstream" repositories - in particular, the Terraform providers for Google Cloud: [`google`](https://github.com/hashicorp/terraform-provider-google) (or TPG) and [`google-beta`](https://github.com/hashicorp/terraform-provider-google-beta) (or TPGB). - -Generation of the downstream repositories happens for every new commit in a PR (to a temporary branch owned by the [`modular-magician`](https://github.com/modular-magician/) robot user) and on every merge into the main branch (to the main branch of downstreams). Generation for PR commits allows contributors to manually examine the changes, as well as allowing automatic running of unit tests, acceptance tests, and automated checks such as breaking change detection. - -## Resource types - -There are three types of resources supported by Magic Modules: MMv1, Handwritten, and DCL/tpgtools. These are described in more detail in the following sections. - -### MMv1 - -MMv1 consists of a set of "products"; each product contains one or more "resources". - -Each product has a folder in [`magic-modules/mmv1/products`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products). The name of the folder is the "product name", which usually corresponds to the API subdomain covered by the product (such as `compute.googleapis.com`). Each product folder contains a product configuration file (`product.yaml`) and one or more resource configuration files (`ResourceName.yaml`). The actual name of a `ResourceName.yaml` file usually matches the name of a GCP API resource in the product's subdomain. - -MMv1 resource configurations may reference handwritten code stored in [`magic-modules/mmv1/templates/terraform`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform), which will be injected into the generated resource file. Many MMv1 resources also have one or more handwritten tests, which are stored in the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) - -In the providers, MMv1-based resources are stored in `PROVIDER/services/PRODUCT/resource_PRODUCT_RESOURCE.go`, where `PROVIDER` is `google` or `google-beta`, `PRODUCT` is the product name, and RESOURCE is the GCP API resource's name converted to [snake case ↗](https://en.wikipedia.org/wiki/Snake_case). - -MMv1-based files start with the following header: - -``` -*** AUTO GENERATED CODE *** Type: MMv1 *** -``` - -### Handwritten - -Handwritten resources and datasources are technically part of MMv1; however, they are not generated from YAML configurations. Instead, they are written as Go code with minimal go template "version guards" to exclude beta-only features from the `google` provider. - -Handwritten resources and datasources can be grouped by "service", which generally corresponds to the API subdomain the resource or datasource interacts with. - -In addition to the core implementation, handwritten resources and datasources will also have documentation, tests, and sweepers (which clean up stray resources left behind by tests). Each type of code is stored in the following locations: - -- Resource & datasource implementation: In the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) -- Resource documentation: [`magic-modules/mmv1/third_party/terraform/website/docs/r`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) -- Datasource documentation: [`magic-modules/mmv1/third_party/terraform/website/docs/d`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/d) -- Tests: In the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) -- Sweepers: [`magic-modules/mmv1/third_party/terraform/utils`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/utils) - -In the providers, handwritten resources and datasources are stored in `PROVIDER/services/SERVICE/FILENAME.go`, where `PROVIDER` is `google` or `google-beta`, `SERVICE` is the service name, and `FILENAME` is the name of the handwritten file in magic-modules. Handwritten files do not have an `AUTO GENERATED CODE` header. - -### DCL aka tpgtools (maintenance mode) - -DCL / tpgtools is similar to MMv1; however, it is in maintenance mode, which means that new resources using the DCL are not being added. - -DCL-based files start with the following header: - -``` -*** AUTO GENERATED CODE *** Type: DCL *** -``` From 01701dc5ba715d63ec8ac50003dfcf3ffe776704 Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Thu, 14 Nov 2024 17:49:10 +0000 Subject: [PATCH 08/44] Make top-level immutable field more visible in the contribution guide (#12328) --- docs/content/develop/resource.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/develop/resource.md b/docs/content/develop/resource.md index eaf9dfe454c2..1e1e8107e2f4 100644 --- a/docs/content/develop/resource.md +++ b/docs/content/develop/resource.md @@ -92,7 +92,7 @@ For more information about types of resources and the generation process overall # If true, the resource and all its fields are considered immutable - that is, # only creatable, not updatable. Individual fields can override this if they # have a custom update method in the API. - # immutable: true + immutable: true # URL for the resource's standard Create method, including query parameters. # https://google.aip.dev/133 From 66325604d06fe60dadef5e71ef5f3985827735d1 Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Thu, 14 Nov 2024 18:03:02 +0000 Subject: [PATCH 09/44] Update `clean-provider` target in GNUmakefile to not remove TPG/TPGB CODEOWNERS files (#12274) --- GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index 118b5aabe343..bc83284d3c00 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -75,7 +75,7 @@ tpgtools: clean-provider: cd $(OUTPUT_PATH);\ go mod download;\ - find . -type f -not -wholename "./.git*" -not -wholename "./.changelog*" -not -name ".travis.yml" -not -name ".golangci.yml" -not -name "CHANGELOG.md" -not -name "CHANGELOG_v*.md" -not -name "GNUmakefile" -not -name "docscheck.sh" -not -name "LICENSE" -not -name "README.md" -not -wholename "./examples*" -not -name ".go-version" -not -name ".hashibot.hcl" -print0 | xargs -0 git rm > /dev/null + find . -type f -not -wholename "./.git*" -not -wholename "./.changelog*" -not -name ".travis.yml" -not -name ".golangci.yml" -not -name "CHANGELOG.md" -not -name "CHANGELOG_v*.md" -not -name "GNUmakefile" -not -name "docscheck.sh" -not -name "LICENSE" -not -name "CODEOWNERS" -not -name "README.md" -not -wholename "./examples*" -not -name ".go-version" -not -name ".hashibot.hcl" -print0 | xargs -0 git rm > /dev/null clean-tgc: cd $(OUTPUT_PATH);\ From 77a08ce6aa3154dcaa7d855e05043b1fe38cd9df Mon Sep 17 00:00:00 2001 From: Sarah French <15078782+SarahFrench@users.noreply.github.com> Date: Thu, 14 Nov 2024 18:31:33 +0000 Subject: [PATCH 10/44] Update constants.kt (#12329) --- mmv1/third_party/terraform/.teamcity/components/constants.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/constants.kt b/mmv1/third_party/terraform/.teamcity/components/constants.kt index a3a97fcc9f33..bb1bca75d390 100644 --- a/mmv1/third_party/terraform/.teamcity/components/constants.kt +++ b/mmv1/third_party/terraform/.teamcity/components/constants.kt @@ -16,6 +16,7 @@ const val DefaultStartHour = 4 const val DefaultParallelism = 6 // specifies the default version of Terraform Core which should be used for testing +// this is updated semi-regularly const val DefaultTerraformCoreVersion = "1.8.3" // This represents a cron view of days of the week @@ -47,4 +48,4 @@ const val VcrRecordingProjectId = "VCRRecording" // Artifact rules controls which artifacts are uploaded to S3 // https://www.jetbrains.com/help/teamcity/2024.07/configuring-general-settings.html#Artifact+Paths // The value below lacks a file extension, to allow upload of individual .txt files or a single .tar.gz file -const val ArtifactRules = "%teamcity.build.checkoutDir%/debug*" \ No newline at end of file +const val ArtifactRules = "%teamcity.build.checkoutDir%/debug*" From ee0a468f6cffd4f3891b974ddddc068131ec4b7d Mon Sep 17 00:00:00 2001 From: Philipp Schneider <47689073+philipp-tailor@users.noreply.github.com> Date: Thu, 14 Nov 2024 21:32:06 +0100 Subject: [PATCH 11/44] Clarify `responseHeader` in `Bucket.yaml` (#12326) --- mmv1/products/storage/Bucket.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mmv1/products/storage/Bucket.yaml b/mmv1/products/storage/Bucket.yaml index 66a9a3ab5961..d19113caeebf 100644 --- a/mmv1/products/storage/Bucket.yaml +++ b/mmv1/products/storage/Bucket.yaml @@ -189,8 +189,9 @@ properties: - name: 'responseHeader' type: Array description: | - The list of HTTP headers other than the simple response headers - to give permission for the user-agent to share across domains. + The list of HTTP headers to give permission for the user-agent + to share across domains. A typical example would e.g. be to + allow the `Content-Type` header. item_type: type: String - name: 'defaultEventBasedHold' From 171b7b6a7cab20139942409c2a2b1b9c8c1fdcb8 Mon Sep 17 00:00:00 2001 From: unnatinadupalli <156947936+unnatinadupalli@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:00:53 -0800 Subject: [PATCH 12/44] promoting `google_parallelstore_instance` to ga (#12271) Co-authored-by: Sarah French --- mmv1/products/parallelstore/Instance.yaml | 18 ------------------ mmv1/products/parallelstore/product.yaml | 2 ++ .../parallelstore_instance_basic.tf.tmpl | 4 ---- ...esource_parallelstore_instance_test.go.tmpl | 15 ++------------- 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/mmv1/products/parallelstore/Instance.yaml b/mmv1/products/parallelstore/Instance.yaml index 0fa94952c537..77e8e46fabe6 100644 --- a/mmv1/products/parallelstore/Instance.yaml +++ b/mmv1/products/parallelstore/Instance.yaml @@ -14,7 +14,6 @@ --- name: 'Instance' description: A Parallelstore Instance. -min_version: 'beta' docs: id_format: 'projects/{{project}}/locations/{{location}}/instances/{{instance_id}}' base_url: 'projects/{{project}}/locations/{{location}}/instances' @@ -46,7 +45,6 @@ custom_code: examples: - name: 'parallelstore_instance_basic' primary_resource_id: 'instance' - min_version: 'beta' vars: name: 'instance' network_name: 'network' @@ -56,7 +54,6 @@ parameters: type: String description: | Part of `parent`. See documentation of `projectsId`. - min_version: 'beta' url_param_only: true required: true immutable: true @@ -69,7 +66,6 @@ parameters: * Must be between 1-63 characters. * Must end with a number or a letter. * Must be unique within the customer project/ location - min_version: 'beta' url_param_only: true required: true immutable: true @@ -79,13 +75,11 @@ properties: description: | Identifier. The resource name of the instance, in the format `projects/{project}/locations/{location}/instances/{instance_id}` - min_version: 'beta' output: true - name: 'description' type: String description: | The description of the instance. 2048 characters or less. - min_version: 'beta' - name: 'state' type: String description: | @@ -97,19 +91,16 @@ properties: DELETING FAILED UPGRADING - min_version: 'beta' output: true - name: 'createTime' type: String description: | The time when the instance was created. - min_version: 'beta' output: true - name: 'updateTime' type: String description: | The time when the instance was updated. - min_version: 'beta' output: true - name: 'labels' type: KeyValueLabels @@ -135,26 +126,22 @@ properties: specific characters being disallowed. For example, representing labels as the string: `name + "_" + value` would prove problematic if we were to allow `"_"` in a future release. " - min_version: 'beta' - name: 'capacityGib' type: String description: | Required. Immutable. Storage capacity of Parallelstore instance in Gibibytes (GiB). - min_version: 'beta' required: true immutable: true - name: 'daosVersion' type: String description: | The version of DAOS software running in the instance. - min_version: 'beta' output: true - name: 'accessPoints' type: Array description: | Output only. List of access_points. Contains a list of IPv4 addresses used for client side configuration. - min_version: 'beta' output: true item_type: type: String @@ -163,7 +150,6 @@ properties: description: | Immutable. The name of the Google Compute Engine [VPC network](https://cloud.google.com/vpc/docs/vpc) to which the instance is connected. - min_version: 'beta' immutable: true - name: 'reservedIpRange' type: String @@ -172,7 +158,6 @@ properties: associated with the private service access connection for example, \"test-default\" associated with IP range 10.0.0.0/29. If no range id is provided all ranges will be considered. - min_version: 'beta' immutable: true - name: 'effectiveReservedIpRange' type: String @@ -181,7 +166,6 @@ properties: range associated with the private service access connection for example, \"test-default\" associated with IP range 10.0.0.0/29. This field is populated by the service and contains the value currently used by the service. - min_version: 'beta' immutable: true output: true - name: 'fileStripeLevel' @@ -195,7 +179,6 @@ properties: FILE_STRIPE_LEVEL_MIN FILE_STRIPE_LEVEL_BALANCED FILE_STRIPE_LEVEL_MAX - min_version: 'beta' - name: 'directoryStripeLevel' type: String description: | @@ -207,4 +190,3 @@ properties: DIRECTORY_STRIPE_LEVEL_MIN DIRECTORY_STRIPE_LEVEL_BALANCED DIRECTORY_STRIPE_LEVEL_MAX - min_version: 'beta' diff --git a/mmv1/products/parallelstore/product.yaml b/mmv1/products/parallelstore/product.yaml index fc6e94618fd2..607b093d7cd7 100644 --- a/mmv1/products/parallelstore/product.yaml +++ b/mmv1/products/parallelstore/product.yaml @@ -15,6 +15,8 @@ name: 'Parallelstore' display_name: 'Parallelstore' versions: + - name: 'ga' + base_url: 'https://parallelstore.googleapis.com/v1/' - name: 'beta' base_url: 'https://parallelstore.googleapis.com/v1beta/' scopes: diff --git a/mmv1/templates/terraform/examples/parallelstore_instance_basic.tf.tmpl b/mmv1/templates/terraform/examples/parallelstore_instance_basic.tf.tmpl index a7f67c16d9d3..9ef9378a1cf3 100644 --- a/mmv1/templates/terraform/examples/parallelstore_instance_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/parallelstore_instance_basic.tf.tmpl @@ -9,7 +9,6 @@ resource "google_parallelstore_instance" "{{$.PrimaryResourceId}}" { labels = { test = "value" } - provider = google-beta depends_on = [google_service_networking_connection.default] } @@ -17,7 +16,6 @@ resource "google_compute_network" "network" { name = "{{index $.Vars "network_name"}}" auto_create_subnetworks = true mtu = 8896 - provider = google-beta } # Create an IP address @@ -27,7 +25,6 @@ resource "google_compute_global_address" "private_ip_alloc" { address_type = "INTERNAL" prefix_length = 24 network = google_compute_network.network.id - provider = google-beta } # Create a private connection @@ -35,5 +32,4 @@ resource "google_service_networking_connection" "default" { network = google_compute_network.network.id service = "servicenetworking.googleapis.com" reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] - provider = google-beta } 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 740f2f5dde37..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{ { @@ -75,7 +74,6 @@ resource "google_parallelstore_instance" "instance" { labels = { test = "value" } - provider = google-beta depends_on = [google_service_networking_connection.default] } @@ -83,7 +81,6 @@ resource "google_compute_network" "network" { name = "network%{random_suffix}" auto_create_subnetworks = true mtu = 8896 - provider = google-beta } @@ -95,7 +92,6 @@ resource "google_compute_global_address" "private_ip_alloc" { address_type = "INTERNAL" prefix_length = 24 network = google_compute_network.network.id - provider = google-beta } # Create a private connection @@ -103,7 +99,6 @@ resource "google_service_networking_connection" "default" { network = google_compute_network.network.id service = "servicenetworking.googleapis.com" reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] - provider = google-beta } `, context) } @@ -120,7 +115,6 @@ resource "google_parallelstore_instance" "instance" { labels = { test = "value23" } - provider = google-beta depends_on = [google_service_networking_connection.default] } @@ -128,7 +122,6 @@ resource "google_compute_network" "network" { name = "network%{random_suffix}" auto_create_subnetworks = true mtu = 8896 - provider = google-beta } @@ -140,7 +133,6 @@ resource "google_compute_global_address" "private_ip_alloc" { address_type = "INTERNAL" prefix_length = 24 network = google_compute_network.network.id - provider = google-beta } # Create a private connection @@ -148,9 +140,6 @@ resource "google_service_networking_connection" "default" { network = google_compute_network.network.id service = "servicenetworking.googleapis.com" reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] - provider = google-beta } `, context) -} - -{{ end }} +} \ No newline at end of file From ea78f58a5e7ce06446cec65cdb5e36fb3b8c5c7a Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Thu, 14 Nov 2024 13:07:38 -0800 Subject: [PATCH 13/44] Update enrolled_teams.yml (#12304) --- .../issue-labeler/labeler/enrolled_teams.yml | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tools/issue-labeler/labeler/enrolled_teams.yml b/tools/issue-labeler/labeler/enrolled_teams.yml index 560a70c0f809..58ef76ea2edd 100755 --- a/tools/issue-labeler/labeler/enrolled_teams.yml +++ b/tools/issue-labeler/labeler/enrolled_teams.yml @@ -7,6 +7,9 @@ service/accessapproval: service/accesscontextmanager: resources: - google_access_context_manager_.* +service/aiplatform-colab-enterprise: + resources: + - google_vertex_ai_notebook_.* service/aiplatform-dataset: resources: - google_vertex_ai_dataset @@ -75,6 +78,9 @@ service/billingbudgets: service/binaryauthorization: resources: - google_binary_authorization_.* +service/blockchainnodeengine: + resources: + - google_blockchain_node_engine_.* service/certificatemanager: resources: - google_certificate_manager_.* @@ -137,6 +143,9 @@ service/cloudscheduler: service/cloudtasks: resources: - google_cloud_tasks_.* +service/cloudtrace: + resources: + - google_cloud_trace_.* service/composer: resources: - google_composer_.* @@ -153,6 +162,7 @@ service/compute-health: - google_compute_http_health_check - google_compute_https_health_check - google_compute_region_health_check + - google_network_services_service_lb_policies service/compute-instances: resources: - google_compute_instance @@ -244,6 +254,7 @@ service/compute-router: - google_compute_router - google_compute_router_interface - google_compute_router_peer + - google_compute_router_route_policy - google_compute_router_status service/compute-security-policy: resources: @@ -259,7 +270,7 @@ service/compute-vpc: resources: - google_compute_network - google_compute_route - - google_compute_subnetwork + - google_compute_subnetwork.* - google_compute_shared_vpc_host_project - google_compute_shared_vpc_service_project - google_compute_project_default_network_tier @@ -495,6 +506,10 @@ service/networksecurity-swp: service/networkservices-media-cdn: resources: - google_network_services_edge_cache_.* +service/networkservices-service-extensions: + resources: + - google_network_services_lb_route_extension + - google_network_services_lb_traffic_extension service/networkservices-traffic-director: resources: - google_network_services_endpoint_policy @@ -509,6 +524,9 @@ service/notebooks: resources: - google_notebooks_.* - google_workbench_.* +service/oracledatabase: + resources: + - google_oracle_database_.* service/orgpolicy: resources: - google_folder_organization_policy @@ -592,12 +610,18 @@ service/serviceusage-quota: resources: - google_cloud_quotas_.* - google_service_usage_consumer_quota_override +service/siteverification: + resources: + - google_site_verification_.* service/sourcerepo: resources: - google_sourcerepo_.* service/spanner: resources: - google_spanner_.* +service/speech: + resources: + - google_speech_to_text_.* service/sqladmin-cp: resources: - google_sql_database_instance @@ -624,6 +648,9 @@ service/storage: service/tpu: resources: - google_tpu_.* +service/transcoder: + resources: + - google_transcoder_.* service/vmwareengine: resources: - google_vmwareengine_.* From ce7327247d236feaaf57005763f55494cca727b2 Mon Sep 17 00:00:00 2001 From: Salome Papiashvili Date: Thu, 14 Nov 2024 22:10:21 +0100 Subject: [PATCH 14/44] Composer 3 GA (#12234) --- .../composer/UserWorkloadsConfigMap.yaml | 8 +-- ...er_user_workloads_config_map_basic.tf.tmpl | 2 - .../provider/provider_mmv1_resources.go.tmpl | 7 -- ...composer_user_workloads_config_map.go.tmpl | 2 - ...ser_user_workloads_config_map_test.go.tmpl | 2 - ...gle_composer_user_workloads_secret.go.tmpl | 2 - ...omposer_user_workloads_secret_test.go.tmpl | 2 - .../resource_composer_environment.go.tmpl | 65 +------------------ ...resource_composer_environment_test.go.tmpl | 6 +- ...ser_user_workloads_config_map_test.go.tmpl | 13 +--- ...rce_composer_user_workloads_secret.go.tmpl | 4 -- ...omposer_user_workloads_secret_test.go.tmpl | 4 -- ...er_user_workloads_config_map.html.markdown | 3 - ...mposer_user_workloads_secret.html.markdown | 3 - .../docs/r/composer_environment.html.markdown | 41 ++++++++++-- ...mposer_user_workloads_secret.html.markdown | 3 - 16 files changed, 42 insertions(+), 125 deletions(-) diff --git a/mmv1/products/composer/UserWorkloadsConfigMap.yaml b/mmv1/products/composer/UserWorkloadsConfigMap.yaml index 9835430077f0..4efc7c9ec7fe 100644 --- a/mmv1/products/composer/UserWorkloadsConfigMap.yaml +++ b/mmv1/products/composer/UserWorkloadsConfigMap.yaml @@ -16,11 +16,9 @@ name: 'UserWorkloadsConfigMap' description: | User workloads ConfigMap used by Airflow tasks that run with Kubernetes Executor or KubernetesPodOperator. Intended for Composer 3 Environments. -min_version: 'beta' references: guides: - # TODO: add v1 reference when this is moved to ga - api: 'https://cloud.google.com/composer/docs/reference/rest/v1beta1/projects.locations.environments.userWorkloadsConfigMaps' + api: 'https://cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments.userWorkloadsConfigMaps' docs: base_url: 'projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsConfigMaps' self_link: 'projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsConfigMaps/{{name}}' @@ -41,7 +39,6 @@ parameters: type: String description: | The location or Compute Engine region for the environment. - min_version: 'beta' url_param_only: true immutable: true default_from_api: true @@ -49,7 +46,6 @@ parameters: type: String description: | Environment where the Kubernetes ConfigMap will be stored and used. - min_version: 'beta' url_param_only: true required: true immutable: true @@ -60,7 +56,6 @@ properties: type: String description: | Name of the Kubernetes ConfigMap. - min_version: 'beta' required: true immutable: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl' @@ -72,5 +67,4 @@ properties: description: | The "data" field of Kubernetes ConfigMap, organized in key-value pairs. For details see: https://kubernetes.io/docs/concepts/configuration/configmap/ - min_version: 'beta' immutable: false diff --git a/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl b/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl index a2641c1bf801..5b53968aac54 100644 --- a/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl @@ -1,5 +1,4 @@ resource "google_composer_environment" "environment" { - provider = google-beta name = "{{index $.Vars "environment_name"}}" region = "us-central1" config { @@ -10,7 +9,6 @@ resource "google_composer_environment" "environment" { } resource "google_composer_user_workloads_config_map" "{{$.PrimaryResourceId}}" { - provider = google-beta name = "{{index $.Vars "config_map_name"}}" region = "us-central1" environment = google_composer_environment.environment.name 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 9ac625153e69..4950309f0d9c 100644 --- a/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl +++ b/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl @@ -7,9 +7,6 @@ import ( "github.com/hashicorp/terraform-provider-google/google/services/{{ $service }}" {{- end }} - {{ if eq $.TargetVersionName `ga` }} - "github.com/hashicorp/terraform-provider-google/google/services/composer" - {{- end }} "github.com/hashicorp/terraform-provider-google/google/services/container" "github.com/hashicorp/terraform-provider-google/google/services/containeraws" "github.com/hashicorp/terraform-provider-google/google/services/containerazure" @@ -67,10 +64,8 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_cloud_run_v2_job": cloudrunv2.DataSourceGoogleCloudRunV2Job(), "google_cloud_run_v2_service": cloudrunv2.DataSourceGoogleCloudRunV2Service(), "google_composer_environment": composer.DataSourceGoogleComposerEnvironment(), - {{- if ne $.TargetVersionName "ga" }} "google_composer_user_workloads_config_map": composer.DataSourceGoogleComposerUserWorkloadsConfigMap(), "google_composer_user_workloads_secret": composer.DataSourceGoogleComposerUserWorkloadsSecret(), - {{- end }} "google_composer_image_versions": composer.DataSourceGoogleComposerImageVersions(), "google_compute_address": compute.DataSourceGoogleComputeAddress(), "google_compute_addresses": compute.DataSourceGoogleComputeAddresses(), @@ -323,9 +318,7 @@ var handwrittenResources = map[string]*schema.Resource{ "google_billing_subaccount": resourcemanager.ResourceBillingSubaccount(), "google_cloudfunctions_function": cloudfunctions.ResourceCloudFunctionsFunction(), "google_composer_environment": composer.ResourceComposerEnvironment(), - {{- if ne $.TargetVersionName "ga" }} "google_composer_user_workloads_secret": composer.ResourceComposerUserWorkloadsSecret(), - {{- end }} "google_compute_attached_disk": compute.ResourceComputeAttachedDisk(), "google_compute_instance": compute.ResourceComputeInstance(), "google_compute_disk_async_replication": compute.ResourceComputeDiskAsyncReplication(), diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map.go.tmpl b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map.go.tmpl index 2f9ad0137118..a3aab2c8c184 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map.go.tmpl @@ -1,6 +1,5 @@ package composer -{{ if ne $.TargetVersionName `ga` -}} import ( "fmt" @@ -48,4 +47,3 @@ func dataSourceGoogleComposerUserWorkloadsConfigMapRead(d *schema.ResourceData, return nil } -{{- end }} diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map_test.go.tmpl b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map_test.go.tmpl index eac26bfd11cb..ea8e664c2773 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map_test.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map_test.go.tmpl @@ -1,6 +1,5 @@ package composer_test -{{ if ne $.TargetVersionName `ga` -}} import ( "fmt" "testing" @@ -56,4 +55,3 @@ data "google_composer_user_workloads_config_map" "test" { } `, context) } -{{- end }} diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret.go.tmpl b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret.go.tmpl index 0acf758493bb..2e6575460548 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret.go.tmpl @@ -1,6 +1,5 @@ package composer -{{ if ne $.TargetVersionName `ga` -}} import ( "fmt" @@ -60,4 +59,3 @@ func dataSourceGoogleComposerUserWorkloadsSecretRead(d *schema.ResourceData, met return nil } -{{- end }} diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret_test.go.tmpl b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret_test.go.tmpl index 3860a8e8c40f..2098a4aeb89e 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret_test.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret_test.go.tmpl @@ -1,6 +1,5 @@ package composer_test -{{ if ne $.TargetVersionName `ga` -}} import ( "errors" "fmt" @@ -99,4 +98,3 @@ data "google_composer_user_workloads_secret" "test" { } `, context) } -{{- end }} diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_environment.go.tmpl b/mmv1/third_party/terraform/services/composer/resource_composer_environment.go.tmpl index e8da985580f1..7882a22c4566 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_environment.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/resource_composer_environment.go.tmpl @@ -56,9 +56,7 @@ var ( "config.0.software_config.0.python_version", "config.0.software_config.0.scheduler_count", "config.0.software_config.0.cloud_data_lineage_integration", -{{- if ne $.TargetVersionName "ga" }} "config.0.software_config.0.web_server_plugins_mode", -{{- end }} } composerConfigKeys = []string{ @@ -76,10 +74,8 @@ var ( "config.0.environment_size", "config.0.master_authorized_networks_config", "config.0.resilience_mode", -{{- if ne $.TargetVersionName "ga" }} "config.0.enable_private_environment", "config.0.enable_private_builds_only", -{{- end }} "config.0.data_retention_config", } @@ -92,9 +88,7 @@ var ( "config.0.workloads_config.0.triggerer", "config.0.workloads_config.0.web_server", "config.0.workloads_config.0.worker", -{{- if ne $.TargetVersionName "ga" }} "config.0.workloads_config.0.dag_processor", -{{- end }} } composerPrivateEnvironmentConfig = []string{ @@ -173,10 +167,8 @@ func ResourceComposerEnvironment() *schema.Resource { customdiff.ValidateChange("config.0.software_config.0.image_version", imageVersionChangeValidationFunc), versionValidationCustomizeDiffFunc, ), -{{- if ne $.TargetVersionName "ga" }} - customdiff.ForceNewIf("config.0.node_config.0.network", forceNewCustomDiff("config.0.node_config.0.network")), - customdiff.ForceNewIf("config.0.node_config.0.subnetwork", forceNewCustomDiff("config.0.node_config.0.subnetwork")), -{{- end }} + customdiff.ForceNewIf("config.0.node_config.0.network", forceNewIfNotComposer3CustomDiff("config.0.node_config.0.network")), + customdiff.ForceNewIf("config.0.node_config.0.subnetwork", forceNewIfNotComposer3CustomDiff("config.0.node_config.0.subnetwork")), ), Schema: map[string]*schema.Schema{ @@ -246,29 +238,18 @@ func ResourceComposerEnvironment() *schema.Resource { Type: schema.TypeString, Computed: true, Optional: true, -{{- if eq $.TargetVersionName "ga" }} - ForceNew: true, -{{- else }} - ForceNew: false, ConflictsWith: []string{"config.0.node_config.0.composer_network_attachment"}, -{{- end }} DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, Description: `The Compute Engine machine type used for cluster instances, specified as a name or relative resource name. For example: "projects/{project}/zones/{zone}/machineTypes/{machineType}". Must belong to the enclosing environment's project and region/zone. The network must belong to the environment's project. If unspecified, the "default" network ID in the environment's project is used. If a Custom Subnet Network is provided, subnetwork must also be provided.`, }, "subnetwork": { Type: schema.TypeString, Optional: true, -{{- if eq $.TargetVersionName "ga" }} - ForceNew: true, -{{- else }} - ForceNew: false, Computed: true, ConflictsWith: []string{"config.0.node_config.0.composer_network_attachment"}, -{{- end }} DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, Description: `The Compute Engine subnetwork to be used for machine communications, specified as a self-link, relative resource name (e.g. "projects/{project}/regions/{region}/subnetworks/{subnetwork}"), or by name. If subnetwork is provided, network must also be provided and the subnetwork must belong to the enclosing environment's project and region.`, }, -{{- if ne $.TargetVersionName "ga" }} "composer_network_attachment": { Type: schema.TypeString, Computed: true, @@ -276,7 +257,6 @@ func ResourceComposerEnvironment() *schema.Resource { ForceNew: false, Description: `PSC (Private Service Connect) Network entry point. Customers can pre-create the Network Attachment and point Cloud Composer environment to use. It is possible to share network attachment among many environments, provided enough IP addresses are available.`, }, -{{- end }} "disk_size_gb": { Type: schema.TypeInt, Computed: true, @@ -385,7 +365,6 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, -{{- if ne $.TargetVersionName "ga" }} "composer_internal_ipv4_cidr_block": { Type: schema.TypeString, Computed: true, @@ -394,7 +373,6 @@ func ResourceComposerEnvironment() *schema.Resource { ValidateFunc: validateComposerInternalIpv4CidrBlock, Description: `IPv4 cidr range that will be used by Composer internal components.`, }, -{{- end }} }, }, }, @@ -513,7 +491,6 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, -{{- if ne $.TargetVersionName "ga" }} "web_server_plugins_mode": { Type: schema.TypeString, Optional: true, @@ -523,7 +500,6 @@ func ResourceComposerEnvironment() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{"ENABLED", "DISABLED"}, false), Description: `Should be either 'ENABLED' or 'DISABLED'. Defaults to 'ENABLED'. Used in Composer 3.`, }, -{{- end }} }, }, }, @@ -606,7 +582,6 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, -{{- if ne $.TargetVersionName "ga" }} "enable_private_environment": { Type: schema.TypeBool, Computed: true, @@ -623,7 +598,6 @@ func ResourceComposerEnvironment() *schema.Resource { AtLeastOneOf: composerConfigKeys, Description: `Optional. If true, builds performed during operations that install Python packages have only private connectivity to Google services. If false, the builds also have access to the internet.`, }, -{{- end }} "web_server_network_access_control": { Type: schema.TypeList, Optional: true, @@ -933,7 +907,6 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, -{{- if ne $.TargetVersionName "ga" }} "dag_processor": { Type: schema.TypeList, Optional: true, @@ -979,7 +952,6 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, -{{- end }} }, }, }, @@ -1225,7 +1197,6 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) return err } -{{ if ne $.TargetVersionName `ga` -}} noChangeErrorMessage := "Update request does not result in any change to the environment's configuration" if d.HasChange("config.0.node_config.0.network") || d.HasChange("config.0.node_config.0.subnetwork"){ // step 1: update with empty network and subnetwork @@ -1285,7 +1256,6 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) } } } -{{- end }} if d.HasChange("config.0.software_config.0.image_version") { patchObj := &composer.Environment{ @@ -1387,7 +1357,6 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) } } -{{ if ne $.TargetVersionName `ga` -}} if d.HasChange("config.0.enable_private_environment") { patchObj := &composer.Environment{ Config: &composer.EnvironmentConfig{ @@ -1429,7 +1398,6 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) return err } } -{{- end }} if d.HasChange("config.0.node_count") { patchObj := &composer.Environment{Config: &composer.EnvironmentConfig{}} @@ -1689,12 +1657,10 @@ func flattenComposerEnvironmentConfig(envCfg *composer.EnvironmentConfig) interf if !isComposer3(imageVersion){ transformed["private_environment_config"] = flattenComposerEnvironmentConfigPrivateEnvironmentConfig(envCfg.PrivateEnvironmentConfig) } -{{- if ne $.TargetVersionName "ga" }} if isComposer3(imageVersion) && envCfg.PrivateEnvironmentConfig != nil { transformed["enable_private_environment"] = envCfg.PrivateEnvironmentConfig.EnablePrivateEnvironment transformed["enable_private_builds_only"] = envCfg.PrivateEnvironmentConfig.EnablePrivateBuildsOnly } -{{- end }} transformed["web_server_network_access_control"] = flattenComposerEnvironmentConfigWebServerNetworkAccessControl(envCfg.WebServerNetworkAccessControl) transformed["database_config"] = flattenComposerEnvironmentConfigDatabaseConfig(envCfg.DatabaseConfig) transformed["web_server_config"] = flattenComposerEnvironmentConfigWebServerConfig(envCfg.WebServerConfig) @@ -1837,17 +1803,13 @@ func flattenComposerEnvironmentConfigWorkloadsConfig(workloadsConfig *composer.W transformedTriggerer := make(map[string]interface{}) transformedWebServer := make(map[string]interface{}) transformedWorker := make(map[string]interface{}) -{{- if ne $.TargetVersionName "ga" }} transformedDagProcessor := make(map[string]interface{}) -{{- end }} wlCfgScheduler := workloadsConfig.Scheduler wlCfgTriggerer := workloadsConfig.Triggerer wlCfgWebServer := workloadsConfig.WebServer wlCfgWorker := workloadsConfig.Worker -{{- if ne $.TargetVersionName "ga" }} wlCfgDagProcessor := workloadsConfig.DagProcessor -{{- end }} if wlCfgScheduler == nil { transformedScheduler = nil @@ -1884,7 +1846,6 @@ func flattenComposerEnvironmentConfigWorkloadsConfig(workloadsConfig *composer.W transformedWorker["max_count"] = wlCfgWorker.MaxCount } -{{ if ne $.TargetVersionName `ga` -}} if wlCfgDagProcessor == nil { transformedDagProcessor = nil } else { @@ -1893,7 +1854,6 @@ func flattenComposerEnvironmentConfigWorkloadsConfig(workloadsConfig *composer.W transformedDagProcessor["storage_gb"] = wlCfgDagProcessor.StorageGb transformedDagProcessor["count"] = wlCfgDagProcessor.Count } -{{- end }} transformed["scheduler"] = []interface{}{transformedScheduler} if transformedTriggerer != nil { @@ -1901,12 +1861,9 @@ func flattenComposerEnvironmentConfigWorkloadsConfig(workloadsConfig *composer.W } transformed["web_server"] = []interface{}{transformedWebServer} transformed["worker"] = []interface{}{transformedWorker} -{{- if ne $.TargetVersionName "ga" }} if transformedDagProcessor != nil { transformed["dag_processor"] = []interface{}{transformedDagProcessor} } -{{- end }} - return []interface{}{transformed} } @@ -1942,9 +1899,7 @@ func flattenComposerEnvironmentConfigNodeConfig(nodeCfg *composer.NodeConfig) in transformed["machine_type"] = nodeCfg.MachineType transformed["network"] = nodeCfg.Network transformed["subnetwork"] = nodeCfg.Subnetwork -{{- if ne $.TargetVersionName "ga" }} transformed["composer_network_attachment"] = nodeCfg.ComposerNetworkAttachment -{{- end }} transformed["disk_size_gb"] = nodeCfg.DiskSizeGb transformed["service_account"] = nodeCfg.ServiceAccount transformed["oauth_scopes"] = flattenComposerEnvironmentConfigNodeConfigOauthScopes(nodeCfg.OauthScopes) @@ -1954,9 +1909,7 @@ func flattenComposerEnvironmentConfigNodeConfig(nodeCfg *composer.NodeConfig) in transformed["enable_ip_masq_agent"] = nodeCfg.EnableIpMasqAgent transformed["tags"] = flattenComposerEnvironmentConfigNodeConfigTags(nodeCfg.Tags) transformed["ip_allocation_policy"] = flattenComposerEnvironmentConfigNodeConfigIPAllocationPolicy(nodeCfg.IpAllocationPolicy) -{{- if ne $.TargetVersionName "ga" }} transformed["composer_internal_ipv4_cidr_block"] = nodeCfg.ComposerInternalIpv4CidrBlock -{{- end }} return []interface{}{transformed} } @@ -2000,7 +1953,6 @@ func flattenComposerEnvironmentConfigSoftwareConfig(softwareCfg *composer.Softwa transformed["env_variables"] = softwareCfg.EnvVariables transformed["scheduler_count"] = softwareCfg.SchedulerCount transformed["cloud_data_lineage_integration"] = flattenComposerEnvironmentConfigSoftwareConfigCloudDataLineageIntegration(softwareCfg.CloudDataLineageIntegration) -{{- if ne $.TargetVersionName "ga" }} if softwareCfg.WebServerPluginsMode == "PLUGINS_DISABLED"{ transformed["web_server_plugins_mode"] = "DISABLED" } else if softwareCfg.WebServerPluginsMode == "PLUGINS_ENABLED"{ @@ -2008,7 +1960,6 @@ func flattenComposerEnvironmentConfigSoftwareConfig(softwareCfg *composer.Softwa } else { transformed["web_server_plugins_mode"] = softwareCfg.WebServerPluginsMode } -{{- end }} return []interface{}{transformed} } @@ -2078,7 +2029,6 @@ func expandComposerEnvironmentConfig(v interface{}, d *schema.ResourceData, conf } transformed.PrivateEnvironmentConfig = transformedPrivateEnvironmentConfig -{{ if ne $.TargetVersionName `ga` -}} /* config.enable_private_environment in terraform maps to composer.PrivateEnvironmentConfig.EnablePrivateEnvironment in API. @@ -2094,7 +2044,6 @@ func expandComposerEnvironmentConfig(v interface{}, d *schema.ResourceData, conf transformed.PrivateEnvironmentConfig.EnablePrivateBuildsOnly = enablePrivateBuildsOnlyRaw.(bool) } } -{{- end }} transformedWebServerNetworkAccessControl, err := expandComposerEnvironmentConfigWebServerNetworkAccessControl(original["web_server_network_access_control"], d, config) if err != nil { @@ -2393,7 +2342,6 @@ func expandComposerEnvironmentConfigWorkloadsConfig(v interface{}, d *schema.Res } } -{{ if ne $.TargetVersionName `ga` -}} if v, ok := original["dag_processor"]; ok { if len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { transformedDagProcessor := &composer.DagProcessorResource{} @@ -2405,7 +2353,6 @@ func expandComposerEnvironmentConfigWorkloadsConfig(v interface{}, d *schema.Res transformed.DagProcessor = transformedDagProcessor } } -{{- end }} return transformed, nil } @@ -2562,11 +2509,9 @@ func expandComposerEnvironmentConfigNodeConfig(v interface{}, d *schema.Resource transformed.Subnetwork = transformedSubnetwork } -{{ if ne $.TargetVersionName `ga` -}} if v, ok := original["composer_network_attachment"]; ok { transformed.ComposerNetworkAttachment = v.(string) } -{{- end }} transformedIPAllocationPolicy, err := expandComposerEnvironmentIPAllocationPolicy(original["ip_allocation_policy"], d, config) if err != nil { @@ -2586,11 +2531,9 @@ func expandComposerEnvironmentConfigNodeConfig(v interface{}, d *schema.Resource } transformed.Tags = transformedTags -{{ if ne $.TargetVersionName `ga` -}} if transformedComposerInternalIpv4CidrBlock, ok := original["composer_internal_ipv4_cidr_block"]; ok { transformed.ComposerInternalIpv4CidrBlock = transformedComposerInternalIpv4CidrBlock.(string) } -{{- end }} return transformed, nil } @@ -2741,7 +2684,6 @@ func expandComposerEnvironmentConfigSoftwareConfig(v interface{}, d *schema.Reso } transformed.CloudDataLineageIntegration = transformedCloudDataLineageIntegration -{{ if ne $.TargetVersionName `ga` -}} if original["web_server_plugins_mode"].(string) == "DISABLED"{ transformed.WebServerPluginsMode = "PLUGINS_DISABLED" } else if original["web_server_plugins_mode"].(string) == "ENABLED"{ @@ -2749,7 +2691,6 @@ func expandComposerEnvironmentConfigSoftwareConfig(v interface{}, d *schema.Reso } else { transformed.WebServerPluginsMode = original["web_server_plugins_mode"].(string) } -{{- end }} return transformed, nil } @@ -3047,7 +2988,7 @@ func isComposer3(imageVersion string) bool { return strings.Contains(imageVersion, "composer-3") } -func forceNewCustomDiff(key string) customdiff.ResourceConditionFunc { +func forceNewIfNotComposer3CustomDiff(key string) customdiff.ResourceConditionFunc { return func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool { old, new := d.GetChange(key) imageVersion := d.Get("config.0.software_config.0.image_version").(string) 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 8fc8e27024b7..248cf1222c44 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 @@ -1191,7 +1191,6 @@ func TestAccComposerEnvironment_customBucketWithUrl(t *testing.T) { }) } -{{ if ne $.TargetVersionName `ga` -}} // Checks Composer 3 environment creation with new fields. func TestAccComposerEnvironmentComposer3_basic(t *testing.T) { t.Parallel() @@ -1548,7 +1547,6 @@ func TestAccComposerEnvironmentComposer3_usesUnsupportedField_expectError(t *tes }, }) } -{{- end }} func testAccComposerEnvironment_customBucket(bucketName, envName, network, subnetwork string) string { return fmt.Sprintf(` @@ -3233,7 +3231,6 @@ resource "google_project_iam_member" "composer-worker" { `, environment, network, subnetwork, serviceAccount) } -{{ if ne $.TargetVersionName `ga` -}} func testAccComposerEnvironmentComposer2_empty(name, network, subnetwork string) string { return fmt.Sprintf(` resource "google_composer_environment" "test" { @@ -3302,7 +3299,7 @@ resource "google_composer_environment" "test" { config { software_config { image_version = "composer-2-airflow-2" - web_server_plugins_mode = "ENABLED" + web_server_plugins_mode = "ENABLED" } } } @@ -3573,7 +3570,6 @@ resource "google_compute_subnetwork" "test" { } `, name, networkAttachment, network, subnetwork) } -{{- end }} // WARNING: This is not actually a check and is a terrible clean-up step because Composer Environments // have a bug that hasn't been fixed. Composer will add firewalls to non-default networks for environments diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_config_map_test.go.tmpl b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_config_map_test.go.tmpl index 312d8331f75b..37feb346b799 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_config_map_test.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_config_map_test.go.tmpl @@ -1,7 +1,5 @@ package composer_test -{{ if ne $.TargetVersionName `ga` -}} - import ( "fmt" "strings" @@ -22,7 +20,7 @@ func TestAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicEx acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComposerUserWorkloadsConfigMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -58,7 +56,7 @@ func TestAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicEx acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), CheckDestroy: testAccCheckComposerUserWorkloadsConfigMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -82,7 +80,6 @@ func TestAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicEx func testAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicExample_basic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_composer_environment" "environment" { - provider = google-beta name = "tf-test-test-environment%{random_suffix}" region = "us-central1" config { @@ -93,7 +90,6 @@ resource "google_composer_environment" "environment" { } resource "google_composer_user_workloads_config_map" "config_map" { - provider = google-beta name = "tf-test-test-config-map%{random_suffix}" region = "us-central1" environment = google_composer_environment.environment.name @@ -107,7 +103,6 @@ resource "google_composer_user_workloads_config_map" "config_map" { func testAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicExample_update(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_composer_environment" "environment" { - provider = google-beta name = "tf-test-test-environment%{random_suffix}" region = "us-central1" config { @@ -118,7 +113,6 @@ resource "google_composer_environment" "environment" { } resource "google_composer_user_workloads_config_map" "config_map" { - provider = google-beta name = "tf-test-test-config-map%{random_suffix}" region = "us-central1" environment = google_composer_environment.environment.name @@ -132,7 +126,6 @@ resource "google_composer_user_workloads_config_map" "config_map" { func testAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicExample_delete(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_composer_environment" "environment" { - provider = google-beta name = "tf-test-test-environment%{random_suffix}" region = "us-central1" config { @@ -166,5 +159,3 @@ func testAccComposerUserWorkloadsConfigMapDestroyed(t *testing.T) func(s *terraf return nil } } - -{{ end }} diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret.go.tmpl b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret.go.tmpl index 94ebd8182ebc..9cea9a079dbb 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret.go.tmpl @@ -1,7 +1,5 @@ package composer -{{ if ne $.TargetVersionName `ga` -}} - import ( "fmt" "log" @@ -267,5 +265,3 @@ func (n *UserWorkloadsSecretName) ResourceName() string { func (n *UserWorkloadsSecretName) ParentName() string { return fmt.Sprintf("projects/%s/locations/%s/environments/%s", n.Project, n.Region, n.Environment) } - -{{ end }} diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret_test.go.tmpl b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret_test.go.tmpl index 9008bfdc65df..cb83e29ce0d0 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret_test.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret_test.go.tmpl @@ -1,7 +1,5 @@ package composer_test -{{ if ne $.TargetVersionName `ga` -}} - import ( "fmt" "testing" @@ -179,5 +177,3 @@ func testAccComposerUserWorkloadsSecretDestroyed(t *testing.T) func(s *terraform return nil } } - -{{ end }} diff --git a/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_config_map.html.markdown b/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_config_map.html.markdown index f582d646df88..00e2a0d4a27f 100644 --- a/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_config_map.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_config_map.html.markdown @@ -8,9 +8,6 @@ description: |- Provides access to Kubernetes ConfigMap configuration for a given project, region and Composer Environment. -> **Warning:** This data source is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. - ## Example Usage ```hcl diff --git a/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_secret.html.markdown b/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_secret.html.markdown index 93f5356a781f..3b7f61b87562 100644 --- a/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_secret.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_secret.html.markdown @@ -8,9 +8,6 @@ description: |- Provides access to Kubernetes Secret configuration for a given project, region and Composer Environment. -~> **Warning:** This data source is in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. - ## Example Usage ```hcl diff --git a/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown b/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown index 35740d97bcb9..8f560d4f662f 100644 --- a/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown @@ -363,6 +363,35 @@ resource "google_composer_environment" "example" { } ``` +If you specify an existing network attachment that you also manage in Terraform, then Terraform will revert changes +to the attachment done by Cloud Composer when you apply configuration changes. As a result, the environment will no +longer use the attachment. To address this problem, make sure that Terraform ignores changes to the +`producer_accept_lists` parameter of the attachment, as follows: + +```hcl +resource "google_compute_network_attachment" "example" { + lifecycle { + ignore_changes = [producer_accept_lists] + } + + # ... other configuration parameters +} + +resource "google_composer_environment" "example" { + name = "example-environment" + region = "us-central1" + + config { + + node_config { + composer_network_attachment = google_compute_network_attachment.example.id + } + + # ... other configuration parameters + } +} +``` + ### With Software (Airflow) Config ```hcl @@ -1303,11 +1332,11 @@ The following arguments are supported: The configuration settings for software (Airflow) inside the environment. Structure is [documented below](#nested_software_config_c3). * `enable_private_environment` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) + (Optional, Cloud Composer 3 only) If true, a private Composer environment will be created. * `enable_private_builds_only` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) + (Optional, Cloud Composer 3 only) If true, builds performed during operations that install Python packages have only private connectivity to Google services. If false, the builds also have access to the internet. @@ -1377,7 +1406,7 @@ The following arguments are supported: network must also be provided and the subnetwork must belong to the enclosing environment's project and region. * `composer_network_attachment` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) + (Optional, Cloud Composer 3 only) PSC (Private Service Connect) Network entry point. Customers can pre-create the Network Attachment and point Cloud Composer environment to use. It is possible to share network attachment among many environments, provided enough IP addresses are available. @@ -1398,7 +1427,7 @@ The following arguments are supported: Cannot be updated. * `composer_internal_ipv4_cidr_block` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) + (Optional, Cloud Composer 3 only) /20 IPv4 cidr range that will be used by Composer internal components. Cannot be updated. @@ -1471,7 +1500,7 @@ The following arguments are supported: [documented below](#nested_cloud_data_lineage_integration_c3). * `web_server_plugins_mode` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) + (Optional, Cloud Composer 3 only) Web server plugins configuration. Can be either 'ENABLED' or 'DISABLED'. Defaults to 'ENABLED'. The `cloud_data_lineage_integration` block supports: @@ -1523,7 +1552,7 @@ The `workloads_config` block supports: Configuration for resources used by Airflow workers. * `dag_processor` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) + (Optional, Cloud Composer 3 only) Configuration for resources used by DAG processor. The `scheduler` block supports: diff --git a/mmv1/third_party/terraform/website/docs/r/composer_user_workloads_secret.html.markdown b/mmv1/third_party/terraform/website/docs/r/composer_user_workloads_secret.html.markdown index 797798867148..e07d8293d763 100644 --- a/mmv1/third_party/terraform/website/docs/r/composer_user_workloads_secret.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/composer_user_workloads_secret.html.markdown @@ -6,9 +6,6 @@ description: |- # google_composer_user_workloads_secret -~> **Warning:** These resources are in beta, and should be used with the terraform-provider-google-beta provider. -See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. - User workloads Secret used by Airflow tasks that run with Kubernetes Executor or KubernetesPodOperator. Intended for Composer 3 Environments. From e6c248fc140ae26ea42f6183d1ab425d2bca3c41 Mon Sep 17 00:00:00 2001 From: Will Yardley Date: Thu, 14 Nov 2024 13:11:38 -0800 Subject: [PATCH 15/44] transcoder: ignored `start_time` in `JobManifestsExample` test (#12220) --- mmv1/products/transcoder/Job.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/products/transcoder/Job.yaml b/mmv1/products/transcoder/Job.yaml index ca7c95dec6f4..f80413ee7c0d 100644 --- a/mmv1/products/transcoder/Job.yaml +++ b/mmv1/products/transcoder/Job.yaml @@ -75,6 +75,7 @@ examples: bucket_name: 'transcoder-job' ignore_read_extra: - 'state' + - 'start_time' - 'end_time' parameters: - name: 'location' From ae71fc652e5736343fe238c04d6a2addc2780c0b Mon Sep 17 00:00:00 2001 From: cdunbar13 <139253655+cdunbar13@users.noreply.github.com> Date: Thu, 14 Nov 2024 17:15:11 -0500 Subject: [PATCH 16/44] Add RDMA features to google-beta provider (#12319) --- mmv1/products/compute/Network.yaml | 10 +++ ...ata_source_google_compute_network.go.tmpl} | 12 ++++ .../compute/resource_compute_instance.go.tmpl | 5 ++ ...resource_compute_instance_template.go.tmpl | 5 ++ .../resource_compute_network_test.go.tmpl | 68 +++++++++++++++++++ ...e_compute_region_instance_template.go.tmpl | 5 ++ .../docs/d/compute_network.html.markdown | 2 + .../docs/r/compute_instance.html.markdown | 2 +- .../r/compute_instance_template.html.markdown | 2 +- ...ute_region_instance_template.html.markdown | 2 +- 10 files changed, 110 insertions(+), 3 deletions(-) rename mmv1/third_party/terraform/services/compute/{data_source_google_compute_network.go => data_source_google_compute_network.go.tmpl} (87%) diff --git a/mmv1/products/compute/Network.yaml b/mmv1/products/compute/Network.yaml index 53d35d980a7a..4a722c4b3193 100644 --- a/mmv1/products/compute/Network.yaml +++ b/mmv1/products/compute/Network.yaml @@ -234,3 +234,13 @@ properties: enum_values: - 'BEFORE_CLASSIC_FIREWALL' - 'AFTER_CLASSIC_FIREWALL' + - name: 'networkProfile' + type: String + immutable: true + min_version: 'beta' + description: | + A full or partial URL of the network profile to apply to this network. + This field can be set only at resource creation time. For example, the + following are valid URLs: + * https://www.googleapis.com/compute/beta/projects/{projectId}/global/networkProfiles/{network_profile_name} + * projects/{projectId}/global/networkProfiles/{network_profile_name} diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl similarity index 87% rename from mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go rename to mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl index f879884a931d..2e3d521ac945 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl @@ -33,6 +33,13 @@ func DataSourceGoogleComputeNetwork() *schema.Resource { Computed: true, }, + {{- if ne $.TargetVersionName "ga" }} + "network_profile": { + Type: schema.TypeString, + Optional: true, + }, + {{- end }} + "self_link": { Type: schema.TypeString, Computed: true, @@ -77,6 +84,11 @@ func dataSourceGoogleComputeNetworkRead(d *schema.ResourceData, meta interface{} if err := d.Set("internal_ipv6_range", network.InternalIpv6Range); err != nil { return fmt.Errorf("Error setting internal_ipv6_range: %s", err) } + {{- if ne $.TargetVersionName "ga" }} + if err := d.Set("network_profile", network.NetworkProfile); err != nil { + return fmt.Errorf("Error setting network_profile: %s", err) + } + {{- end }} if err := d.Set("self_link", network.SelfLink); err != nil { return fmt.Errorf("Error setting self_link: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl index 83ca4470dede..cb91f90c911a 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl @@ -465,8 +465,13 @@ func ResourceComputeInstance() *schema.Resource { Type: schema.TypeString, Optional: true, ForceNew: true, + {{- if eq $.TargetVersionName `ga` }} ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "IDPF"}, false), Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, IDPF`, + {{- else }} + ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "IDPF", "MRDMA", "IRDMA"}, false), + Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, IDPF, MRDMA, and IRDMA`, + {{- end }} }, "access_config": { Type: schema.TypeList, diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl index d5af5e60f92c..5b2ab8d95d94 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl @@ -486,8 +486,13 @@ Google Cloud KMS.`, Type: schema.TypeString, Optional: true, ForceNew: true, + {{- if eq $.TargetVersionName `ga` }} ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET"}, false), Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET`, + {{- else }} + ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "MRDMA", "IRDMA"}, false), + Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, MRDMA, and IRDMA`, + {{- end }} }, "access_config": { Type: schema.TypeList, 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 823d20a2d1cb..87dd65016fc7 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 @@ -218,6 +218,33 @@ func TestAccComputeNetwork_bgpInterRegionCostAndUpdate(t *testing.T) { }, }) } + +func TestAccComputeNetwork_networkProfile(t *testing.T) { + t.Parallel() + + var network compute.Network + suffixName := acctest.RandString(t, 10) + networkName := fmt.Sprintf("tf-network-profile-%s", suffixName) + projectId := envvar.GetTestProjectFromEnv() + profileURL := fmt.Sprintf("https://www.googleapis.com/compute/beta/projects/%s/global/networkProfiles/europe-west1-b-vpc-roce", projectId) + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccComputeNetwork_network_profile(networkName, profileURL), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeNetworkExists( + t, "google_compute_network.acc_network_network_profile", &network), + testAccCheckComputeNetworkHasNetworkProfile( + t, "google_compute_network.acc_network_network_profile", &network, profileURL), + ), + }, + }, + }) +} {{- end }} func TestAccComputeNetwork_numericId(t *testing.T) { @@ -623,6 +650,35 @@ func testAccCheckComputeNetworkHasBgpInterRegionCost(t *testing.T, n string, net return nil } } + +func testAccCheckComputeNetworkHasNetworkProfile(t *testing.T, n string, network *compute.Network, networkProfile string) resource.TestCheckFunc { + return func(s *terraform.State) error { + config := acctest.GoogleProviderConfig(t) + + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + if rs.Primary.Attributes["network_profile"] == "" { + return fmt.Errorf("Network profile not found on resource") + } + + found, err := config.NewComputeClient(config.UserAgent).Networks.Get( + config.Project, network.Name).Do() + if err != nil { + return err + } + + foundNetworkProfile := found.NetworkProfile + + if foundNetworkProfile != networkProfile { + return fmt.Errorf("Expected Network Profile always compare med %s to match actual Network Profile always compare med %s", networkProfile, foundNetworkProfile) + } + + return nil + } +} {{- end }} func testAccCheckComputeNetworkHasNetworkFirewallPolicyEnforcementOrder(t *testing.T, n string, network *compute.Network, order string) resource.TestCheckFunc { @@ -735,6 +791,18 @@ resource "google_compute_network" "acc_network_bgp_inter_region_cost" { } `, networkName, bgpInterRegionCost) } + +func testAccComputeNetwork_network_profile(networkName, networkProfile string) string { + return fmt.Sprintf(` +resource "google_compute_network" "acc_network_network_profile" { + provider = google-beta + name = "%s" + routing_mode = "REGIONAL" + network_profile = "%s" + auto_create_subnetworks = false +} +`, networkName, networkProfile) +} {{- end }} func testAccComputeNetwork_deleteDefaultRoute(networkName string) string { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl index f3888bbd2431..b9b46772dd08 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl @@ -455,8 +455,13 @@ Google Cloud KMS.`, Type: schema.TypeString, Optional: true, ForceNew: true, + {{- if eq $.TargetVersionName `ga` }} ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET"}, false), Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET`, + {{- else }} + ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "MRDMA", "IRDMA"}, false), + Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, MRDMA, and IRDMA`, + {{- end }} }, "access_config": { Type: schema.TypeList, diff --git a/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown index 2cf36ae51a98..7ed18f65fe4a 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown @@ -40,6 +40,8 @@ In addition to the arguments listed above, the following attributes are exported * `internal_ipv6_range` - The ula internal ipv6 range assigned to this network. +* `network_profile` - [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) A full or partial URL of the network profile to apply to this network. + * `subnetworks_self_links` - the list of subnetworks which belong to the network * `self_link` - The URI of the resource. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown index 1521b7ee2cdb..ed5f5e4a3f60 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown @@ -395,7 +395,7 @@ is desired, you will need to modify your state file manually using array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range). -* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, IDPF. +* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, IDPF. In the beta provider the additional values of MRDMA and IRDMA are supported. * `network_attachment` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) The URL of the network attachment that this interface should connect to in the following format: `projects/{projectNumber}/regions/{region_name}/networkAttachments/{network_attachment_name}`. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown index a2621e9d98f4..4e28fc3d1be5 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown @@ -561,7 +561,7 @@ The following arguments are supported: array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range). -* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. +* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. In the beta provider the additional values of MRDMA and IRDMA are supported. * `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6 or IPV4_ONLY. If not specified, IPV4_ONLY will be used. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown index 316dd7ab257d..27bacc5e4bbb 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown @@ -527,7 +527,7 @@ The following arguments are supported: array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range). -* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. +* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. In the beta provider the additional values of MRDMA and IRDMA are supported. * `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6 or IPV4_ONLY. If not specified, IPV4_ONLY will be used. From 9f76fadba2658320af041d1bdb968901ed1ffc9a Mon Sep 17 00:00:00 2001 From: Salome Papiashvili Date: Fri, 15 Nov 2024 18:15:44 +0100 Subject: [PATCH 17/44] Revert "Composer 3 GA" (#12336) --- .../composer/UserWorkloadsConfigMap.yaml | 8 ++- ...er_user_workloads_config_map_basic.tf.tmpl | 2 + .../provider/provider_mmv1_resources.go.tmpl | 7 ++ ...composer_user_workloads_config_map.go.tmpl | 2 + ...ser_user_workloads_config_map_test.go.tmpl | 2 + ...gle_composer_user_workloads_secret.go.tmpl | 2 + ...omposer_user_workloads_secret_test.go.tmpl | 2 + .../resource_composer_environment.go.tmpl | 65 ++++++++++++++++++- ...resource_composer_environment_test.go.tmpl | 6 +- ...ser_user_workloads_config_map_test.go.tmpl | 13 +++- ...rce_composer_user_workloads_secret.go.tmpl | 4 ++ ...omposer_user_workloads_secret_test.go.tmpl | 4 ++ ...er_user_workloads_config_map.html.markdown | 3 + ...mposer_user_workloads_secret.html.markdown | 3 + .../docs/r/composer_environment.html.markdown | 41 ++---------- ...mposer_user_workloads_secret.html.markdown | 3 + 16 files changed, 125 insertions(+), 42 deletions(-) diff --git a/mmv1/products/composer/UserWorkloadsConfigMap.yaml b/mmv1/products/composer/UserWorkloadsConfigMap.yaml index 4efc7c9ec7fe..9835430077f0 100644 --- a/mmv1/products/composer/UserWorkloadsConfigMap.yaml +++ b/mmv1/products/composer/UserWorkloadsConfigMap.yaml @@ -16,9 +16,11 @@ name: 'UserWorkloadsConfigMap' description: | User workloads ConfigMap used by Airflow tasks that run with Kubernetes Executor or KubernetesPodOperator. Intended for Composer 3 Environments. +min_version: 'beta' references: guides: - api: 'https://cloud.google.com/composer/docs/reference/rest/v1/projects.locations.environments.userWorkloadsConfigMaps' + # TODO: add v1 reference when this is moved to ga + api: 'https://cloud.google.com/composer/docs/reference/rest/v1beta1/projects.locations.environments.userWorkloadsConfigMaps' docs: base_url: 'projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsConfigMaps' self_link: 'projects/{{project}}/locations/{{region}}/environments/{{environment}}/userWorkloadsConfigMaps/{{name}}' @@ -39,6 +41,7 @@ parameters: type: String description: | The location or Compute Engine region for the environment. + min_version: 'beta' url_param_only: true immutable: true default_from_api: true @@ -46,6 +49,7 @@ parameters: type: String description: | Environment where the Kubernetes ConfigMap will be stored and used. + min_version: 'beta' url_param_only: true required: true immutable: true @@ -56,6 +60,7 @@ properties: type: String description: | Name of the Kubernetes ConfigMap. + min_version: 'beta' required: true immutable: true custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl' @@ -67,4 +72,5 @@ properties: description: | The "data" field of Kubernetes ConfigMap, organized in key-value pairs. For details see: https://kubernetes.io/docs/concepts/configuration/configmap/ + min_version: 'beta' immutable: false diff --git a/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl b/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl index 5b53968aac54..a2641c1bf801 100644 --- a/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/composer_user_workloads_config_map_basic.tf.tmpl @@ -1,4 +1,5 @@ resource "google_composer_environment" "environment" { + provider = google-beta name = "{{index $.Vars "environment_name"}}" region = "us-central1" config { @@ -9,6 +10,7 @@ resource "google_composer_environment" "environment" { } resource "google_composer_user_workloads_config_map" "{{$.PrimaryResourceId}}" { + provider = google-beta name = "{{index $.Vars "config_map_name"}}" region = "us-central1" environment = google_composer_environment.environment.name 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 4950309f0d9c..9ac625153e69 100644 --- a/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl +++ b/mmv1/third_party/terraform/provider/provider_mmv1_resources.go.tmpl @@ -7,6 +7,9 @@ import ( "github.com/hashicorp/terraform-provider-google/google/services/{{ $service }}" {{- end }} + {{ if eq $.TargetVersionName `ga` }} + "github.com/hashicorp/terraform-provider-google/google/services/composer" + {{- end }} "github.com/hashicorp/terraform-provider-google/google/services/container" "github.com/hashicorp/terraform-provider-google/google/services/containeraws" "github.com/hashicorp/terraform-provider-google/google/services/containerazure" @@ -64,8 +67,10 @@ var handwrittenDatasources = map[string]*schema.Resource{ "google_cloud_run_v2_job": cloudrunv2.DataSourceGoogleCloudRunV2Job(), "google_cloud_run_v2_service": cloudrunv2.DataSourceGoogleCloudRunV2Service(), "google_composer_environment": composer.DataSourceGoogleComposerEnvironment(), + {{- if ne $.TargetVersionName "ga" }} "google_composer_user_workloads_config_map": composer.DataSourceGoogleComposerUserWorkloadsConfigMap(), "google_composer_user_workloads_secret": composer.DataSourceGoogleComposerUserWorkloadsSecret(), + {{- end }} "google_composer_image_versions": composer.DataSourceGoogleComposerImageVersions(), "google_compute_address": compute.DataSourceGoogleComputeAddress(), "google_compute_addresses": compute.DataSourceGoogleComputeAddresses(), @@ -318,7 +323,9 @@ var handwrittenResources = map[string]*schema.Resource{ "google_billing_subaccount": resourcemanager.ResourceBillingSubaccount(), "google_cloudfunctions_function": cloudfunctions.ResourceCloudFunctionsFunction(), "google_composer_environment": composer.ResourceComposerEnvironment(), + {{- if ne $.TargetVersionName "ga" }} "google_composer_user_workloads_secret": composer.ResourceComposerUserWorkloadsSecret(), + {{- end }} "google_compute_attached_disk": compute.ResourceComputeAttachedDisk(), "google_compute_instance": compute.ResourceComputeInstance(), "google_compute_disk_async_replication": compute.ResourceComputeDiskAsyncReplication(), diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map.go.tmpl b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map.go.tmpl index a3aab2c8c184..2f9ad0137118 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map.go.tmpl @@ -1,5 +1,6 @@ package composer +{{ if ne $.TargetVersionName `ga` -}} import ( "fmt" @@ -47,3 +48,4 @@ func dataSourceGoogleComposerUserWorkloadsConfigMapRead(d *schema.ResourceData, return nil } +{{- end }} diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map_test.go.tmpl b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map_test.go.tmpl index ea8e664c2773..eac26bfd11cb 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map_test.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_config_map_test.go.tmpl @@ -1,5 +1,6 @@ package composer_test +{{ if ne $.TargetVersionName `ga` -}} import ( "fmt" "testing" @@ -55,3 +56,4 @@ data "google_composer_user_workloads_config_map" "test" { } `, context) } +{{- end }} diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret.go.tmpl b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret.go.tmpl index 2e6575460548..0acf758493bb 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret.go.tmpl @@ -1,5 +1,6 @@ package composer +{{ if ne $.TargetVersionName `ga` -}} import ( "fmt" @@ -59,3 +60,4 @@ func dataSourceGoogleComposerUserWorkloadsSecretRead(d *schema.ResourceData, met return nil } +{{- end }} diff --git a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret_test.go.tmpl b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret_test.go.tmpl index 2098a4aeb89e..3860a8e8c40f 100644 --- a/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret_test.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/data_source_google_composer_user_workloads_secret_test.go.tmpl @@ -1,5 +1,6 @@ package composer_test +{{ if ne $.TargetVersionName `ga` -}} import ( "errors" "fmt" @@ -98,3 +99,4 @@ data "google_composer_user_workloads_secret" "test" { } `, context) } +{{- end }} diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_environment.go.tmpl b/mmv1/third_party/terraform/services/composer/resource_composer_environment.go.tmpl index 7882a22c4566..e8da985580f1 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_environment.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/resource_composer_environment.go.tmpl @@ -56,7 +56,9 @@ var ( "config.0.software_config.0.python_version", "config.0.software_config.0.scheduler_count", "config.0.software_config.0.cloud_data_lineage_integration", +{{- if ne $.TargetVersionName "ga" }} "config.0.software_config.0.web_server_plugins_mode", +{{- end }} } composerConfigKeys = []string{ @@ -74,8 +76,10 @@ var ( "config.0.environment_size", "config.0.master_authorized_networks_config", "config.0.resilience_mode", +{{- if ne $.TargetVersionName "ga" }} "config.0.enable_private_environment", "config.0.enable_private_builds_only", +{{- end }} "config.0.data_retention_config", } @@ -88,7 +92,9 @@ var ( "config.0.workloads_config.0.triggerer", "config.0.workloads_config.0.web_server", "config.0.workloads_config.0.worker", +{{- if ne $.TargetVersionName "ga" }} "config.0.workloads_config.0.dag_processor", +{{- end }} } composerPrivateEnvironmentConfig = []string{ @@ -167,8 +173,10 @@ func ResourceComposerEnvironment() *schema.Resource { customdiff.ValidateChange("config.0.software_config.0.image_version", imageVersionChangeValidationFunc), versionValidationCustomizeDiffFunc, ), - customdiff.ForceNewIf("config.0.node_config.0.network", forceNewIfNotComposer3CustomDiff("config.0.node_config.0.network")), - customdiff.ForceNewIf("config.0.node_config.0.subnetwork", forceNewIfNotComposer3CustomDiff("config.0.node_config.0.subnetwork")), +{{- if ne $.TargetVersionName "ga" }} + customdiff.ForceNewIf("config.0.node_config.0.network", forceNewCustomDiff("config.0.node_config.0.network")), + customdiff.ForceNewIf("config.0.node_config.0.subnetwork", forceNewCustomDiff("config.0.node_config.0.subnetwork")), +{{- end }} ), Schema: map[string]*schema.Schema{ @@ -238,18 +246,29 @@ func ResourceComposerEnvironment() *schema.Resource { Type: schema.TypeString, Computed: true, Optional: true, +{{- if eq $.TargetVersionName "ga" }} + ForceNew: true, +{{- else }} + ForceNew: false, ConflictsWith: []string{"config.0.node_config.0.composer_network_attachment"}, +{{- end }} DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, Description: `The Compute Engine machine type used for cluster instances, specified as a name or relative resource name. For example: "projects/{project}/zones/{zone}/machineTypes/{machineType}". Must belong to the enclosing environment's project and region/zone. The network must belong to the environment's project. If unspecified, the "default" network ID in the environment's project is used. If a Custom Subnet Network is provided, subnetwork must also be provided.`, }, "subnetwork": { Type: schema.TypeString, Optional: true, +{{- if eq $.TargetVersionName "ga" }} + ForceNew: true, +{{- else }} + ForceNew: false, Computed: true, ConflictsWith: []string{"config.0.node_config.0.composer_network_attachment"}, +{{- end }} DiffSuppressFunc: tpgresource.CompareSelfLinkOrResourceName, Description: `The Compute Engine subnetwork to be used for machine communications, specified as a self-link, relative resource name (e.g. "projects/{project}/regions/{region}/subnetworks/{subnetwork}"), or by name. If subnetwork is provided, network must also be provided and the subnetwork must belong to the enclosing environment's project and region.`, }, +{{- if ne $.TargetVersionName "ga" }} "composer_network_attachment": { Type: schema.TypeString, Computed: true, @@ -257,6 +276,7 @@ func ResourceComposerEnvironment() *schema.Resource { ForceNew: false, Description: `PSC (Private Service Connect) Network entry point. Customers can pre-create the Network Attachment and point Cloud Composer environment to use. It is possible to share network attachment among many environments, provided enough IP addresses are available.`, }, +{{- end }} "disk_size_gb": { Type: schema.TypeInt, Computed: true, @@ -365,6 +385,7 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, +{{- if ne $.TargetVersionName "ga" }} "composer_internal_ipv4_cidr_block": { Type: schema.TypeString, Computed: true, @@ -373,6 +394,7 @@ func ResourceComposerEnvironment() *schema.Resource { ValidateFunc: validateComposerInternalIpv4CidrBlock, Description: `IPv4 cidr range that will be used by Composer internal components.`, }, +{{- end }} }, }, }, @@ -491,6 +513,7 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, +{{- if ne $.TargetVersionName "ga" }} "web_server_plugins_mode": { Type: schema.TypeString, Optional: true, @@ -500,6 +523,7 @@ func ResourceComposerEnvironment() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{"ENABLED", "DISABLED"}, false), Description: `Should be either 'ENABLED' or 'DISABLED'. Defaults to 'ENABLED'. Used in Composer 3.`, }, +{{- end }} }, }, }, @@ -582,6 +606,7 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, +{{- if ne $.TargetVersionName "ga" }} "enable_private_environment": { Type: schema.TypeBool, Computed: true, @@ -598,6 +623,7 @@ func ResourceComposerEnvironment() *schema.Resource { AtLeastOneOf: composerConfigKeys, Description: `Optional. If true, builds performed during operations that install Python packages have only private connectivity to Google services. If false, the builds also have access to the internet.`, }, +{{- end }} "web_server_network_access_control": { Type: schema.TypeList, Optional: true, @@ -907,6 +933,7 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, +{{- if ne $.TargetVersionName "ga" }} "dag_processor": { Type: schema.TypeList, Optional: true, @@ -952,6 +979,7 @@ func ResourceComposerEnvironment() *schema.Resource { }, }, }, +{{- end }} }, }, }, @@ -1197,6 +1225,7 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) return err } +{{ if ne $.TargetVersionName `ga` -}} noChangeErrorMessage := "Update request does not result in any change to the environment's configuration" if d.HasChange("config.0.node_config.0.network") || d.HasChange("config.0.node_config.0.subnetwork"){ // step 1: update with empty network and subnetwork @@ -1256,6 +1285,7 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) } } } +{{- end }} if d.HasChange("config.0.software_config.0.image_version") { patchObj := &composer.Environment{ @@ -1357,6 +1387,7 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) } } +{{ if ne $.TargetVersionName `ga` -}} if d.HasChange("config.0.enable_private_environment") { patchObj := &composer.Environment{ Config: &composer.EnvironmentConfig{ @@ -1398,6 +1429,7 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) return err } } +{{- end }} if d.HasChange("config.0.node_count") { patchObj := &composer.Environment{Config: &composer.EnvironmentConfig{}} @@ -1657,10 +1689,12 @@ func flattenComposerEnvironmentConfig(envCfg *composer.EnvironmentConfig) interf if !isComposer3(imageVersion){ transformed["private_environment_config"] = flattenComposerEnvironmentConfigPrivateEnvironmentConfig(envCfg.PrivateEnvironmentConfig) } +{{- if ne $.TargetVersionName "ga" }} if isComposer3(imageVersion) && envCfg.PrivateEnvironmentConfig != nil { transformed["enable_private_environment"] = envCfg.PrivateEnvironmentConfig.EnablePrivateEnvironment transformed["enable_private_builds_only"] = envCfg.PrivateEnvironmentConfig.EnablePrivateBuildsOnly } +{{- end }} transformed["web_server_network_access_control"] = flattenComposerEnvironmentConfigWebServerNetworkAccessControl(envCfg.WebServerNetworkAccessControl) transformed["database_config"] = flattenComposerEnvironmentConfigDatabaseConfig(envCfg.DatabaseConfig) transformed["web_server_config"] = flattenComposerEnvironmentConfigWebServerConfig(envCfg.WebServerConfig) @@ -1803,13 +1837,17 @@ func flattenComposerEnvironmentConfigWorkloadsConfig(workloadsConfig *composer.W transformedTriggerer := make(map[string]interface{}) transformedWebServer := make(map[string]interface{}) transformedWorker := make(map[string]interface{}) +{{- if ne $.TargetVersionName "ga" }} transformedDagProcessor := make(map[string]interface{}) +{{- end }} wlCfgScheduler := workloadsConfig.Scheduler wlCfgTriggerer := workloadsConfig.Triggerer wlCfgWebServer := workloadsConfig.WebServer wlCfgWorker := workloadsConfig.Worker +{{- if ne $.TargetVersionName "ga" }} wlCfgDagProcessor := workloadsConfig.DagProcessor +{{- end }} if wlCfgScheduler == nil { transformedScheduler = nil @@ -1846,6 +1884,7 @@ func flattenComposerEnvironmentConfigWorkloadsConfig(workloadsConfig *composer.W transformedWorker["max_count"] = wlCfgWorker.MaxCount } +{{ if ne $.TargetVersionName `ga` -}} if wlCfgDagProcessor == nil { transformedDagProcessor = nil } else { @@ -1854,6 +1893,7 @@ func flattenComposerEnvironmentConfigWorkloadsConfig(workloadsConfig *composer.W transformedDagProcessor["storage_gb"] = wlCfgDagProcessor.StorageGb transformedDagProcessor["count"] = wlCfgDagProcessor.Count } +{{- end }} transformed["scheduler"] = []interface{}{transformedScheduler} if transformedTriggerer != nil { @@ -1861,9 +1901,12 @@ func flattenComposerEnvironmentConfigWorkloadsConfig(workloadsConfig *composer.W } transformed["web_server"] = []interface{}{transformedWebServer} transformed["worker"] = []interface{}{transformedWorker} +{{- if ne $.TargetVersionName "ga" }} if transformedDagProcessor != nil { transformed["dag_processor"] = []interface{}{transformedDagProcessor} } +{{- end }} + return []interface{}{transformed} } @@ -1899,7 +1942,9 @@ func flattenComposerEnvironmentConfigNodeConfig(nodeCfg *composer.NodeConfig) in transformed["machine_type"] = nodeCfg.MachineType transformed["network"] = nodeCfg.Network transformed["subnetwork"] = nodeCfg.Subnetwork +{{- if ne $.TargetVersionName "ga" }} transformed["composer_network_attachment"] = nodeCfg.ComposerNetworkAttachment +{{- end }} transformed["disk_size_gb"] = nodeCfg.DiskSizeGb transformed["service_account"] = nodeCfg.ServiceAccount transformed["oauth_scopes"] = flattenComposerEnvironmentConfigNodeConfigOauthScopes(nodeCfg.OauthScopes) @@ -1909,7 +1954,9 @@ func flattenComposerEnvironmentConfigNodeConfig(nodeCfg *composer.NodeConfig) in transformed["enable_ip_masq_agent"] = nodeCfg.EnableIpMasqAgent transformed["tags"] = flattenComposerEnvironmentConfigNodeConfigTags(nodeCfg.Tags) transformed["ip_allocation_policy"] = flattenComposerEnvironmentConfigNodeConfigIPAllocationPolicy(nodeCfg.IpAllocationPolicy) +{{- if ne $.TargetVersionName "ga" }} transformed["composer_internal_ipv4_cidr_block"] = nodeCfg.ComposerInternalIpv4CidrBlock +{{- end }} return []interface{}{transformed} } @@ -1953,6 +2000,7 @@ func flattenComposerEnvironmentConfigSoftwareConfig(softwareCfg *composer.Softwa transformed["env_variables"] = softwareCfg.EnvVariables transformed["scheduler_count"] = softwareCfg.SchedulerCount transformed["cloud_data_lineage_integration"] = flattenComposerEnvironmentConfigSoftwareConfigCloudDataLineageIntegration(softwareCfg.CloudDataLineageIntegration) +{{- if ne $.TargetVersionName "ga" }} if softwareCfg.WebServerPluginsMode == "PLUGINS_DISABLED"{ transformed["web_server_plugins_mode"] = "DISABLED" } else if softwareCfg.WebServerPluginsMode == "PLUGINS_ENABLED"{ @@ -1960,6 +2008,7 @@ func flattenComposerEnvironmentConfigSoftwareConfig(softwareCfg *composer.Softwa } else { transformed["web_server_plugins_mode"] = softwareCfg.WebServerPluginsMode } +{{- end }} return []interface{}{transformed} } @@ -2029,6 +2078,7 @@ func expandComposerEnvironmentConfig(v interface{}, d *schema.ResourceData, conf } transformed.PrivateEnvironmentConfig = transformedPrivateEnvironmentConfig +{{ if ne $.TargetVersionName `ga` -}} /* config.enable_private_environment in terraform maps to composer.PrivateEnvironmentConfig.EnablePrivateEnvironment in API. @@ -2044,6 +2094,7 @@ func expandComposerEnvironmentConfig(v interface{}, d *schema.ResourceData, conf transformed.PrivateEnvironmentConfig.EnablePrivateBuildsOnly = enablePrivateBuildsOnlyRaw.(bool) } } +{{- end }} transformedWebServerNetworkAccessControl, err := expandComposerEnvironmentConfigWebServerNetworkAccessControl(original["web_server_network_access_control"], d, config) if err != nil { @@ -2342,6 +2393,7 @@ func expandComposerEnvironmentConfigWorkloadsConfig(v interface{}, d *schema.Res } } +{{ if ne $.TargetVersionName `ga` -}} if v, ok := original["dag_processor"]; ok { if len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { transformedDagProcessor := &composer.DagProcessorResource{} @@ -2353,6 +2405,7 @@ func expandComposerEnvironmentConfigWorkloadsConfig(v interface{}, d *schema.Res transformed.DagProcessor = transformedDagProcessor } } +{{- end }} return transformed, nil } @@ -2509,9 +2562,11 @@ func expandComposerEnvironmentConfigNodeConfig(v interface{}, d *schema.Resource transformed.Subnetwork = transformedSubnetwork } +{{ if ne $.TargetVersionName `ga` -}} if v, ok := original["composer_network_attachment"]; ok { transformed.ComposerNetworkAttachment = v.(string) } +{{- end }} transformedIPAllocationPolicy, err := expandComposerEnvironmentIPAllocationPolicy(original["ip_allocation_policy"], d, config) if err != nil { @@ -2531,9 +2586,11 @@ func expandComposerEnvironmentConfigNodeConfig(v interface{}, d *schema.Resource } transformed.Tags = transformedTags +{{ if ne $.TargetVersionName `ga` -}} if transformedComposerInternalIpv4CidrBlock, ok := original["composer_internal_ipv4_cidr_block"]; ok { transformed.ComposerInternalIpv4CidrBlock = transformedComposerInternalIpv4CidrBlock.(string) } +{{- end }} return transformed, nil } @@ -2684,6 +2741,7 @@ func expandComposerEnvironmentConfigSoftwareConfig(v interface{}, d *schema.Reso } transformed.CloudDataLineageIntegration = transformedCloudDataLineageIntegration +{{ if ne $.TargetVersionName `ga` -}} if original["web_server_plugins_mode"].(string) == "DISABLED"{ transformed.WebServerPluginsMode = "PLUGINS_DISABLED" } else if original["web_server_plugins_mode"].(string) == "ENABLED"{ @@ -2691,6 +2749,7 @@ func expandComposerEnvironmentConfigSoftwareConfig(v interface{}, d *schema.Reso } else { transformed.WebServerPluginsMode = original["web_server_plugins_mode"].(string) } +{{- end }} return transformed, nil } @@ -2988,7 +3047,7 @@ func isComposer3(imageVersion string) bool { return strings.Contains(imageVersion, "composer-3") } -func forceNewIfNotComposer3CustomDiff(key string) customdiff.ResourceConditionFunc { +func forceNewCustomDiff(key string) customdiff.ResourceConditionFunc { return func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) bool { old, new := d.GetChange(key) imageVersion := d.Get("config.0.software_config.0.image_version").(string) 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 248cf1222c44..8fc8e27024b7 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 @@ -1191,6 +1191,7 @@ func TestAccComposerEnvironment_customBucketWithUrl(t *testing.T) { }) } +{{ if ne $.TargetVersionName `ga` -}} // Checks Composer 3 environment creation with new fields. func TestAccComposerEnvironmentComposer3_basic(t *testing.T) { t.Parallel() @@ -1547,6 +1548,7 @@ func TestAccComposerEnvironmentComposer3_usesUnsupportedField_expectError(t *tes }, }) } +{{- end }} func testAccComposerEnvironment_customBucket(bucketName, envName, network, subnetwork string) string { return fmt.Sprintf(` @@ -3231,6 +3233,7 @@ resource "google_project_iam_member" "composer-worker" { `, environment, network, subnetwork, serviceAccount) } +{{ if ne $.TargetVersionName `ga` -}} func testAccComposerEnvironmentComposer2_empty(name, network, subnetwork string) string { return fmt.Sprintf(` resource "google_composer_environment" "test" { @@ -3299,7 +3302,7 @@ resource "google_composer_environment" "test" { config { software_config { image_version = "composer-2-airflow-2" - web_server_plugins_mode = "ENABLED" + web_server_plugins_mode = "ENABLED" } } } @@ -3570,6 +3573,7 @@ resource "google_compute_subnetwork" "test" { } `, name, networkAttachment, network, subnetwork) } +{{- end }} // WARNING: This is not actually a check and is a terrible clean-up step because Composer Environments // have a bug that hasn't been fixed. Composer will add firewalls to non-default networks for environments diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_config_map_test.go.tmpl b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_config_map_test.go.tmpl index 37feb346b799..312d8331f75b 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_config_map_test.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_config_map_test.go.tmpl @@ -1,5 +1,7 @@ package composer_test +{{ if ne $.TargetVersionName `ga` -}} + import ( "fmt" "strings" @@ -20,7 +22,7 @@ func TestAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicEx acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComposerUserWorkloadsConfigMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -56,7 +58,7 @@ func TestAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicEx acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), CheckDestroy: testAccCheckComposerUserWorkloadsConfigMapDestroyProducer(t), Steps: []resource.TestStep{ { @@ -80,6 +82,7 @@ func TestAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicEx func testAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicExample_basic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_composer_environment" "environment" { + provider = google-beta name = "tf-test-test-environment%{random_suffix}" region = "us-central1" config { @@ -90,6 +93,7 @@ resource "google_composer_environment" "environment" { } resource "google_composer_user_workloads_config_map" "config_map" { + provider = google-beta name = "tf-test-test-config-map%{random_suffix}" region = "us-central1" environment = google_composer_environment.environment.name @@ -103,6 +107,7 @@ resource "google_composer_user_workloads_config_map" "config_map" { func testAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicExample_update(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_composer_environment" "environment" { + provider = google-beta name = "tf-test-test-environment%{random_suffix}" region = "us-central1" config { @@ -113,6 +118,7 @@ resource "google_composer_environment" "environment" { } resource "google_composer_user_workloads_config_map" "config_map" { + provider = google-beta name = "tf-test-test-config-map%{random_suffix}" region = "us-central1" environment = google_composer_environment.environment.name @@ -126,6 +132,7 @@ resource "google_composer_user_workloads_config_map" "config_map" { func testAccComposerUserWorkloadsConfigMap_composerUserWorkloadsConfigMapBasicExample_delete(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_composer_environment" "environment" { + provider = google-beta name = "tf-test-test-environment%{random_suffix}" region = "us-central1" config { @@ -159,3 +166,5 @@ func testAccComposerUserWorkloadsConfigMapDestroyed(t *testing.T) func(s *terraf return nil } } + +{{ end }} diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret.go.tmpl b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret.go.tmpl index 9cea9a079dbb..94ebd8182ebc 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret.go.tmpl @@ -1,5 +1,7 @@ package composer +{{ if ne $.TargetVersionName `ga` -}} + import ( "fmt" "log" @@ -265,3 +267,5 @@ func (n *UserWorkloadsSecretName) ResourceName() string { func (n *UserWorkloadsSecretName) ParentName() string { return fmt.Sprintf("projects/%s/locations/%s/environments/%s", n.Project, n.Region, n.Environment) } + +{{ end }} diff --git a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret_test.go.tmpl b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret_test.go.tmpl index cb83e29ce0d0..9008bfdc65df 100644 --- a/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret_test.go.tmpl +++ b/mmv1/third_party/terraform/services/composer/resource_composer_user_workloads_secret_test.go.tmpl @@ -1,5 +1,7 @@ package composer_test +{{ if ne $.TargetVersionName `ga` -}} + import ( "fmt" "testing" @@ -177,3 +179,5 @@ func testAccComposerUserWorkloadsSecretDestroyed(t *testing.T) func(s *terraform return nil } } + +{{ end }} diff --git a/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_config_map.html.markdown b/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_config_map.html.markdown index 00e2a0d4a27f..f582d646df88 100644 --- a/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_config_map.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_config_map.html.markdown @@ -8,6 +8,9 @@ description: |- Provides access to Kubernetes ConfigMap configuration for a given project, region and Composer Environment. +> **Warning:** This data source is in beta, and should be used with the terraform-provider-google-beta provider. +See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. + ## Example Usage ```hcl diff --git a/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_secret.html.markdown b/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_secret.html.markdown index 3b7f61b87562..93f5356a781f 100644 --- a/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_secret.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/composer_user_workloads_secret.html.markdown @@ -8,6 +8,9 @@ description: |- Provides access to Kubernetes Secret configuration for a given project, region and Composer Environment. +~> **Warning:** This data source is in beta, and should be used with the terraform-provider-google-beta provider. +See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. + ## Example Usage ```hcl diff --git a/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown b/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown index 8f560d4f662f..35740d97bcb9 100644 --- a/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown @@ -363,35 +363,6 @@ resource "google_composer_environment" "example" { } ``` -If you specify an existing network attachment that you also manage in Terraform, then Terraform will revert changes -to the attachment done by Cloud Composer when you apply configuration changes. As a result, the environment will no -longer use the attachment. To address this problem, make sure that Terraform ignores changes to the -`producer_accept_lists` parameter of the attachment, as follows: - -```hcl -resource "google_compute_network_attachment" "example" { - lifecycle { - ignore_changes = [producer_accept_lists] - } - - # ... other configuration parameters -} - -resource "google_composer_environment" "example" { - name = "example-environment" - region = "us-central1" - - config { - - node_config { - composer_network_attachment = google_compute_network_attachment.example.id - } - - # ... other configuration parameters - } -} -``` - ### With Software (Airflow) Config ```hcl @@ -1332,11 +1303,11 @@ The following arguments are supported: The configuration settings for software (Airflow) inside the environment. Structure is [documented below](#nested_software_config_c3). * `enable_private_environment` - - (Optional, Cloud Composer 3 only) + (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) If true, a private Composer environment will be created. * `enable_private_builds_only` - - (Optional, Cloud Composer 3 only) + (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) If true, builds performed during operations that install Python packages have only private connectivity to Google services. If false, the builds also have access to the internet. @@ -1406,7 +1377,7 @@ The following arguments are supported: network must also be provided and the subnetwork must belong to the enclosing environment's project and region. * `composer_network_attachment` - - (Optional, Cloud Composer 3 only) + (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) PSC (Private Service Connect) Network entry point. Customers can pre-create the Network Attachment and point Cloud Composer environment to use. It is possible to share network attachment among many environments, provided enough IP addresses are available. @@ -1427,7 +1398,7 @@ The following arguments are supported: Cannot be updated. * `composer_internal_ipv4_cidr_block` - - (Optional, Cloud Composer 3 only) + (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) /20 IPv4 cidr range that will be used by Composer internal components. Cannot be updated. @@ -1500,7 +1471,7 @@ The following arguments are supported: [documented below](#nested_cloud_data_lineage_integration_c3). * `web_server_plugins_mode` - - (Optional, Cloud Composer 3 only) + (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) Web server plugins configuration. Can be either 'ENABLED' or 'DISABLED'. Defaults to 'ENABLED'. The `cloud_data_lineage_integration` block supports: @@ -1552,7 +1523,7 @@ The `workloads_config` block supports: Configuration for resources used by Airflow workers. * `dag_processor` - - (Optional, Cloud Composer 3 only) + (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), Cloud Composer 3 only) Configuration for resources used by DAG processor. The `scheduler` block supports: diff --git a/mmv1/third_party/terraform/website/docs/r/composer_user_workloads_secret.html.markdown b/mmv1/third_party/terraform/website/docs/r/composer_user_workloads_secret.html.markdown index e07d8293d763..797798867148 100644 --- a/mmv1/third_party/terraform/website/docs/r/composer_user_workloads_secret.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/composer_user_workloads_secret.html.markdown @@ -6,6 +6,9 @@ description: |- # google_composer_user_workloads_secret +~> **Warning:** These resources are in beta, and should be used with the terraform-provider-google-beta provider. +See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. + User workloads Secret used by Airflow tasks that run with Kubernetes Executor or KubernetesPodOperator. Intended for Composer 3 Environments. From ab80e5eff2c6c9f9515622b93cdade13a4719e5c Mon Sep 17 00:00:00 2001 From: "Stephen Lewis (Burrows)" Date: Fri, 15 Nov 2024 09:44:46 -0800 Subject: [PATCH 18/44] Made traffic_split field use default_from_api (#12323) --- mmv1/products/vertexai/Endpoint.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mmv1/products/vertexai/Endpoint.yaml b/mmv1/products/vertexai/Endpoint.yaml index aaf985fced27..4a6bc362f498 100644 --- a/mmv1/products/vertexai/Endpoint.yaml +++ b/mmv1/products/vertexai/Endpoint.yaml @@ -367,15 +367,15 @@ properties: output: true - name: 'trafficSplit' type: String + default_from_api: true description: | A map from a DeployedModel's id to the percentage of this Endpoint's traffic that should be forwarded to that DeployedModel. If a DeployedModel's id is not listed in this map, then it receives no traffic. - The traffic percentage values must add up to 100, or map must be empty if the Endpoint is to not accept any traffic at a moment. - - ~> **Note:** The `traffic_split` setting only applies after a model has been deployed to the endpoint. Re-applying a `google_vertex_ai_endpoint` - resource without updating the `traffic_split` post-deployment may lead to your deployed `traffic_split` being lost; see + The traffic percentage values must add up to 100, or map must be empty if the Endpoint is to not accept any traffic at a moment. See the `deployModel` [example](https://cloud.google.com/vertex-ai/docs/general/deployment#deploy_a_model_to_an_endpoint) and - [documentation](https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/projects.locations.endpoints/deployModel) for details. + [documentation](https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/projects.locations.endpoints/deployModel) for more information. + + ~> **Note:** To set the map to empty, set `"{}"`, apply, and then remove the field from your config. state_func: 'func(v interface{}) string { s, _ := structure.NormalizeJsonString(v); return s }' custom_flatten: 'templates/terraform/custom_flatten/json_schema.tmpl' custom_expand: 'templates/terraform/custom_expand/json_schema.tmpl' From c7b7dc40571ddeb6e160035600d512d413dfbbb5 Mon Sep 17 00:00:00 2001 From: Ryan Oaks Date: Fri, 15 Nov 2024 13:53:52 -0500 Subject: [PATCH 19/44] Add resource metadata for dcl resources (#12266) --- mmv1/provider/template_data.go | 3 +++ mmv1/provider/terraform.go | 6 +++++- .../services/apikeys/resource_apikeys_key_meta.yaml | 5 +++++ .../resource_assured_workloads_workload_meta.yaml.tmpl | 9 +++++++++ .../cloudbuild/resource_cloudbuild_worker_pool_meta.yaml | 5 +++++ ...resource_clouddeploy_delivery_pipeline_meta copy.yaml | 5 +++++ .../clouddeploy/resource_clouddeploy_target_meta.yaml | 5 +++++ .../resource_compute_firewall_policy_meta.yaml.tmpl | 9 +++++++++ .../resource_container_aws_cluster_meta.yaml | 5 +++++ .../resource_container_aws_node_pool_meta.yaml | 5 +++++ .../resource_container_azure_client_meta.yaml | 5 +++++ .../resource_container_azure_cluster_meta.yaml | 5 +++++ .../resource_container_azure_node_pool_meta.yaml | 5 +++++ .../services/dataplex/resource_dataplex_asset_meta.yaml | 5 +++++ .../services/dataplex/resource_dataplex_lake_meta.yaml | 5 +++++ .../services/dataplex/resource_dataplex_zone_meta.yaml | 5 +++++ .../resource_dataproc_workflow_template_meta.yaml | 5 +++++ .../eventarc/resource_eventarc_channel_meta.yaml | 5 +++++ .../resource_eventarc_google_channel_config_meta.yaml | 5 +++++ .../eventarc/resource_eventarc_trigger_meta.yaml | 5 +++++ .../resource_firebaserules_release_meta.yaml | 5 +++++ .../resource_firebaserules_ruleset_meta.yaml | 5 +++++ .../resource_gke_hub_feature_membership_meta.yaml.tmpl | 9 +++++++++ .../resource_recaptcha_enterprise_key_meta.yaml | 5 +++++ 24 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 mmv1/third_party/terraform/services/apikeys/resource_apikeys_key_meta.yaml create mode 100644 mmv1/third_party/terraform/services/assuredworkloads/resource_assured_workloads_workload_meta.yaml.tmpl create mode 100644 mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_meta.yaml create mode 100644 mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_delivery_pipeline_meta copy.yaml create mode 100644 mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_meta.yaml create mode 100644 mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_meta.yaml.tmpl create mode 100644 mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml create mode 100644 mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml create mode 100644 mmv1/third_party/terraform/services/containerazure/resource_container_azure_client_meta.yaml create mode 100644 mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml create mode 100644 mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml create mode 100644 mmv1/third_party/terraform/services/dataplex/resource_dataplex_asset_meta.yaml create mode 100644 mmv1/third_party/terraform/services/dataplex/resource_dataplex_lake_meta.yaml create mode 100644 mmv1/third_party/terraform/services/dataplex/resource_dataplex_zone_meta.yaml create mode 100644 mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml create mode 100644 mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_meta.yaml create mode 100644 mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_meta.yaml create mode 100644 mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_meta.yaml create mode 100644 mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_release_meta.yaml create mode 100644 mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_ruleset_meta.yaml create mode 100644 mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_meta.yaml.tmpl create mode 100644 mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml diff --git a/mmv1/provider/template_data.go b/mmv1/provider/template_data.go index a7795c873054..6d1ea21a03a2 100644 --- a/mmv1/provider/template_data.go +++ b/mmv1/provider/template_data.go @@ -212,6 +212,9 @@ func (td *TemplateData) GenerateFile(filePath, templatePath string, input any, g } sourceByte := contents.Bytes() + if len(sourceByte) == 0 { + return + } if goFormat { formattedByte, err := format.Source(sourceByte) diff --git a/mmv1/provider/terraform.go b/mmv1/provider/terraform.go index 14aa6ddfaef9..0820c16caac2 100644 --- a/mmv1/provider/terraform.go +++ b/mmv1/provider/terraform.go @@ -488,6 +488,10 @@ func (t Terraform) CompileFileList(outputFolder string, files map[string]string, formatFile := filepath.Ext(targetFile) == ".go" fileTemplate.GenerateFile(targetFile, source, providerWithProducts, formatFile, templates...) + // continue to next file if no file was generated + if _, err := os.Stat(targetFile); errors.Is(err, os.ErrNotExist) { + continue + } t.replaceImportPath(outputFolder, target) t.addHashicorpCopyRightHeader(outputFolder, target) } @@ -510,7 +514,7 @@ func (t Terraform) addHashicorpCopyRightHeader(outputFolder, target string) { // The test-fixtures folder is not included here as it's copied as a whole, // not file by file ignoredFolders := []string{".release/", ".changelog/", "examples/", "scripts/", "META.d/"} - ignoredFiles := []string{"go.mod", ".goreleaser.yml", ".golangci.yml", "terraform-registry-manifest.json"} + ignoredFiles := []string{"go.mod", ".goreleaser.yml", ".golangci.yml", "terraform-registry-manifest.json", "_meta.yaml"} shouldAddHeader := true for _, folder := range ignoredFolders { // folder will be path leading to file diff --git a/mmv1/third_party/terraform/services/apikeys/resource_apikeys_key_meta.yaml b/mmv1/third_party/terraform/services/apikeys/resource_apikeys_key_meta.yaml new file mode 100644 index 000000000000..1470e1ae3812 --- /dev/null +++ b/mmv1/third_party/terraform/services/apikeys/resource_apikeys_key_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_apikeys_key' +generation_type: 'dcl' +api_service_name: 'apikeys.googleapis.com' +api_version: 'v2' +api_resource_type_kind: 'Key' diff --git a/mmv1/third_party/terraform/services/assuredworkloads/resource_assured_workloads_workload_meta.yaml.tmpl b/mmv1/third_party/terraform/services/assuredworkloads/resource_assured_workloads_workload_meta.yaml.tmpl new file mode 100644 index 000000000000..03d3b64eecc2 --- /dev/null +++ b/mmv1/third_party/terraform/services/assuredworkloads/resource_assured_workloads_workload_meta.yaml.tmpl @@ -0,0 +1,9 @@ +resource: 'google_assured_workloads_workload' +generation_type: 'dcl' +api_service_name: 'assuredworkloads.googleapis.com' +{{- if ne $.TargetVersionName "ga" }} +api_version: 'v1beta1' +{{- else }} +api_version: 'v1' +{{- end }} +api_resource_type_kind: 'Workload' diff --git a/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_meta.yaml b/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_meta.yaml new file mode 100644 index 000000000000..8229c42375a4 --- /dev/null +++ b/mmv1/third_party/terraform/services/cloudbuild/resource_cloudbuild_worker_pool_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_cloudbuild_worker_pool' +generation_type: 'dcl' +api_service_name: 'cloudbuild.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'WorkerPool' diff --git a/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_delivery_pipeline_meta copy.yaml b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_delivery_pipeline_meta copy.yaml new file mode 100644 index 000000000000..825fbe8df525 --- /dev/null +++ b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_delivery_pipeline_meta copy.yaml @@ -0,0 +1,5 @@ +resource: 'google_clouddeploy_delivery_pipeline' +generation_type: 'dcl' +api_service_name: 'clouddeploy.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'DeliveryPipeline' diff --git a/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_meta.yaml b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_meta.yaml new file mode 100644 index 000000000000..9283431289bf --- /dev/null +++ b/mmv1/third_party/terraform/services/clouddeploy/resource_clouddeploy_target_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_clouddeploy_target' +generation_type: 'dcl' +api_service_name: 'clouddeploy.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Target' diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_meta.yaml.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_meta.yaml.tmpl new file mode 100644 index 000000000000..e93899f2abda --- /dev/null +++ b/mmv1/third_party/terraform/services/compute/resource_compute_firewall_policy_meta.yaml.tmpl @@ -0,0 +1,9 @@ +resource: 'google_compute_firewall_policy' +generation_type: 'dcl' +api_service_name: 'compute.googleapis.com' +{{- if ne $.TargetVersionName "ga" }} +api_version: 'beta' +{{- else }} +api_version: 'v1' +{{- end }} +api_resource_type_kind: 'FirewallPolicy' diff --git a/mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml new file mode 100644 index 000000000000..136d7b70c07e --- /dev/null +++ b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_cluster_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_container_aws_cluster' +generation_type: 'dcl' +api_service_name: 'gkemulticloud.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'AwsCluster' diff --git a/mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml new file mode 100644 index 000000000000..d56ecfa56e4b --- /dev/null +++ b/mmv1/third_party/terraform/services/containeraws/resource_container_aws_node_pool_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_container_aws_node_pool' +generation_type: 'dcl' +api_service_name: 'gkemulticloud.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'AwsNodePool' diff --git a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_client_meta.yaml b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_client_meta.yaml new file mode 100644 index 000000000000..64767424a28c --- /dev/null +++ b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_client_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_container_azure_client' +generation_type: 'dcl' +api_service_name: 'gkemulticloud.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'AzureClient' diff --git a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml new file mode 100644 index 000000000000..050efdd73bfb --- /dev/null +++ b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_cluster_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_container_azure_node_pool' +generation_type: 'dcl' +api_service_name: 'gkemulticloud.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'AzureNodePool' diff --git a/mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml new file mode 100644 index 000000000000..d56ecfa56e4b --- /dev/null +++ b/mmv1/third_party/terraform/services/containerazure/resource_container_azure_node_pool_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_container_aws_node_pool' +generation_type: 'dcl' +api_service_name: 'gkemulticloud.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'AwsNodePool' diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_asset_meta.yaml b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_asset_meta.yaml new file mode 100644 index 000000000000..8a368e8ea655 --- /dev/null +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_asset_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_dataplex_asset' +generation_type: 'dcl' +api_service_name: 'dataplex.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Asset' diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_lake_meta.yaml b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_lake_meta.yaml new file mode 100644 index 000000000000..30f0bc819765 --- /dev/null +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_lake_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_dataplex_lake' +generation_type: 'dcl' +api_service_name: 'dataplex.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Lake' diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_zone_meta.yaml b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_zone_meta.yaml new file mode 100644 index 000000000000..10cec64e04a1 --- /dev/null +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_zone_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_dataplex_zone' +generation_type: 'dcl' +api_service_name: 'dataplex.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Zone' diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml new file mode 100644 index 000000000000..e1524801d445 --- /dev/null +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_workflow_template_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_dataproc_workflow_template' +generation_type: 'dcl' +api_service_name: 'dataproc.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'WorkflowTemplate' diff --git a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_meta.yaml b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_meta.yaml new file mode 100644 index 000000000000..5a85e593fca1 --- /dev/null +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_channel_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_eventarc_channel' +generation_type: 'dcl' +api_service_name: 'eventarc.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Channel' diff --git a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_meta.yaml b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_meta.yaml new file mode 100644 index 000000000000..f7a2801a2eb2 --- /dev/null +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_google_channel_config_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_eventarc_google_channel_config' +generation_type: 'dcl' +api_service_name: 'eventarc.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'GoogleChannelConfig' diff --git a/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_meta.yaml b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_meta.yaml new file mode 100644 index 000000000000..c32ae3d26500 --- /dev/null +++ b/mmv1/third_party/terraform/services/eventarc/resource_eventarc_trigger_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_eventarc_trigger' +generation_type: 'dcl' +api_service_name: 'eventarc.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Trigger' diff --git a/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_release_meta.yaml b/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_release_meta.yaml new file mode 100644 index 000000000000..aa64cff5f49f --- /dev/null +++ b/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_release_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_firebaserules_release' +generation_type: 'dcl' +api_service_name: 'firebaserules.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Release' diff --git a/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_ruleset_meta.yaml b/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_ruleset_meta.yaml new file mode 100644 index 000000000000..d83f53f09153 --- /dev/null +++ b/mmv1/third_party/terraform/services/firebaserules/resource_firebaserules_ruleset_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_firebaserules_ruleset' +generation_type: 'dcl' +api_service_name: 'firebaserules.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Ruleset' diff --git a/mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_meta.yaml.tmpl b/mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_meta.yaml.tmpl new file mode 100644 index 000000000000..c167160ba2b4 --- /dev/null +++ b/mmv1/third_party/terraform/services/gkehub/resource_gke_hub_feature_membership_meta.yaml.tmpl @@ -0,0 +1,9 @@ +resource: 'google_gke_hub_feature_membership' +generation_type: 'dcl' +api_service_name: 'gkehub.googleapis.com' +{{- if ne $.TargetVersionName "ga" }} +api_version: 'v1beta' +{{- else }} +api_version: 'v1' +{{- end }} +api_resource_type_kind: 'Feature' diff --git a/mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml b/mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml new file mode 100644 index 000000000000..d8540f7b4cc3 --- /dev/null +++ b/mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml @@ -0,0 +1,5 @@ +resource: 'google_recaptcha_enterprise_key' +generation_type: 'dcl' +api_service_name: 'recaptchaenterprise.googleapis.com' +api_version: 'v1' +api_resource_type_kind: 'Key' From 27bc9ea1a807ce259704399ba2287eaa6aa923b6 Mon Sep 17 00:00:00 2001 From: karolgorc Date: Fri, 15 Nov 2024 20:06:21 +0100 Subject: [PATCH 20/44] Support `advanced_machine_features.performance_monitoring_unit` for instance and templates (#12281) --- .../compute/compute_instance_helpers.go.tmpl | 2 + .../compute/resource_compute_instance.go.tmpl | 8 ++ ...resource_compute_instance_template.go.tmpl | 7 ++ ...rce_compute_instance_template_test.go.tmpl | 88 ++++++++++++++++++ .../resource_compute_instance_test.go.tmpl | 83 +++++++++++++++++ ...e_compute_region_instance_template.go.tmpl | 7 ++ ...pute_region_instance_template_test.go.tmpl | 90 +++++++++++++++++++ .../docs/r/compute_instance.html.markdown | 2 + .../r/compute_instance_template.html.markdown | 2 + ...ute_region_instance_template.html.markdown | 2 + 10 files changed, 291 insertions(+) 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 ecb1f5cc3c5f..24ab6bedb307 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 @@ -664,6 +664,7 @@ func expandAdvancedMachineFeatures(d tpgresource.TerraformResourceData) *compute ThreadsPerCore: int64(d.Get(prefix + ".threads_per_core").(int)), TurboMode: d.Get(prefix + ".turbo_mode").(string), VisibleCoreCount: int64(d.Get(prefix + ".visible_core_count").(int)), + PerformanceMonitoringUnit: d.Get(prefix + ".performance_monitoring_unit").(string), } } @@ -676,6 +677,7 @@ func flattenAdvancedMachineFeatures(AdvancedMachineFeatures *compute.AdvancedMac "threads_per_core": AdvancedMachineFeatures.ThreadsPerCore, "turbo_mode": AdvancedMachineFeatures.TurboMode, "visible_core_count": AdvancedMachineFeatures.VisibleCoreCount, + "performance_monitoring_unit": AdvancedMachineFeatures.PerformanceMonitoringUnit, {{"}}"}} } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl index cb91f90c911a..245e3415b963 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl @@ -59,6 +59,7 @@ var ( "advanced_machine_features.0.threads_per_core", "advanced_machine_features.0.turbo_mode", "advanced_machine_features.0.visible_core_count", + "advanced_machine_features.0.performance_monitoring_unit", } bootDiskKeys = []string{ @@ -1125,6 +1126,13 @@ be from 0 to 999,999,999 inclusive.`, AtLeastOneOf: advancedMachineFeaturesKeys, Description: `The number of physical cores to expose to an instance. Multiply by the number of threads per core to compute the total number of virtual CPUs to expose to the instance. If unset, the number of cores is inferred from the instance\'s nominal CPU count and the underlying platform\'s SMT width.`, }, + "performance_monitoring_unit": { + Type: schema.TypeString, + Optional: true, + AtLeastOneOf: advancedMachineFeaturesKeys, + ValidateFunc: validation.StringInSlice([]string{"STANDARD", "ENHANCED", "ARCHITECTURAL"}, false), + Description: `The PMU is a hardware component within the CPU core that monitors how the processor runs code. Valid values for the level of PMU are "STANDARD", "ENHANCED", and "ARCHITECTURAL".`, + }, }, }, }, diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl index 5b2ab8d95d94..ecff319cf83e 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl @@ -981,6 +981,13 @@ be from 0 to 999,999,999 inclusive.`, ForceNew: true, Description: `The number of physical cores to expose to an instance. Multiply by the number of threads per core to compute the total number of virtual CPUs to expose to the instance. If unset, the number of cores is inferred from the instance\'s nominal CPU count and the underlying platform\'s SMT width.`, }, + "performance_monitoring_unit": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"STANDARD", "ENHANCED", "ARCHITECTURAL"}, false), + Description: `The PMU is a hardware component within the CPU core that monitors how the processor runs code. Valid values for the level of PMU are "STANDARD", "ENHANCED", and "ARCHITECTURAL".`, + }, }, }, }, diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl index 9ed49cecd1f0..ab19e4c725b5 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template_test.go.tmpl @@ -901,6 +901,68 @@ func TestAccComputeInstanceTemplate_AdvancedMachineFeatures(t *testing.T) { }) } +func TestAccComputeInstanceTemplate_performanceMonitoringUnit(t *testing.T) { + t.Parallel() + + var instanceTemplate compute.InstanceTemplate + context_1 := map[string]interface{}{ + "instance_name": fmt.Sprintf("tf-test-instance-template-%s", acctest.RandString(t, 10)), + "performance_monitoring_unit": "STANDARD", + } + context_2 := map[string]interface{}{ + "instance_name": context_1["instance_name"].(string), + "performance_monitoring_unit": "ENHANCED", + } + context_3 := map[string]interface{}{ + "instance_name": context_1["instance_name"].(string), + "performance_monitoring_unit": "ARCHITECTURAL", + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccComputeInstanceTemplate_performanceMonitoringUnit(context_1), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), + resource.TestCheckResourceAttr("google_compute_instance_template.foobar", "advanced_machine_features.0.performance_monitoring_unit", "STANDARD"), + ), + }, + { + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccComputeInstanceTemplate_performanceMonitoringUnit(context_2), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), + resource.TestCheckResourceAttr("google_compute_instance_template.foobar", "advanced_machine_features.0.performance_monitoring_unit", "ENHANCED"), + ), + }, + { + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccComputeInstanceTemplate_performanceMonitoringUnit(context_3), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeInstanceTemplateExists(t, "google_compute_instance_template.foobar", &instanceTemplate), + resource.TestCheckResourceAttr("google_compute_instance_template.foobar", "advanced_machine_features.0.performance_monitoring_unit", "ARCHITECTURAL"), + ), + }, + { + ResourceName: "google_compute_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + {{ if ne $.TargetVersionName `ga` -}} func TestAccComputeInstanceTemplate_enableDisplay(t *testing.T) { t.Parallel() @@ -3784,6 +3846,32 @@ resource "google_compute_instance_template" "foobar" { `, suffix) } +func testAccComputeInstanceTemplate_performanceMonitoringUnit(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_compute_image" "my_image" { + family = "ubuntu-2004-lts" + project = "ubuntu-os-cloud" +} + +resource "google_compute_instance_template" "foobar" { + name = "%{instance_name}" + machine_type = "c4-standard-96" + + disk { + source_image = data.google_compute_image.my_image.self_link + } + + network_interface { + network = "default" + } + + advanced_machine_features { + performance_monitoring_unit = "%{performance_monitoring_unit}" + } +} +`, context) +} + {{ if ne $.TargetVersionName `ga` -}} func testAccComputeInstanceTemplate_enableDisplay(suffix string) string { return fmt.Sprintf(` diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl index e9dda4bc81b8..66ff780220b1 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_test.go.tmpl @@ -1468,6 +1468,58 @@ func TestAccComputeInstance_advancedMachineFeatures(t *testing.T) { }) } +func TestAccComputeInstance_performanceMonitoringUnit(t *testing.T) { + t.Parallel() + + var instance compute.Instance + context_1 := map[string]interface{}{ + "instance_name": fmt.Sprintf("tf-test-%s", acctest.RandString(t, 10)), + "performance_monitoring_unit": "STANDARD", + } + context_2 := map[string]interface{}{ + "instance_name": context_1["instance_name"].(string), + "performance_monitoring_unit": "ENHANCED", + } + context_3 := map[string]interface{}{ + "instance_name": context_1["instance_name"].(string), + "performance_monitoring_unit": "ARCHITECTURAL", + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckComputeInstanceDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccComputeInstance_performanceMonitoringUnit(context_1), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeInstanceExists( + t, "google_compute_instance.foobar", &instance), + resource.TestCheckResourceAttr("google_compute_instance.foobar", "advanced_machine_features.0.performance_monitoring_unit", "STANDARD"), + ), + }, + computeInstanceImportStep("us-central1-a", context_1["instance_name"].(string), []string{"allow_stopping_for_update"}), + { + Config: testAccComputeInstance_performanceMonitoringUnit(context_2), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeInstanceExists( + t, "google_compute_instance.foobar", &instance), + resource.TestCheckResourceAttr("google_compute_instance.foobar", "advanced_machine_features.0.performance_monitoring_unit", "ENHANCED"), + ), + }, + computeInstanceImportStep("us-central1-a", context_2["instance_name"].(string), []string{"allow_stopping_for_update"}), + { + Config: testAccComputeInstance_performanceMonitoringUnit(context_3), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeInstanceExists( + t, "google_compute_instance.foobar", &instance), + resource.TestCheckResourceAttr("google_compute_instance.foobar", "advanced_machine_features.0.performance_monitoring_unit", "ARCHITECTURAL"), + ), + }, + }, + }) +} + func TestAccComputeInstance_soleTenantNodeAffinities(t *testing.T) { t.Parallel() @@ -7177,6 +7229,37 @@ resource "google_compute_instance" "foobar" { `, instance) } +func testAccComputeInstance_performanceMonitoringUnit(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_compute_image" "my_image" { + family = "debian-12" + project = "debian-cloud" +} + +resource "google_compute_instance" "foobar" { + name = "%{instance_name}" + machine_type = "c4-standard-96" + zone = "us-central1-a" + + boot_disk { + initialize_params { + image = data.google_compute_image.my_image.self_link + } + } + + network_interface { + network = "default" + } + + advanced_machine_features { + performance_monitoring_unit = "%{performance_monitoring_unit}" + } + + allow_stopping_for_update = true +} +`, context) +} + func testAccComputeInstance_advancedMachineFeaturesUpdated(instance string) string { return fmt.Sprintf(` data "google_compute_image" "my_image" { diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl index b9b46772dd08..992ab0fb7b28 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl @@ -933,6 +933,13 @@ be from 0 to 999,999,999 inclusive.`, ForceNew: true, Description: `The number of physical cores to expose to an instance. Multiply by the number of threads per core to compute the total number of virtual CPUs to expose to the instance. If unset, the number of cores is inferred from the instance\'s nominal CPU count and the underlying platform\'s SMT width.`, }, + "performance_monitoring_unit": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"STANDARD", "ENHANCED", "ARCHITECTURAL"}, false), + Description: `The PMU is a hardware component within the CPU core that monitors how the processor runs code. Valid values for the level of PMU are "STANDARD", "ENHANCED", and "ARCHITECTURAL".`, + }, }, }, }, diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl index 0d6ce93175b3..ff9454170bab 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template_test.go.tmpl @@ -773,6 +773,69 @@ func TestAccComputeRegionInstanceTemplate_AdvancedMachineFeatures(t *testing.T) }) } +func TestAccComputeRegionInstanceTemplate_performanceMonitoringUnit(t *testing.T) { + t.Parallel() + + var instanceTemplate compute.InstanceTemplate + context_1 := map[string]interface{}{ + "instance_name": fmt.Sprintf("tf-test-instance-template-%s", acctest.RandString(t, 10)), + "performance_monitoring_unit": "STANDARD", + } + context_2 := map[string]interface{}{ + "instance_name": context_1["instance_name"].(string), + "performance_monitoring_unit": "ENHANCED", + } + context_3 := map[string]interface{}{ + "instance_name": context_1["instance_name"].(string), + "performance_monitoring_unit": "ARCHITECTURAL", + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckComputeInstanceTemplateDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccComputeRegionInstanceTemplate_performanceMonitoringUnit(context_1), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), + resource.TestCheckResourceAttr("google_compute_region_instance_template.foobar", "advanced_machine_features.0.performance_monitoring_unit", "STANDARD"), + ), + }, + { + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccComputeRegionInstanceTemplate_performanceMonitoringUnit(context_2), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), + resource.TestCheckResourceAttr("google_compute_region_instance_template.foobar", "advanced_machine_features.0.performance_monitoring_unit", "ENHANCED"), + ), + }, + { + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + }, + { + Config: testAccComputeRegionInstanceTemplate_performanceMonitoringUnit(context_3), + Check: resource.ComposeTestCheckFunc( + testAccCheckComputeRegionInstanceTemplateExists(t, "google_compute_region_instance_template.foobar", &instanceTemplate), + resource.TestCheckResourceAttr("google_compute_region_instance_template.foobar", "advanced_machine_features.0.performance_monitoring_unit", "ARCHITECTURAL"), + ), + }, + { + ResourceName: "google_compute_region_instance_template.foobar", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + + {{ if ne $.TargetVersionName `ga` -}} func TestAccComputeRegionInstanceTemplate_enableDisplay(t *testing.T) { t.Parallel() @@ -3170,6 +3233,33 @@ resource "google_compute_region_instance_template" "foobar" { `, suffix) } +func testAccComputeRegionInstanceTemplate_performanceMonitoringUnit(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_compute_image" "my_image" { + family = "ubuntu-2004-lts" + project = "ubuntu-os-cloud" +} + +resource "google_compute_region_instance_template" "foobar" { + name = "%{instance_name}" + region = "us-central1" + machine_type = "c4-standard-96" + + disk { + source_image = data.google_compute_image.my_image.self_link + } + + network_interface { + network = "default" + } + + advanced_machine_features { + performance_monitoring_unit = "%{performance_monitoring_unit}" + } +} +`, context) +} + {{ if ne $.TargetVersionName `ga` -}} func testAccComputeRegionInstanceTemplate_enableDisplay(suffix string) string { return fmt.Sprintf(` diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown index ed5f5e4a3f60..3c7fdb118027 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown @@ -573,6 +573,8 @@ specified, then this instance will have no external IPv6 Internet access. Struct * `visible_core_count` - (Optional) The number of physical cores to expose to an instance. [visible cores info (VC)](https://cloud.google.com/compute/docs/instances/customize-visible-cores). +* `performance_monitoring_unit` - (Optional) [The PMU](https://cloud.google.com/compute/docs/pmu-overview) is a hardware component within the CPU core that monitors how the processor runs code. Valid values for the level of PMU are `STANDARD`, `ENHANCED`, and `ARCHITECTURAL`. + The `reservation_affinity` block supports: * `type` - (Required) The type of reservation from which this instance can consume resources. diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown index 4e28fc3d1be5..3b009c3e0db0 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown @@ -730,6 +730,8 @@ The `specific_reservation` block supports: * `visible_core_count` - (Optional) The number of physical cores to expose to an instance. [visible cores info (VC)](https://cloud.google.com/compute/docs/instances/customize-visible-cores). +* `performance_monitoring_unit` - (Optional) [The PMU](https://cloud.google.com/compute/docs/pmu-overview) is a hardware component within the CPU core that monitors how the processor runs code. Valid values for the level of PMU are `STANDARD`, `ENHANCED`, and `ARCHITECTURAL`. + ## Attributes Reference In addition to the arguments listed above, the following computed attributes are diff --git a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown index 27bacc5e4bbb..83b6a421bb07 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown @@ -690,6 +690,8 @@ The `specific_reservation` block supports: * `visible_core_count` - (Optional) The number of physical cores to expose to an instance. [visible cores info (VC)](https://cloud.google.com/compute/docs/instances/customize-visible-cores). +* `performance_monitoring_unit` - (Optional) [The PMU](https://cloud.google.com/compute/docs/pmu-overview) is a hardware component within the CPU core that monitors how the processor runs code. Valid values for the level of PMU are `STANDARD`, `ENHANCED`, and `ARCHITECTURAL`. + ## Attributes Reference In addition to the arguments listed above, the following computed attributes are From e2d14e34fb3b7c98efadf7b2925eb2ac2218fe73 Mon Sep 17 00:00:00 2001 From: shaikatzz <139782053+shaikatzz@users.noreply.github.com> Date: Fri, 15 Nov 2024 23:39:41 +0200 Subject: [PATCH 21/44] Add creationTime to cloud identity group membership datasource (#12199) Co-authored-by: Chris Hawk --- .../data_source_cloud_identity_group_memberships.go.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_group_memberships.go.tmpl b/mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_group_memberships.go.tmpl index 39dd1fcf61b0..cf6f19d75819 100644 --- a/mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_group_memberships.go.tmpl +++ b/mmv1/third_party/terraform/services/cloudidentity/data_source_cloud_identity_group_memberships.go.tmpl @@ -78,6 +78,7 @@ func dataSourceGoogleCloudIdentityGroupMembershipsRead(d *schema.ResourceData, m "member_key": flattenCloudIdentityGroupsEntityKey(member.MemberKey), {{- end }} "preferred_member_key": flattenCloudIdentityGroupsEntityKey(member.PreferredMemberKey), + "create_time": member.CreateTime, }) } From ca99fc31c71400d6dd719e2212a8fc769952de8a Mon Sep 17 00:00:00 2001 From: Ryan Oaks Date: Fri, 15 Nov 2024 16:55:43 -0500 Subject: [PATCH 22/44] Modify recaptcha metadata to be beta-only (#12342) --- ...ta.yaml => resource_recaptcha_enterprise_key_meta.yaml.tmpl} | 2 ++ 1 file changed, 2 insertions(+) rename mmv1/third_party/terraform/services/recaptcha/{resource_recaptcha_enterprise_key_meta.yaml => resource_recaptcha_enterprise_key_meta.yaml.tmpl} (78%) diff --git a/mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml b/mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml.tmpl similarity index 78% rename from mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml rename to mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml.tmpl index d8540f7b4cc3..22f7e5e37b1a 100644 --- a/mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml +++ b/mmv1/third_party/terraform/services/recaptcha/resource_recaptcha_enterprise_key_meta.yaml.tmpl @@ -1,5 +1,7 @@ +{{ if ne $.TargetVersionName "ga" -}} resource: 'google_recaptcha_enterprise_key' generation_type: 'dcl' api_service_name: 'recaptchaenterprise.googleapis.com' api_version: 'v1' api_resource_type_kind: 'Key' +{{ end }} \ No newline at end of file From e7cf93b18ad0eca820b889cd4dae4b88cb5a9ddc Mon Sep 17 00:00:00 2001 From: Yuriy Gridasov Date: Fri, 15 Nov 2024 15:02:52 -0800 Subject: [PATCH 23/44] artifactregistry: fix comments, more examples for common remote repositories (#12312) Co-authored-by: Yury Gridasov Co-authored-by: Will Yardley Co-authored-by: Ian Milligan Co-authored-by: Stephen Lewis (Burrows) --- .../products/artifactregistry/Repository.yaml | 37 ++++++++++++++--- ...ository_with_artifact_registry_uri.tf.tmpl | 22 ++++++++++ ...on_repository_with_custom_upstream.tf.tmpl | 40 +++++++++++++++++++ 3 files changed, 94 insertions(+), 5 deletions(-) create mode 100644 mmv1/templates/terraform/examples/artifact_registry_repository_remote_common_repository_with_artifact_registry_uri.tf.tmpl create mode 100644 mmv1/templates/terraform/examples/artifact_registry_repository_remote_common_repository_with_custom_upstream.tf.tmpl diff --git a/mmv1/products/artifactregistry/Repository.yaml b/mmv1/products/artifactregistry/Repository.yaml index 747d4c8f78bc..9c1b513f0892 100644 --- a/mmv1/products/artifactregistry/Repository.yaml +++ b/mmv1/products/artifactregistry/Repository.yaml @@ -184,6 +184,30 @@ examples: # Ignore this field as it is INPUT_ONLY. AR will not return this in the # response. - 'remote_repository_config.0.disable_upstream_validation' + - name: 'artifact_registry_repository_remote_common_repository_with_artifact_registry_uri' + primary_resource_id: 'my-repo' + vars: + repository_id: 'example-common-remote' + desc: 'example remote common repository with docker upstream' + upstream_repository_id: 'example-upstream-repo' + upstream_repository_desc: 'example upstream repository' + ignore_read_extra: + # Ignore this field as it is INPUT_ONLY. AR will not return this in the + # response. + - 'remote_repository_config.0.disable_upstream_validation' + - name: 'artifact_registry_repository_remote_common_repository_with_custom_upstream' + primary_resource_id: 'my-repo' + vars: + repository_id: 'example-docker-custom-remote' + desc: 'example remote custom docker repository with credentials' + secret_id: 'example-secret' + secret_resource_id: 'example-remote-secret' + username: 'remote-username' + secret_data: 'remote-password' + ignore_read_extra: + # Ignore this field as it is INPUT_ONLY. AR will not return this in the + # response. + - 'remote_repository_config.0.disable_upstream_validation' parameters: properties: - name: 'name' @@ -482,7 +506,7 @@ properties: - name: 'customRepository' type: NestedObject description: |- - Settings for a remote repository with a custom uri. + [Deprecated, please use commonRepository instead] Settings for a remote repository with a custom uri. immutable: true conflicts: - remoteRepositoryConfig.0.docker_repository.0.public_repository @@ -521,7 +545,7 @@ properties: - name: 'customRepository' type: NestedObject description: |- - Settings for a remote repository with a custom uri. + [Deprecated, please use commonRepository instead] Settings for a remote repository with a custom uri. immutable: true conflicts: - remoteRepositoryConfig.0.maven_repository.0.public_repository @@ -560,7 +584,7 @@ properties: - name: 'customRepository' type: NestedObject description: |- - Settings for a remote repository with a custom uri. + [Deprecated, please use commonRepository instead] Settings for a remote repository with a custom uri. immutable: true conflicts: - remoteRepositoryConfig.0.npm_repository.0.public_repository @@ -599,7 +623,7 @@ properties: - name: 'customRepository' type: NestedObject description: |- - Settings for a remote repository with a custom uri. + [Deprecated, please use commonRepository instead] Settings for a remote repository with a custom uri. immutable: true conflicts: - remoteRepositoryConfig.0.python_repository.0.public_repository @@ -665,7 +689,10 @@ properties: - name: 'uri' type: String description: |- - Specific uri to the Artifact Registory repository, e.g. `projects/UPSTREAM_PROJECT_ID/locations/REGION/repositories/UPSTREAM_REPOSITORY` + One of: + a. Artifact Registry Repository resource, e.g. `projects/UPSTREAM_PROJECT_ID/locations/REGION/repositories/UPSTREAM_REPOSITORY` + b. URI to the registry, e.g. `"https://registry-1.docker.io"` + c. URI to Artifact Registry Repository, e.g. `"https://REGION-docker.pkg.dev/UPSTREAM_PROJECT_ID/UPSTREAM_REPOSITORY"` immutable: true required: true - name: 'upstreamCredentials' diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_common_repository_with_artifact_registry_uri.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_common_repository_with_artifact_registry_uri.tf.tmpl new file mode 100644 index 000000000000..25b574437859 --- /dev/null +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_common_repository_with_artifact_registry_uri.tf.tmpl @@ -0,0 +1,22 @@ +data "google_project" "project" {} + +resource "google_artifact_registry_repository" "upstream_repo" { + location = "us-central1" + repository_id = "{{index $.Vars "upstream_repository_id"}}" + description = "{{index $.Vars "upstream_repository_desc"}}" + format = "DOCKER" +} + +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { + location = "us-central1" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" + format = "DOCKER" + mode = "REMOTE_REPOSITORY" + remote_repository_config { + description = "pull-through cache of another Artifact Registry repository by URL" + common_repository { + uri = "https://us-central1-docker.pkg.dev/{{index $.TestEnvVars "project_id"}}/{{index $.Vars "upstream_repository_id"}}" + } + } +} diff --git a/mmv1/templates/terraform/examples/artifact_registry_repository_remote_common_repository_with_custom_upstream.tf.tmpl b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_common_repository_with_custom_upstream.tf.tmpl new file mode 100644 index 000000000000..577160e80128 --- /dev/null +++ b/mmv1/templates/terraform/examples/artifact_registry_repository_remote_common_repository_with_custom_upstream.tf.tmpl @@ -0,0 +1,40 @@ +data "google_project" "project" {} + +resource "google_secret_manager_secret" "{{index $.Vars "secret_resource_id"}}" { + secret_id = "{{index $.Vars "secret_id"}}" + replication { + auto {} + } +} + +resource "google_secret_manager_secret_version" "{{index $.Vars "secret_resource_id"}}_version" { + secret = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id + secret_data = "{{index $.Vars "secret_data"}}" +} + +resource "google_secret_manager_secret_iam_member" "secret-access" { + secret_id = google_secret_manager_secret.{{index $.Vars "secret_resource_id"}}.id + role = "roles/secretmanager.secretAccessor" + member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-artifactregistry.iam.gserviceaccount.com" +} + +resource "google_artifact_registry_repository" "{{$.PrimaryResourceId}}" { + location = "us-central1" + repository_id = "{{index $.Vars "repository_id"}}" + description = "{{index $.Vars "desc"}}" + format = "DOCKER" + mode = "REMOTE_REPOSITORY" + remote_repository_config { + description = "custom common docker remote with credentials" + disable_upstream_validation = true + common_repository { + uri = "https://registry-1.docker.io" + } + upstream_credentials { + username_password_credentials { + username = "{{index $.Vars "username"}}" + password_secret_version = google_secret_manager_secret_version.{{index $.Vars "secret_resource_id"}}_version.name + } + } + } +} From c09b3029dfcb6b8233e39ec11177a37801e45424 Mon Sep 17 00:00:00 2001 From: gurusai-voleti Date: Fri, 15 Nov 2024 23:37:29 +0000 Subject: [PATCH 24/44] fix: derive the project attribute from resource or compute api or fallback to provider (#12305) Co-authored-by: Chris Hawk --- .../storage/resource_storage_bucket.go.tmpl | 16 +++++++--------- .../website/docs/d/storage_bucket.html.markdown | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_bucket.go.tmpl b/mmv1/third_party/terraform/services/storage/resource_storage_bucket.go.tmpl index b01e9c162bba..a79d34fe790a 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_bucket.go.tmpl +++ b/mmv1/third_party/terraform/services/storage/resource_storage_bucket.go.tmpl @@ -1845,18 +1845,16 @@ func setStorageBucket(d *schema.ResourceData, config *transport_tpg.Config, res // block, or the resource or an environment variable, we use the compute API to lookup the projectID // from the projectNumber which is included in the bucket API response if d.Get("project") == "" { - project, _ := tpgresource.GetProject(d, config) - if err := d.Set("project", project); err != nil { - return fmt.Errorf("Error setting project: %s", err) - } - } - if d.Get("project") == "" { + projectName, _ := tpgresource.GetProject(d, config) proj, err := config.NewComputeClient(userAgent).Projects.Get(strconv.FormatUint(res.ProjectNumber, 10)).Do() if err != nil { - return err + log.Printf("[ERROR] Missing Compute API permissions, fallback to provider/resource default") + } + + if proj != nil && projectName != "" && projectName != proj.Name { + projectName = proj.Name } - log.Printf("[DEBUG] Bucket %v is in project number %v, which is project ID %s.\n", res.Name, res.ProjectNumber, proj.Name) - if err := d.Set("project", proj.Name); err != nil { + if err := d.Set("project", projectName); err != nil { return fmt.Errorf("Error setting project: %s", err) } } diff --git a/mmv1/third_party/terraform/website/docs/d/storage_bucket.html.markdown b/mmv1/third_party/terraform/website/docs/d/storage_bucket.html.markdown index 0745d8c02b3d..e32ff99cb750 100644 --- a/mmv1/third_party/terraform/website/docs/d/storage_bucket.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/storage_bucket.html.markdown @@ -26,7 +26,7 @@ The following arguments are supported: * `name` - (Required) The name of the bucket. -* `project` - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used. If no value is supplied in the configuration or through provider defaults then the data source will use the Compute API to find the project id that corresponds to the project number returned from the Storage API. Supplying a value for `project` doesn't influence retrieving data about the bucket but it can be used to prevent use of the Compute API. If you do provide a `project` value ensure that it is the correct value for that bucket; the data source will not check that the project id and project number match. +* `project` - (Optional) The ID of the project in which the resource belongs. If it is not provided then the data source will use the Compute API to find the project id that corresponds to the project number returned from the Storage API, and if no Compute API permissions are available or if the Compute API is disabled it defaults to the provider value. Supplying a value for `project` doesn't influence retrieving data about the bucket but it can be used to prevent use of the Compute API. If you do provide a `project` value ensure that it is the correct value for that bucket; the data source will not check that the project id and project number match. ## Attributes Reference From 256cde2a74c8f3d2ae4ff2406e282e08ab3e887f Mon Sep 17 00:00:00 2001 From: halimsam Date: Fri, 15 Nov 2024 16:26:06 -0800 Subject: [PATCH 25/44] Update google.golang.org/api to v0.206.0 (#12343) --- mmv1/third_party/terraform/go.mod | 34 +++++++------- mmv1/third_party/terraform/go.sum | 74 +++++++++++++++---------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/mmv1/third_party/terraform/go.mod b/mmv1/third_party/terraform/go.mod index adb1cfa63246..22a553717d8b 100644 --- a/mmv1/third_party/terraform/go.mod +++ b/mmv1/third_party/terraform/go.mod @@ -30,10 +30,10 @@ require ( github.com/stretchr/testify v1.9.0 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 - golang.org/x/net v0.30.0 - golang.org/x/oauth2 v0.23.0 - google.golang.org/api v0.203.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 + golang.org/x/net v0.31.0 + golang.org/x/oauth2 v0.24.0 + google.golang.org/api v0.206.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 google.golang.org/grpc v1.67.1 google.golang.org/protobuf v1.35.1 ) @@ -42,12 +42,12 @@ require ( bitbucket.org/creachadair/stringset v0.0.8 // indirect cel.dev/expr v0.16.0 // indirect cloud.google.com/go v0.116.0 // indirect - cloud.google.com/go/auth v0.9.9 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect + cloud.google.com/go/auth v0.10.2 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.5 // indirect cloud.google.com/go/compute/metadata v0.5.2 // indirect - cloud.google.com/go/iam v1.2.1 // indirect - cloud.google.com/go/longrunning v0.6.1 // indirect - cloud.google.com/go/monitoring v1.21.1 // indirect + cloud.google.com/go/iam v1.2.2 // indirect + cloud.google.com/go/longrunning v0.6.2 // indirect + cloud.google.com/go/monitoring v1.21.2 // indirect github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect github.com/agext/levenshtein v1.2.2 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect @@ -70,7 +70,7 @@ require ( github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect - github.com/googleapis/gax-go/v2 v2.13.0 // indirect + github.com/googleapis/gax-go/v2 v2.14.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-plugin v1.6.0 // indirect @@ -106,16 +106,16 @@ require ( go.opentelemetry.io/otel/sdk v1.29.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.29.0 // indirect go.opentelemetry.io/otel/trace v1.29.0 // indirect - golang.org/x/crypto v0.28.0 // indirect + golang.org/x/crypto v0.29.0 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect - golang.org/x/time v0.7.0 // indirect + golang.org/x/sync v0.9.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/text v0.20.0 // indirect + golang.org/x/time v0.8.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20241015192408-796eee8c2d53 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect + google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/mmv1/third_party/terraform/go.sum b/mmv1/third_party/terraform/go.sum index 867ac9da20e4..fcc915d85ff6 100644 --- a/mmv1/third_party/terraform/go.sum +++ b/mmv1/third_party/terraform/go.sum @@ -5,20 +5,20 @@ cel.dev/expr v0.16.0/go.mod h1:TRSuuV7DlVCE/uwv5QbAiW/v8l5O8C4eEPHeu7gf7Sg= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE= cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U= -cloud.google.com/go/auth v0.9.9 h1:BmtbpNQozo8ZwW2t7QJjnrQtdganSdmqeIBxHxNkEZQ= -cloud.google.com/go/auth v0.9.9/go.mod h1:xxA5AqpDrvS+Gkmo9RqrGGRh6WSNKKOXhY3zNOr38tI= -cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= -cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= +cloud.google.com/go/auth v0.10.2 h1:oKF7rgBfSHdp/kuhXtqU/tNDr0mZqhYbEh+6SiqzkKo= +cloud.google.com/go/auth v0.10.2/go.mod h1:xxA5AqpDrvS+Gkmo9RqrGGRh6WSNKKOXhY3zNOr38tI= +cloud.google.com/go/auth/oauth2adapt v0.2.5 h1:2p29+dePqsCHPP1bqDJcKj4qxRyYCcbzKpFyKGt3MTk= +cloud.google.com/go/auth/oauth2adapt v0.2.5/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= cloud.google.com/go/bigtable v1.33.0 h1:2BDaWLRAwXO14DJL/u8crbV2oUbMZkIa2eGq8Yao1bk= cloud.google.com/go/bigtable v1.33.0/go.mod h1:HtpnH4g25VT1pejHRtInlFPnN5sjTxbQlsYBjh9t5l0= cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo= cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= -cloud.google.com/go/iam v1.2.1 h1:QFct02HRb7H12J/3utj0qf5tobFh9V4vR6h9eX5EBRU= -cloud.google.com/go/iam v1.2.1/go.mod h1:3VUIJDPpwT6p/amXRC5GY8fCCh70lxPygguVtI0Z4/g= -cloud.google.com/go/longrunning v0.6.1 h1:lOLTFxYpr8hcRtcwWir5ITh1PAKUD/sG2lKrTSYjyMc= -cloud.google.com/go/longrunning v0.6.1/go.mod h1:nHISoOZpBcmlwbJmiVk5oDRz0qG/ZxPynEGs1iZ79s0= -cloud.google.com/go/monitoring v1.21.1 h1:zWtbIoBMnU5LP9A/fz8LmWMGHpk4skdfeiaa66QdFGc= -cloud.google.com/go/monitoring v1.21.1/go.mod h1:Rj++LKrlht9uBi8+Eb530dIrzG/cU/lB8mt+lbeFK1c= +cloud.google.com/go/iam v1.2.2 h1:ozUSofHUGf/F4tCNy/mu9tHLTaxZFLOUiKzjcgWHGIA= +cloud.google.com/go/iam v1.2.2/go.mod h1:0Ys8ccaZHdI1dEUilwzqng/6ps2YB6vRsjIe00/+6JY= +cloud.google.com/go/longrunning v0.6.2 h1:xjDfh1pQcWPEvnfjZmwjKQEcHnpz6lHjfy7Fo0MK+hc= +cloud.google.com/go/longrunning v0.6.2/go.mod h1:k/vIs83RN4bE3YCswdXC5PFfWVILjm3hpEUlSko4PiI= +cloud.google.com/go/monitoring v1.21.2 h1:FChwVtClH19E7pJ+e0xUhJPGksctZNVOk2UhMmblmdU= +cloud.google.com/go/monitoring v1.21.2/go.mod h1:hS3pXvaG8KgWTSz+dAdyzPrGUYmi2Q+WFX8g2hqVEZU= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -137,8 +137,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= -github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDPT0hH1s= -github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= +github.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o= +github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= @@ -305,8 +305,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= +golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= +golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc= golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= @@ -329,19 +329,19 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= -golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -359,21 +359,21 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= -golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= +golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= -golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -389,8 +389,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.203.0 h1:SrEeuwU3S11Wlscsn+LA1kb/Y5xT8uggJSkIhD08NAU= -google.golang.org/api v0.203.0/go.mod h1:BuOVyCSYEPwJb3npWvDnNmFI92f3GeRnHNkETneT3SI= +google.golang.org/api v0.206.0 h1:A27GClesCSheW5P2BymVHjpEeQ2XHH8DI8Srs2HI2L8= +google.golang.org/api v0.206.0/go.mod h1:BtB8bfjTYIrai3d8UyvPmV9REGgox7coh+ZRwm0b+W8= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= @@ -399,12 +399,12 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20241015192408-796eee8c2d53 h1:Df6WuGvthPzc+JiQ/G+m+sNX24kc0aTBqoDN/0yyykE= -google.golang.org/genproto v0.0.0-20241015192408-796eee8c2d53/go.mod h1:fheguH3Am2dGp1LfXkrvwqC/KlFq8F0nLq3LryOMrrE= -google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 h1:T6rh4haD3GVYsgEfWExoCZA2o2FmbNyKpTuAxbEFPTg= -google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:wp2WsuBYj6j8wUdo3ToZsdxxixbvQNAHqVJrTgi5E5M= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28 h1:KJjNNclfpIkVqrZlTWcgOOaVQ00LdBnoEaRfkUx760s= +google.golang.org/genproto v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:mt9/MofW7AWQ+Gy179ChOnvmJatV8YHUmrcedo9CIFI= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 h1:M0KvPgPmDZHPlbRbaNU1APr28TvwvvdUPlSv7PUvy8g= +google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:dguCy7UOdZhTvLzDyt15+rOrawrpM4q7DD9dQ1P11P4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -441,4 +441,4 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= \ No newline at end of file From 1f0d1a4a0e48ce20347c80dc35a954611280ec0a Mon Sep 17 00:00:00 2001 From: Mehul3217 <44620455+Mehul3217@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:08:08 +0530 Subject: [PATCH 26/44] increase google cloud netapp create storagePool timeout to 45 mins (#12313) --- mmv1/products/netapp/StoragePool.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/netapp/StoragePool.yaml b/mmv1/products/netapp/StoragePool.yaml index 7e6061babea7..bf288ef502d8 100644 --- a/mmv1/products/netapp/StoragePool.yaml +++ b/mmv1/products/netapp/StoragePool.yaml @@ -53,7 +53,7 @@ delete_url: 'projects/{{project}}/locations/{{location}}/storagePools/{{name}}' import_format: - 'projects/{{project}}/locations/{{location}}/storagePools/{{name}}' timeouts: - insert_minutes: 20 + insert_minutes: 45 update_minutes: 20 delete_minutes: 20 autogen_async: true From e5c4adb8ea7a58fcdb6a61b800c0e07b022934fa Mon Sep 17 00:00:00 2001 From: Mishri Daga Date: Mon, 18 Nov 2024 03:25:40 -0500 Subject: [PATCH 27/44] Fix bug in Pub/Sub Subscription avroConfig which was not sending empty configurations. (#12108) --- mmv1/products/pubsub/Subscription.yaml | 4 +++ .../resource_pubsub_subscription_test.go | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/mmv1/products/pubsub/Subscription.yaml b/mmv1/products/pubsub/Subscription.yaml index 8fdec6c05331..10abe7e0220e 100644 --- a/mmv1/products/pubsub/Subscription.yaml +++ b/mmv1/products/pubsub/Subscription.yaml @@ -235,15 +235,19 @@ properties: - 'NOT_FOUND' - name: 'avroConfig' type: NestedObject + send_empty_value: true + allow_empty_object: true description: | If set, message data will be written to Cloud Storage in Avro format. properties: - name: 'writeMetadata' type: Boolean + send_empty_value: true description: | When true, write the subscription name, messageId, publishTime, attributes, and orderingKey as additional fields in the output. - name: 'useTopicSchema' type: Boolean + send_empty_value: true description: | When true, the output Cloud Storage file will be serialized using the topic schema, if it exists. - name: 'serviceAccountEmail' diff --git a/mmv1/third_party/terraform/services/pubsub/resource_pubsub_subscription_test.go b/mmv1/third_party/terraform/services/pubsub/resource_pubsub_subscription_test.go index 3c03898bbcb0..d8ad8234b133 100644 --- a/mmv1/third_party/terraform/services/pubsub/resource_pubsub_subscription_test.go +++ b/mmv1/third_party/terraform/services/pubsub/resource_pubsub_subscription_test.go @@ -352,6 +352,31 @@ func TestAccPubsubSubscriptionCloudStorage_updateAvro(t *testing.T) { }) } +func TestAccPubsubSubscriptionCloudStorage_emptyAvroConfig(t *testing.T) { + t.Parallel() + + bucket := fmt.Sprintf("tf-test-bucket-%s", acctest.RandString(t, 10)) + topic := fmt.Sprintf("tf-test-topic-%s", acctest.RandString(t, 10)) + subscriptionShort := fmt.Sprintf("tf-test-sub-%s", acctest.RandString(t, 10)) + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckPubsubSubscriptionDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccPubsubSubscriptionCloudStorage_basic(bucket, topic, subscriptionShort, "pre-", "-suffix", "YYYY-MM-DD/hh_mm_ssZ", 1000, "300s", 1000, "", "empty-avro"), + }, + { + ResourceName: "google_pubsub_subscription.foo", + ImportStateId: subscriptionShort, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccPubsubSubscriptionCloudStorage_serviceAccount(t *testing.T) { t.Parallel() @@ -823,6 +848,8 @@ resource "google_storage_bucket_iam_member" "admin" { use_topic_schema = true } ` + } else if outputFormat == "empty-avro" { + outputFormatString = `avro_config {}` } return fmt.Sprintf(` data "google_project" "project" { } From aa87d479eb87bd885cf00688b2787a9cdc0a9a7b Mon Sep 17 00:00:00 2001 From: karolgorc Date: Mon, 18 Nov 2024 18:25:07 +0100 Subject: [PATCH 28/44] Support `IPV6_ONLY` configurations for compute API (#12283) --- mmv1/products/compute/Subnetwork.yaml | 1 + .../services/compute/resource_compute_instance.go.tmpl | 5 +++-- .../compute/resource_compute_instance_template.go.tmpl | 3 ++- .../resource_compute_region_instance_template.go.tmpl | 3 ++- .../terraform/website/docs/r/compute_instance.html.markdown | 2 +- .../website/docs/r/compute_instance_template.html.markdown | 2 +- .../docs/r/compute_region_instance_template.html.markdown | 2 +- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mmv1/products/compute/Subnetwork.yaml b/mmv1/products/compute/Subnetwork.yaml index 42b2f4262f78..0ddddb1e9c02 100644 --- a/mmv1/products/compute/Subnetwork.yaml +++ b/mmv1/products/compute/Subnetwork.yaml @@ -404,6 +404,7 @@ properties: enum_values: - 'IPV4_ONLY' - 'IPV4_IPV6' + - 'IPV6_ONLY' - name: 'ipv6AccessType' type: Enum description: | diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl index 245e3415b963..8e6b5383123e 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl @@ -535,7 +535,7 @@ func ResourceComputeInstance() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - ValidateFunc: validation.StringInSlice([]string{"IPV4_ONLY", "IPV4_IPV6", ""}, false), + ValidateFunc: validation.StringInSlice([]string{"IPV4_ONLY", "IPV4_IPV6", "IPV6_ONLY", ""}, false), Description: `The stack type for this network interface to identify whether the IPv6 feature is enabled or not. If not specified, IPV4_ONLY will be used.`, }, @@ -547,7 +547,8 @@ func ResourceComputeInstance() *schema.Resource { "ipv6_access_config": { Type: schema.TypeList, - Optional: true, + Optional: true, + Computed: true, Description: `An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config, DIRECT_IPV6, is supported. If there is no ipv6AccessConfig specified, then this instance will have no external IPv6 Internet access.`, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl index ecff319cf83e..0417877868e4 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl @@ -555,7 +555,7 @@ Google Cloud KMS.`, Optional: true, Computed: true, ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{"IPV4_ONLY", "IPV4_IPV6", ""}, false), + ValidateFunc: validation.StringInSlice([]string{"IPV4_ONLY", "IPV4_IPV6", "IPV6_ONLY", ""}, false), Description: `The stack type for this network interface to identify whether the IPv6 feature is enabled or not. If not specified, IPV4_ONLY will be used.`, }, @@ -569,6 +569,7 @@ Google Cloud KMS.`, "ipv6_access_config": { Type: schema.TypeList, Optional: true, + Computed: true, ForceNew: true, Description: `An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config, DIRECT_IPV6, is supported. If there is no ipv6AccessConfig specified, then this instance will have no external IPv6 Internet access.`, Elem: &schema.Resource{ diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl index 992ab0fb7b28..273708aafe84 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl @@ -524,7 +524,7 @@ Google Cloud KMS.`, Optional: true, Computed: true, ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{"IPV4_ONLY", "IPV4_IPV6", ""}, false), + ValidateFunc: validation.StringInSlice([]string{"IPV4_ONLY", "IPV4_IPV6","IPV6_ONLY", ""}, false), Description: `The stack type for this network interface to identify whether the IPv6 feature is enabled or not. If not specified, IPV4_ONLY will be used.`, }, @@ -538,6 +538,7 @@ Google Cloud KMS.`, "ipv6_access_config": { Type: schema.TypeList, Optional: true, + Computed: true, ForceNew: true, Description: `An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config, DIRECT_IPV6, is supported. If there is no ipv6AccessConfig specified, then this instance will have no external IPv6 Internet access.`, Elem: &schema.Resource{ diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown index 3c7fdb118027..83ea8d38944b 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown @@ -399,7 +399,7 @@ is desired, you will need to modify your state file manually using * `network_attachment` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) The URL of the network attachment that this interface should connect to in the following format: `projects/{projectNumber}/regions/{region_name}/networkAttachments/{network_attachment_name}`. -* `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6 or IPV4_ONLY. If not specified, IPV4_ONLY will be used. +* `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6, IPV6_ONLY or IPV4_ONLY. If not specified, IPV4_ONLY will be used. * `ipv6_access_config` - (Optional) An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config, DIRECT_IPV6, is supported. If there is no ipv6AccessConfig diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown index 3b009c3e0db0..ef900aff1539 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown @@ -563,7 +563,7 @@ The following arguments are supported: * `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. In the beta provider the additional values of MRDMA and IRDMA are supported. -* `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6 or IPV4_ONLY. If not specified, IPV4_ONLY will be used. +* `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6, IPV6_ONLY or IPV4_ONLY. If not specified, IPV4_ONLY will be used. * `ipv6_access_config` - (Optional) An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config, DIRECT_IPV6, is supported. If there is no ipv6AccessConfig diff --git a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown index 83b6a421bb07..12ba8874792c 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown @@ -529,7 +529,7 @@ The following arguments are supported: * `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. In the beta provider the additional values of MRDMA and IRDMA are supported. -* `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6 or IPV4_ONLY. If not specified, IPV4_ONLY will be used. +* `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6, IPV6_ONLY or IPV4_ONLY. If not specified, IPV4_ONLY will be used. * `ipv6_access_config` - (Optional) An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config, DIRECT_IPV6, is supported. If there is no ipv6AccessConfig From c91b09c2f3edc111f113f275c93e02c4300fdc42 Mon Sep 17 00:00:00 2001 From: Manjunath Ganga <54118884+manjunathganga@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:57:03 -0800 Subject: [PATCH 29/44] Redis Cluster Cross Cluster Replication addition (#12300) Co-authored-by: Nick Elliot --- mmv1/products/redis/Cluster.yaml | 190 +++++++++++++++ .../examples/redis_cluster_secondary.tf.tmpl | 151 ++++++++++++ .../redis/resource_redis_cluster_test.go.tmpl | 228 +++++++++++++----- 3 files changed, 509 insertions(+), 60 deletions(-) create mode 100644 mmv1/templates/terraform/examples/redis_cluster_secondary.tf.tmpl diff --git a/mmv1/products/redis/Cluster.yaml b/mmv1/products/redis/Cluster.yaml index c068ab9f1346..6888932eca07 100644 --- a/mmv1/products/redis/Cluster.yaml +++ b/mmv1/products/redis/Cluster.yaml @@ -20,6 +20,80 @@ references: 'Official Documentation': 'https://cloud.google.com/memorystore/docs/cluster/' api: 'https://cloud.google.com/memorystore/docs/cluster/reference/rest/v1/projects.locations.clusters' docs: + note: | + For [Cross Region Replication](https://cloud.google.com/memorystore/docs/cluster/about-cross-region-replication), please follow the instructions below for performing certain update and failover (switchover and detach) operations + + **Cross Region Replication** + + **Settings updated on primary and propagated to secondaries** + + The settings listed [here](https://cloud.google.com/memorystore/docs/cluster/about-cross-region-replication#set_on_primary) + are only allowed to be updated on the primary cluster and the changes are automatically propagated to the secondary clusters. + To keep the Terraform configuration and state in sync for such settings, please follow the below steps to update them: + 1. Update the setting on the primary cluster: + * Update the setting to its new desired value in the Terraform configuration file. + * Execute `terraform apply` to apply the change and wait for it to complete. + 1. Detect configuration drift on the secondary cluster(s): + * Execute `terraform plan`. This should reveal a diff for the modified setting. The proposed value in the Terraform plan should align with the updated value applied to the primary cluster in the preceding step. + 1. Reconcile secondary cluster(s) configuration: + * Manually edit the Terraform configuration file(s) for the secondary cluster(s) to update the setting with the latest value from the state. + * Execute `terraform plan` once again. This should not generate any diff, confirming the configuration is in sync with the infrastructure. + + + **Switchover** + + To perform a [switchover](https://cloud.google.com/memorystore/docs/cluster/working-with-cross-region-replication#perform_a_switchover), please follow the below steps: + 1. Ensure that the Terraform configuration file for the secondary cluster that needs to become the new primary has the `cross_cluster_replication_config` field. If it is not present: + * Add the `cross_cluster_replication_config` field to the configuration file to match the latest value in the state. + * Execute `terraform plan`. This should not generate any diff, confirming the configuration is in sync with the infrastructure. + 1. Update the `cross_cluster_replication_config` field of the secondary that needs to become the new primary: + * Change `cross_cluster_replication_config.cluster_role` from `SECONDARY` to `PRIMARY`. + * Remove `cross_cluster_replication_config.primary_cluster` field. + * Set `cross_cluster_replication_config.secondary_clusters` list with the new secondaries. The new secondaries are the current primary and other secondary clusters(if any). + + -> You can refer to the current value of `cross_cluster_replication_config.membership` field to lookup the current primary and secondary clusters. + 1. Execute switchover: + * Execute`terraform apply` to apply the change and wait for it to complete. + 1. Fix any configuration drifts on the previous primary and other secondary clusters: + * Execute `terraform plan`. If any diffs are reported for `cross_cluster_replication_config` field: + * Manually update `cross_cluster_replication_config` field in the configuration file(s) for those clusters with the latest value from the state. + * Execute `terraform plan` once again. This should not generate any diff, confirming the configuration is in sync with the infrastructure. + + **Detach a secondary cluster** + + To [detach](https://cloud.google.com/memorystore/docs/cluster/working-with-cross-region-replication#detach_secondary_clusters_option_1) a secondary cluster, please follow the below steps: + 1. Ensure that the Terraform configuration file for the secondary cluster that needs to be detached has the `cross_cluster_replication_config` field. If it is not present: + * Add the `cross_cluster_replication_config` field to the configuration file to match the latest value in the state. + * Execute `terraform plan`. This should not generate any diff, confirming the configuration is in sync with the infrastructure. + 1. Update the `cross_cluster_replication_config` field of the secondary that needs to be detached: + * Change `cross_cluster_replication_config.cluster_role` from `SECONDARY` to `NONE`. + * Remove `cross_cluster_replication_config.primary_cluster`. + 1. Execute detach: + * Execute`terraform apply` to apply the change and wait for it to complete. + 1. Fix any configuration drifts on the primary cluster: + * Execute `terraform plan`. If any diff is reported for `cross_cluster_replication_config` field: + * Manually update `cross_cluster_replication_config` field in the configuration file with the latest value from the state. + * Execute `terraform plan` once again. This should not generate any diff, confirming the configuration is in sync with the infrastructure. + + **Detach secondary cluster(s) via primary cluster** + + To [detach](https://cloud.google.com/memorystore/docs/cluster/working-with-cross-region-replication#detach_secondary_clusters_option_2) secondary clusters via primary, please follow the below steps: + 1. Ensure that the Terraform configuration file for the primary cluster from which the secondary(ies) has(ve) to be detached has the `cross_cluster_replication_config` field. If it is not present: + * Add the `cross_cluster_replication_config` field to the configuration file to match the latest value in the state. + * Execute `terraform plan`. This should not generate any diff, confirming the configuration is in sync with the infrastructure. + 1. Update the `cross_cluster_replication_config` field of the primary cluster: + * If you are detaching all secondaries from the primary: + * Change `cross_cluster_replication_config.cluster_role` from `PRIMARY` to `NONE`. + * Remove `cross_cluster_replication_config.secondary_clusters` list field. + * If you are detaching a subset of secondaries: + * Update `cross_cluster_replication_config.secondary_clusters` list field to remove the secondary clusters that need to be detached. + 1. Execute detach: + * Execute `terraform apply` to apply the change and wait for it to complete. + 1. Fix any configuration drifts on the secondary cluster(s) that was detached: + * Execute `terraform plan`. If any diffs are reported for `cross_cluster_replication_config` field: + * Manually update `cross_cluster_replication_config` field in the configuration file(s) for those clusters with the latest value from the state. + * Execute `terraform plan` once again. This should not generate any diff, confirming the configuration is in sync with the infrastructure. + base_url: 'projects/{{project}}/locations/{{region}}/clusters' self_link: 'projects/{{project}}/locations/{{region}}/clusters/{{name}}' create_url: 'projects/{{project}}/locations/{{region}}/clusters?clusterId={{name}}' @@ -63,6 +137,24 @@ examples: 'deletion_protection_enabled': 'false' oics_vars_overrides: 'deletion_protection_enabled': 'false' + - name: 'redis_cluster_secondary' + primary_resource_id: 'secondary_cluster' + vars: + primary_cluster_name: 'my-primary-cluster' + primary_cluster_deletion_protection_enabled: 'true' + primary_cluster_policy_name: 'mypolicy-primary-cluster' + primary_cluster_subnet_name: 'mysubnet-primary-cluster' + secondary_cluster_name: 'my-secondary-cluster' + secondary_cluster_deletion_protection_enabled: 'true' + secondary_cluster_policy_name: 'mypolicy-secondary-cluster' + secondary_cluster_subnet_name: 'mysubnet-secondary-cluster' + network_name: 'mynetwork' + test_vars_overrides: + 'primary_cluster_deletion_protection_enabled': 'false' + 'secondary_cluster_deletion_protection_enabled': 'false' + oics_vars_overrides: + 'primary_cluster_deletion_protection_enabled': 'false' + 'secondary_cluster_deletion_protection_enabled': 'false' - name: "redis_cluster_rdb" primary_resource_id: "cluster-rdb" vars: @@ -497,3 +589,101 @@ properties: A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. output: true + - name: 'crossClusterReplicationConfig' + type: NestedObject + description: Cross cluster replication config + default_from_api: true + properties: + - name: 'clusterRole' + type: Enum + description: | + The role of the cluster in cross cluster replication. Supported values are: + + 1. `CLUSTER_ROLE_UNSPECIFIED`: This is an independent cluster that has never participated in cross cluster replication. It allows both reads and writes. + + 1. `NONE`: This is an independent cluster that previously participated in cross cluster replication(either as a `PRIMARY` or `SECONDARY` cluster). It allows both reads and writes. + + 1. `PRIMARY`: This cluster serves as the replication source for secondary clusters that are replicating from it. Any data written to it is automatically replicated to its secondary clusters. It allows both reads and writes. + + 1. `SECONDARY`: This cluster replicates data from the primary cluster. It allows only reads. + + enum_values: + - 'CLUSTER_ROLE_UNSPECIFIED' + - 'NONE' + - 'PRIMARY' + - 'SECONDARY' + - name: 'primaryCluster' + type: NestedObject + description: | + Details of the primary cluster that is used as the replication source for this secondary cluster. This is allowed to be set only for clusters whose cluster role is of type `SECONDARY`. + properties: + - name: 'cluster' + type: String + description: | + The full resource path of the primary cluster in the format: projects/{project}/locations/{region}/clusters/{cluster-id} + - name: 'uid' + type: String + description: | + The unique id of the primary cluster. + output: true + - name: 'secondaryClusters' + type: Array + description: | + List of secondary clusters that are replicating from this primary cluster. This is allowed to be set only for clusters whose cluster role is of type `PRIMARY`. + item_type: + type: NestedObject + properties: + - name: 'cluster' + type: String + description: | + The full resource path of the secondary cluster in the format: projects/{project}/locations/{region}/clusters/{cluster-id} + - name: 'uid' + type: String + description: | + The unique id of the secondary cluster. + output: true + - name: 'membership' + type: NestedObject + description: | + An output only view of all the member clusters participating in cross cluster replication. This field is populated for all the member clusters irrespective of their cluster role. + output: true + properties: + - name: 'primaryCluster' + type: NestedObject + description: | + Details of the primary cluster that is used as the replication source for all the secondary clusters. + output: true + properties: + - name: 'cluster' + type: String + description: | + The full resource path of the primary cluster in the format: projects/{project}/locations/{region}/clusters/{cluster-id} + output: true + - name: 'uid' + type: String + description: | + The unique id of the primary cluster. + output: true + - name: 'secondaryClusters' + type: Array + description: | + List of secondary clusters that are replicating from the primary cluster. + output: true + item_type: + type: NestedObject + properties: + - name: 'cluster' + type: String + description: | + The full resource path of the secondary cluster in the format: projects/{project}/locations/{region}/clusters/{cluster-id} + output: true + - name: 'uid' + type: String + description: | + The unique id of the secondary cluster. + output: true + - name: 'updateTime' + type: String + description: | + The last time cross cluster replication config was updated. + output: true diff --git a/mmv1/templates/terraform/examples/redis_cluster_secondary.tf.tmpl b/mmv1/templates/terraform/examples/redis_cluster_secondary.tf.tmpl new file mode 100644 index 000000000000..d2413d90334f --- /dev/null +++ b/mmv1/templates/terraform/examples/redis_cluster_secondary.tf.tmpl @@ -0,0 +1,151 @@ +// Primary cluster +resource "google_redis_cluster" "primary_cluster" { + name = "{{index $.Vars "primary_cluster_name"}}" + region = "us-east1" + psc_configs { + network = google_compute_network.producer_net.id + } + + // Settings that should match on primary and secondary clusters. + // If you define a setting here, ensure that the secondary clusters also define it with the same values. + // Please see https://cloud.google.com/memorystore/docs/cluster/about-cross-region-replication#settings_copied_from_the_primary_during_instance_creation for the complete list of such settings. + authorization_mode = "AUTH_MODE_DISABLED" + transit_encryption_mode = "TRANSIT_ENCRYPTION_MODE_DISABLED" + shard_count = 3 + redis_configs = { + maxmemory-policy = "volatile-ttl" + } + node_type = "REDIS_HIGHMEM_MEDIUM" + persistence_config { + mode = "RDB" + rdb_config { + rdb_snapshot_period = "ONE_HOUR" + rdb_snapshot_start_time = "2024-10-02T15:01:23Z" + } + } + + // Settings that can have different values on primary and secondary clusters. + // Please see https://cloud.google.com/memorystore/docs/cluster/about-cross-region-replication#override_allowed_during_instance_creation for the complete list of such settings. + zone_distribution_config { + mode = "MULTI_ZONE" + } + replica_count = 1 + maintenance_policy { + weekly_maintenance_window { + day = "MONDAY" + start_time { + hours = 1 + minutes = 0 + seconds = 0 + nanos = 0 + } + } + } + deletion_protection_enabled = {{index $.Vars "primary_cluster_deletion_protection_enabled"}} + + depends_on = [ + google_network_connectivity_service_connection_policy.primary_cluster_region_scp + ] +} + + +// Secondary cluster +resource "google_redis_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "secondary_cluster_name"}}" + region = "europe-west1" + psc_configs { + network = google_compute_network.producer_net.id + } + + // Settings that should match on primary and secondary clusters. + // If you defined a setting here for primary, ensure the secondary clusters also define it with the same values. + // Please see https://cloud.google.com/memorystore/docs/cluster/about-cross-region-replication#settings_copied_from_the_primary_during_instance_creation for the complete list of such settings. + authorization_mode = "AUTH_MODE_DISABLED" + transit_encryption_mode = "TRANSIT_ENCRYPTION_MODE_DISABLED" + shard_count = 3 + redis_configs = { + maxmemory-policy = "volatile-ttl" + } + node_type = "REDIS_HIGHMEM_MEDIUM" + persistence_config { + mode = "RDB" + rdb_config { + rdb_snapshot_period = "ONE_HOUR" + rdb_snapshot_start_time = "2024-10-02T15:01:23Z" + } + } + + // Settings that can be different on primary and secondary clusters. + // Please see https://cloud.google.com/memorystore/docs/cluster/about-cross-region-replication#override_allowed_during_instance_creation for the complete list of such settings. + zone_distribution_config { + mode = "MULTI_ZONE" + } + replica_count = 2 + maintenance_policy { + weekly_maintenance_window { + day = "WEDNESDAY" + start_time { + hours = 1 + minutes = 0 + seconds = 0 + nanos = 0 + } + } + } + deletion_protection_enabled = {{index $.Vars "secondary_cluster_deletion_protection_enabled"}} + + // Cross cluster replication config + cross_cluster_replication_config { + cluster_role = "SECONDARY" + primary_cluster { + cluster = google_redis_cluster.primary_cluster.id + } + } + + depends_on = [ + google_network_connectivity_service_connection_policy.secondary_cluster_region_scp + ] +} + + +resource "google_network_connectivity_service_connection_policy" "primary_cluster_region_scp" { + name = "{{index $.Vars "primary_cluster_policy_name"}}" + location = "us-east1" + service_class = "gcp-memorystore-redis" + description = "Primary cluster service connection policy" + network = google_compute_network.producer_net.id + psc_config { + subnetworks = [google_compute_subnetwork.primary_cluster_producer_subnet.id] + } +} + +resource "google_compute_subnetwork" "primary_cluster_producer_subnet" { + name = "{{index $.Vars "primary_cluster_subnet_name"}}" + ip_cidr_range = "10.0.1.0/29" + region = "us-east1" + network = google_compute_network.producer_net.id +} + + +resource "google_network_connectivity_service_connection_policy" "secondary_cluster_region_scp" { + name = "{{index $.Vars "secondary_cluster_policy_name"}}" + location = "europe-west1" + service_class = "gcp-memorystore-redis" + description = "Secondary cluster service connection policy" + network = google_compute_network.producer_net.id + psc_config { + subnetworks = [google_compute_subnetwork.secondary_cluster_producer_subnet.id] + } +} + +resource "google_compute_subnetwork" "secondary_cluster_producer_subnet" { + name = "{{index $.Vars "secondary_cluster_subnet_name"}}" + ip_cidr_range = "10.0.2.0/29" + region = "europe-west1" + network = google_compute_network.producer_net.id +} + +resource "google_compute_network" "producer_net" { + name = "{{index $.Vars "network_name"}}" + auto_create_subnetworks = false +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.tmpl index 02839714e679..31a8759a32d2 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.tmpl @@ -309,24 +309,114 @@ func TestAccRedisCluster_persistenceUpdate(t *testing.T) { }) } +// Validate that deletion protection enabled/disabled cluster is created updated +func TestAccRedisCluster_switchoverAndDetachSecondary(t *testing.T) { + t.Parallel() + + pcName := fmt.Sprintf("tf-test-prim-%d", acctest.RandInt(t)) + scName := fmt.Sprintf("tf-test-sec-%d", acctest.RandInt(t)) + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + CheckDestroy: testAccCheckRedisClusterDestroyProducer(t), + Steps: []resource.TestStep{ + { + // create primary and secondary clusters cluster + Config: createOrUpdateRedisCluster(&ClusterParams{name: pcName, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false, zoneDistributionMode: "MULTI_ZONE", shouldCreateSecondary: true, secondaryClusterName: scName, ccrRole: "SECONDARY"}), + }, + { + ResourceName: "google_redis_cluster.test_secondary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"psc_configs"}, + }, + { + // // Switchover to secondary cluster + Config: createOrUpdateRedisCluster(&ClusterParams{name: pcName, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false, zoneDistributionMode: "MULTI_ZONE", shouldCreateSecondary: true, secondaryClusterName: scName, ccrRole: "PRIMARY"}), + }, + { + ResourceName: "google_redis_cluster.test_secondary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"psc_configs"}, + }, + { + // Detach secondary cluster and delete the clusters + Config: createOrUpdateRedisCluster(&ClusterParams{name: pcName, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false, zoneDistributionMode: "MULTI_ZONE", shouldCreateSecondary: true, secondaryClusterName: scName, ccrRole: "NONE"}), + }, + }, + }) +} + type ClusterParams struct { - name string - replicaCount int - shardCount int + name string + replicaCount int + shardCount int deletionProtectionEnabled bool - nodeType string - redisConfigs map[string]string - zoneDistributionMode string - zone string - maintenanceDay string - maintenanceHours int - maintenanceMinutes int - maintenanceSeconds int - maintenanceNanos int - persistenceBlock string + nodeType string + redisConfigs map[string]string + zoneDistributionMode string + zone string + maintenanceDay string + maintenanceHours int + maintenanceMinutes int + maintenanceSeconds int + maintenanceNanos int + persistenceBlock string + shouldCreateSecondary bool + secondaryClusterName string + ccrRole string } func createOrUpdateRedisCluster(params *ClusterParams) string { + clusterResourceBlock := createRedisClusterResourceConfig(params, /*isSecondaryCluster*/false) + secClusterResourceBlock := `` + if params.shouldCreateSecondary { + secClusterResourceBlock = createRedisClusterResourceConfig(params, /*isSecondaryCluster*/true) + } + + return fmt.Sprintf(` + %s + %s + resource "google_network_connectivity_service_connection_policy" "default" { + provider = google-beta + name = "%s" + location = "us-central1" + service_class = "gcp-memorystore-redis" + description = "my basic service connection policy" + network = google_compute_network.producer_net.id + psc_config { + subnetworks = [google_compute_subnetwork.producer_subnet.id] + } + } + + resource "google_compute_subnetwork" "producer_subnet" { + provider = google-beta + name = "%s" + ip_cidr_range = "10.0.0.16/28" + region = "us-central1" + network = google_compute_network.producer_net.id + } + + resource "google_compute_network" "producer_net" { + provider = google-beta + name = "%s" + auto_create_subnetworks = false + } + `, + clusterResourceBlock, + secClusterResourceBlock, + params.name, + params.name, + params.name) +} + +func createRedisClusterResourceConfig(params *ClusterParams, isSecondaryCluster bool) string { + tfClusterResourceName := "test" + clusterName := params.name + dependsOnBlock := "google_network_connectivity_service_connection_policy.default" + var redsConfigsStrBuilder strings.Builder for key, value := range params.redisConfigs { redsConfigsStrBuilder.WriteString(fmt.Sprintf("%s = \"%s\"\n", key, value)) @@ -359,55 +449,73 @@ func createOrUpdateRedisCluster(params *ClusterParams) string { `, params.maintenanceDay, params.maintenanceHours, params.maintenanceMinutes, params.maintenanceSeconds, params.maintenanceNanos) } - return fmt.Sprintf(` -resource "google_redis_cluster" "test" { - provider = google-beta - name = "%s" - replica_count = %d - shard_count = %d - node_type = "%s" - deletion_protection_enabled = %v - region = "us-central1" - psc_configs { - network = google_compute_network.producer_net.id - } - redis_configs = { - %s - } - %s - %s - %s - depends_on = [ - google_network_connectivity_service_connection_policy.default - ] -} - -resource "google_network_connectivity_service_connection_policy" "default" { - provider = google-beta - name = "%s" - location = "us-central1" - service_class = "gcp-memorystore-redis" - description = "my basic service connection policy" - network = google_compute_network.producer_net.id - psc_config { - subnetworks = [google_compute_subnetwork.producer_subnet.id] + crossClusterReplicationConfigBlock := `` + if isSecondaryCluster { + tfClusterResourceName = "test_secondary" + clusterName = params.secondaryClusterName + dependsOnBlock = dependsOnBlock + ", google_redis_cluster.test" + + // Construct cross_cluster_replication_config block + pcBlock := `` + scsBlock := `` + if params.ccrRole == "SECONDARY" { + pcBlock = fmt.Sprintf(` + primary_cluster { + cluster = google_redis_cluster.test.id + } + `) + } else if params.ccrRole == "PRIMARY" { + scsBlock = fmt.Sprintf(` + secondary_clusters { + cluster = google_redis_cluster.test.id + } + `) + } + crossClusterReplicationConfigBlock = fmt.Sprintf(` + cross_cluster_replication_config { + cluster_role = "%s" + %s + %s + } + `, params.ccrRole, pcBlock, scsBlock) } -} - -resource "google_compute_subnetwork" "producer_subnet" { - provider = google-beta - name = "%s" - ip_cidr_range = "10.0.0.248/29" - region = "us-central1" - network = google_compute_network.producer_net.id -} -resource "google_compute_network" "producer_net" { - provider = google-beta - name = "%s" - auto_create_subnetworks = false -} -`, params.name, params.replicaCount, params.shardCount, params.nodeType, params.deletionProtectionEnabled, redsConfigsStrBuilder.String(), zoneDistributionConfigBlock, maintenancePolicyBlock, params.persistenceBlock, params.name, params.name, params.name) + return fmt.Sprintf(` + resource "google_redis_cluster" "%s" { + provider = google-beta + name = "%s" + replica_count = %d + shard_count = %d + node_type = "%s" + deletion_protection_enabled = %v + region = "us-central1" + psc_configs { + network = google_compute_network.producer_net.id + } + redis_configs = { + %s + } + %s + %s + %s + %s + depends_on = [ + %s + ] + } + `, + tfClusterResourceName, + clusterName, + params.replicaCount, + params.shardCount, + params.nodeType, + params.deletionProtectionEnabled, + redsConfigsStrBuilder.String(), + zoneDistributionConfigBlock, + maintenancePolicyBlock, + params.persistenceBlock, + crossClusterReplicationConfigBlock, + dependsOnBlock) } {{ end }} From c9744b21db0e636c5bfb5347a8cba56734a265ae Mon Sep 17 00:00:00 2001 From: Shuya Ma <87669292+shuyama1@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:02:29 -0800 Subject: [PATCH 30/44] Fix backup vault tests in VCR (#12345) --- mmv1/products/backupdr/BackupPlan.yaml | 1 + .../terraform/examples/backup_dr_backup_plan_simple.tf.tmpl | 2 +- .../backupdr/resource_backup_dr_backup_vault_test.go.tmpl | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mmv1/products/backupdr/BackupPlan.yaml b/mmv1/products/backupdr/BackupPlan.yaml index e1b2505403e4..da5424e9f8f8 100644 --- a/mmv1/products/backupdr/BackupPlan.yaml +++ b/mmv1/products/backupdr/BackupPlan.yaml @@ -33,6 +33,7 @@ examples: min_version: 'beta' primary_resource_id: 'my-backup-plan-1' vars: + backup_vault_id: 'backup-vault-simple-test' backup_plan_id: 'backup-plan-simple-test' test_env_vars: project: :PROJECT_NAME diff --git a/mmv1/templates/terraform/examples/backup_dr_backup_plan_simple.tf.tmpl b/mmv1/templates/terraform/examples/backup_dr_backup_plan_simple.tf.tmpl index 81363b8ae98d..dd5ae57689f7 100644 --- a/mmv1/templates/terraform/examples/backup_dr_backup_plan_simple.tf.tmpl +++ b/mmv1/templates/terraform/examples/backup_dr_backup_plan_simple.tf.tmpl @@ -1,7 +1,7 @@ resource "google_backup_dr_backup_vault" "my_backup_vault" { provider = google-beta location = "us-central1" - backup_vault_id = "bv-bp-test" + backup_vault_id = "{{index $.Vars "backup_vault_id"}}" backup_minimum_enforced_retention_duration = "100000s" } diff --git a/mmv1/third_party/terraform/services/backupdr/resource_backup_dr_backup_vault_test.go.tmpl b/mmv1/third_party/terraform/services/backupdr/resource_backup_dr_backup_vault_test.go.tmpl index 53d7f084cbf8..19938ef52f76 100644 --- a/mmv1/third_party/terraform/services/backupdr/resource_backup_dr_backup_vault_test.go.tmpl +++ b/mmv1/third_party/terraform/services/backupdr/resource_backup_dr_backup_vault_test.go.tmpl @@ -10,6 +10,9 @@ import ( ) func TestAccBackupDRBackupVault_fullUpdate(t *testing.T) { + // Uses time.Now + acctest.SkipIfVcr(t) + t.Parallel() timeNow := time.Now().UTC() From eec9d040c11c93b9013d8891d000eb67f1e0b9d1 Mon Sep 17 00:00:00 2001 From: Suraj Naik Date: Tue, 19 Nov 2024 02:41:10 +0530 Subject: [PATCH 31/44] Fix TestAccDataprocCluster_withNetworkRefs (#12335) --- .../dataproc/resource_dataproc_cluster_test.go.tmpl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl index 5a7f8cccbc5f..040f08ac4402 100644 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl @@ -2351,14 +2351,15 @@ resource "google_dataproc_cluster" "with_net_ref_by_name" { } master_config { - machine_type = "e2-medium" + machine_type = "e2-standard-2" disk_config { boot_disk_size_gb = 35 } } gce_cluster_config { - network = google_compute_network.dataproc_network.name + network = google_compute_network.dataproc_network.name + internal_ip_only = false } } } @@ -2378,14 +2379,15 @@ resource "google_dataproc_cluster" "with_net_ref_by_url" { } master_config { - machine_type = "e2-medium" + machine_type = "e2-standard-2" disk_config { boot_disk_size_gb = 35 } } gce_cluster_config { - network = google_compute_network.dataproc_network.self_link + network = google_compute_network.dataproc_network.self_link + internal_ip_only = false } } } From 0e4f8103665a42efd12b0c474388d44f6ef112c5 Mon Sep 17 00:00:00 2001 From: Liyun Huang Date: Mon, 18 Nov 2024 16:54:14 -0500 Subject: [PATCH 32/44] Promote backupvault to GA (#12332) --- mmv1/products/backupdr/BackupVault.yaml | 25 ------------------- mmv1/products/backupdr/product.yaml | 2 ++ .../backup_dr_backup_vault_full.tf.tmpl | 9 +++---- ...source_backup_dr_backup_vault_test.go.tmpl | 8 ++---- 4 files changed, 8 insertions(+), 36 deletions(-) diff --git a/mmv1/products/backupdr/BackupVault.yaml b/mmv1/products/backupdr/BackupVault.yaml index f5a61e8cedc9..a4239f08fb2f 100644 --- a/mmv1/products/backupdr/BackupVault.yaml +++ b/mmv1/products/backupdr/BackupVault.yaml @@ -14,7 +14,6 @@ --- name: 'BackupVault' description: Container to store and organize immutable and indelible backups. -min_version: 'beta' docs: id_format: 'projects/{{project}}/locations/{{location}}/backupVaults/{{backup_vault_id}}' base_url: 'projects/{{project}}/locations/{{location}}/backupVaults' @@ -50,7 +49,6 @@ custom_code: examples: - name: 'backup_dr_backup_vault_full' primary_resource_id: 'backup-vault-test' - min_version: 'beta' vars: backup_vault_id: 'backup-vault-test' test_env_vars: @@ -59,14 +57,12 @@ parameters: - name: 'location' type: String description: "The GCP location for the backup vault. " - min_version: 'beta' url_param_only: true required: true immutable: true - name: 'backupVaultId' type: String description: "Required. ID of the requesting object." - min_version: 'beta' url_param_only: true required: true immutable: true @@ -77,7 +73,6 @@ parameters: the restriction against conflicting retention periods. This conflict may occur when the expiration schedule defined by the associated backup plan is shorter than the minimum retention set by the backup vault. - min_version: 'beta' url_param_only: true default_value: false - name: 'force_delete' @@ -86,7 +81,6 @@ parameters: If set, the following restrictions against deletion of the backup vault instance can be overridden: * deletion of a backup vault instance containing no backups, but still containing empty datasources. * deletion of a backup vault instance that is being referenced by an active backup plan. - min_version: 'beta' url_param_only: true default_value: false deprecation_message: '`force_delete` is deprecated and will be removed in a future major release. Use `ignore_inactive_datasources` instead.' @@ -97,7 +91,6 @@ parameters: description: | If set, the following restrictions against deletion of the backup vault instance can be overridden: * deletion of a backup vault instance containing no backups, but still containing empty datasources. - min_version: 'beta' url_param_only: true default_value: false conflicts: @@ -107,102 +100,84 @@ parameters: description: | If set, the following restrictions against deletion of the backup vault instance can be overridden: * deletion of a backup vault instance that is being referenced by an active backup plan. - min_version: 'beta' url_param_only: true default_value: false - name: 'allow_missing' type: Boolean description: | Allow idempotent deletion of backup vault. The request will still succeed in case the backup vault does not exist. - min_version: 'beta' url_param_only: true default_value: false properties: - name: 'name' type: String description: 'Output only. Identifier. The resource name. ' - min_version: 'beta' output: true - name: 'description' type: String description: 'Optional. The description of the BackupVault instance (2048 characters or less). ' - min_version: 'beta' - name: 'labels' type: KeyValueLabels description: "Optional. Resource labels to represent user provided metadata. " - min_version: 'beta' - name: 'createTime' type: String description: 'Output only. The time when the instance was created. ' - min_version: 'beta' output: true - name: 'updateTime' type: String description: 'Output only. The time when the instance was updated. ' - min_version: 'beta' output: true - name: 'backupMinimumEnforcedRetentionDuration' type: String description: "Required. The default and minimum enforced retention for each backup within the backup vault. The enforced retention for each backup can be extended. " - min_version: 'beta' required: true - name: 'deletable' type: Boolean description: 'Output only. Set to true when there are no backups nested under this resource. ' - min_version: 'beta' output: true - name: 'etag' type: String description: "Optional. Server specified ETag for the backup vault resource to prevent simultaneous updates from overwiting each other. " - min_version: 'beta' output: true - name: 'state' type: String description: "Output only. The BackupVault resource instance state. \n Possible values:\n STATE_UNSPECIFIED\n CREATING\n ACTIVE\n DELETING\n ERROR" - min_version: 'beta' output: true - name: 'effectiveTime' type: String description: 'Optional. Time after which the BackupVault resource is locked. ' - min_version: 'beta' - name: 'backupCount' type: String description: 'Output only. The number of backups in this backup vault. ' - min_version: 'beta' output: true - name: 'serviceAccount' type: String description: "Output only. Service account used by the BackupVault Service for this BackupVault. The user should grant this account permissions in their workload project to enable the service to run backups and restores there. " - min_version: 'beta' output: true - name: 'totalStoredBytes' type: String description: 'Output only. Total size of the storage used by all backup resources. ' - min_version: 'beta' output: true - name: 'uid' type: String description: "Output only. Output only Immutable after resource creation until resource deletion. " - min_version: 'beta' output: true - name: 'annotations' type: KeyValueAnnotations description: "Optional. User annotations. See https://google.aip.dev/128#annotations\nStores small amounts of arbitrary data. " - min_version: 'beta' - name: 'accessRestriction' type: Enum description: | Access restriction for the backup vault. Default value is `WITHIN_ORGANIZATION` if not provided during creation. - min_version: 'beta' immutable: true default_value: "WITHIN_ORGANIZATION" enum_values: diff --git a/mmv1/products/backupdr/product.yaml b/mmv1/products/backupdr/product.yaml index ca3302aadfdd..d668e8340ef9 100644 --- a/mmv1/products/backupdr/product.yaml +++ b/mmv1/products/backupdr/product.yaml @@ -15,6 +15,8 @@ name: 'BackupDR' display_name: 'Backup and DR Service' versions: + - name: 'ga' + base_url: 'https://backupdr.googleapis.com/v1/' - name: 'beta' base_url: 'https://backupdr.googleapis.com/v1/' scopes: diff --git a/mmv1/templates/terraform/examples/backup_dr_backup_vault_full.tf.tmpl b/mmv1/templates/terraform/examples/backup_dr_backup_vault_full.tf.tmpl index d26aae4b3177..f527cf9fa2f9 100644 --- a/mmv1/templates/terraform/examples/backup_dr_backup_vault_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/backup_dr_backup_vault_full.tf.tmpl @@ -1,17 +1,16 @@ resource "google_backup_dr_backup_vault" "{{$.PrimaryResourceId}}" { - provider = google-beta location = "us-central1" backup_vault_id = "{{index $.Vars "backup_vault_id"}}" description = "This is a second backup vault built by Terraform." backup_minimum_enforced_retention_duration = "100000s" - labels = { - foo = "bar1" - bar = "baz1" - } annotations = { annotations1 = "bar1" annotations2 = "baz1" } + labels = { + foo = "bar1" + bar = "baz1" + } force_update = "true" access_restriction = "WITHIN_ORGANIZATION" ignore_inactive_datasources = "true" diff --git a/mmv1/third_party/terraform/services/backupdr/resource_backup_dr_backup_vault_test.go.tmpl b/mmv1/third_party/terraform/services/backupdr/resource_backup_dr_backup_vault_test.go.tmpl index 19938ef52f76..c851a5387309 100644 --- a/mmv1/third_party/terraform/services/backupdr/resource_backup_dr_backup_vault_test.go.tmpl +++ b/mmv1/third_party/terraform/services/backupdr/resource_backup_dr_backup_vault_test.go.tmpl @@ -1,5 +1,4 @@ package backupdr_test -{{- if ne $.TargetVersionName "ga" }} import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" @@ -26,7 +25,7 @@ func TestAccBackupDRBackupVault_fullUpdate(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccBackupDRBackupVault_fullCreate(context), @@ -53,7 +52,6 @@ func TestAccBackupDRBackupVault_fullUpdate(t *testing.T) { func testAccBackupDRBackupVault_fullCreate(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_backup_dr_backup_vault" "backup-vault-test" { - provider = google-beta location = "us-central1" backup_vault_id = "tf-test-backup-vault-test%{random_suffix}" description = "This is a backup vault built by Terraform." @@ -79,7 +77,6 @@ resource "google_backup_dr_backup_vault" "backup-vault-test" { func testAccBackupDRBackupVault_fullUpdate(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_backup_dr_backup_vault" "backup-vault-test" { - provider = google-beta location = "us-central1" backup_vault_id = "tf-test-backup-vault-test%{random_suffix}" description = "This is a second backup vault built by Terraform." @@ -100,5 +97,4 @@ resource "google_backup_dr_backup_vault" "backup-vault-test" { allow_missing = "true" } `, context) -} -{{- end }} \ No newline at end of file +} \ No newline at end of file From cab73525e01fb2ada73ae78520cf58ba1d45fc93 Mon Sep 17 00:00:00 2001 From: halimsam Date: Mon, 18 Nov 2024 14:57:07 -0800 Subject: [PATCH 33/44] Add TF support for LocalSsdEncryptionMode flag (#12249) --- mmv1/third_party/terraform/go.mod | 2 +- .../services/container/node_config.go.tmpl | 12 ++++ .../resource_container_cluster_test.go.tmpl | 52 ++++++++++++++++ .../resource_container_node_pool_test.go.tmpl | 59 +++++++++++++++++++ .../docs/r/container_cluster.html.markdown | 5 ++ .../docs/r/container_node_pool.html.markdown | 5 ++ 6 files changed, 134 insertions(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/go.mod b/mmv1/third_party/terraform/go.mod index 22a553717d8b..11c5e642481a 100644 --- a/mmv1/third_party/terraform/go.mod +++ b/mmv1/third_party/terraform/go.mod @@ -118,4 +118,4 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect -) +) \ No newline at end of file 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 e5340a66546a..7bb8a65cb8c5 100644 --- a/mmv1/third_party/terraform/services/container/node_config.go.tmpl +++ b/mmv1/third_party/terraform/services/container/node_config.go.tmpl @@ -806,6 +806,13 @@ func schemaNodeConfig() *schema.Schema { ForceNew: true, Description: `If enabled boot disks are configured with confidential mode.`, }, + "local_ssd_encryption_mode": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{"STANDARD_ENCRYPTION", "EPHEMERAL_KEY_ENCRYPTION"}, false), + Description: `LocalSsdEncryptionMode specified the method used for encrypting the local SSDs attached to the node.`, + }, }, }, } @@ -1160,6 +1167,10 @@ func expandNodeConfig(v interface{}) *container.NodeConfig { nc.EnableConfidentialStorage = v.(bool) } + if v,ok := nodeConfig["local_ssd_encryption_mode"]; ok { + nc.LocalSsdEncryptionMode = v.(string) + } + {{ if ne $.TargetVersionName `ga` -}} if v, ok := nodeConfig["host_maintenance_policy"]; ok { nc.HostMaintenancePolicy = expandHostMaintenancePolicy(v) @@ -1550,6 +1561,7 @@ func flattenNodeConfig(c *container.NodeConfig, v interface{}) []map[string]inte "fast_socket": flattenFastSocket(c.FastSocket), "resource_manager_tags": flattenResourceManagerTags(c.ResourceManagerTags), "enable_confidential_storage": c.EnableConfidentialStorage, + "local_ssd_encryption_mode": c.LocalSsdEncryptionMode, }) if len(c.OauthScopes) > 0 { diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl index 67d6655fa2ba..31611588ee24 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl @@ -415,6 +415,32 @@ func TestAccContainerCluster_withConfidentialNodes(t *testing.T) { }) } +func TestAccContainerCluster_withLocalSsdEncryptionMode(t *testing.T) { + t.Parallel() + + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") + subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) + npName := fmt.Sprintf("tf-test-node-pool-%s", acctest.RandString(t, 10)) + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccContainerCluster_withLocalSsdEncryptionMode(clusterName, npName, networkName, subnetworkName, "EPHEMERAL_KEY_ENCRYPTION"), + }, + { + ResourceName: "google_container_cluster.local_ssd_encryption_mode", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"deletion_protection"}, + }, + }, + }) +} + func TestAccContainerCluster_withILBSubsetting(t *testing.T) { t.Parallel() @@ -6461,6 +6487,32 @@ resource "google_container_cluster" "confidential_nodes" { `, clusterName, npName, networkName, subnetworkName) } +func testAccContainerCluster_withLocalSsdEncryptionMode(clusterName, npName, networkName, subnetworkName, mode string) string { + return fmt.Sprintf(` +resource "google_container_cluster" "local_ssd_encryption_mode" { + name = "%s" + location = "us-central1-a" + release_channel { + channel = "RAPID" + } + + node_pool { + name = "%s" + initial_node_count = 1 + node_config { + machine_type = "n1-standard-2" + local_ssd_count = 1 + local_ssd_encryption_mode = "%s" + } + } + + deletion_protection = false + network = "%s" + subnetwork = "%s" +} +`, clusterName, npName, mode, networkName, subnetworkName) +} + func testAccContainerCluster_withILBSubSetting(clusterName, npName, networkName, subnetworkName string) string { return fmt.Sprintf(` resource "google_container_cluster" "confidential_nodes" { diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl index 999868c611e6..fe36360a2a68 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool_test.go.tmpl @@ -4157,6 +4157,65 @@ resource "google_container_node_pool" "np" { `, clusterName, networkName, subnetworkName, np) } +func TestAccContainerNodePool_withLocalSsdEncryptionMode(t *testing.T) { + t.Parallel() + + clusterName := fmt.Sprintf("tf-test-cluster-%s", acctest.RandString(t, 10)) + np := fmt.Sprintf("tf-test-cluster-nodepool-%s", acctest.RandString(t, 10)) + networkName := acctest.BootstrapSharedTestNetwork(t, "gke-cluster") + subnetworkName := acctest.BootstrapSubnet(t, "gke-cluster", networkName) + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckContainerClusterDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccContainerNodePool_withLocalSsdEncryptionMode(clusterName, np, networkName, subnetworkName, "EPHEMERAL_KEY_ENCRYPTION"), + }, + { + ResourceName: "google_container_node_pool.np", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccContainerNodePool_withLocalSsdEncryptionMode(clusterName, np, networkName, subnetworkName, mode string) string { + return fmt.Sprintf(` +resource "google_container_cluster" "cluster" { + name = "%s" + location = "us-central1-a" + initial_node_count = 1 + node_config { + local_ssd_encryption_mode = "%s" + machine_type = "n1-standard-1" + local_nvme_ssd_block_config { + local_ssd_count = 1 + } + } + deletion_protection = false + network = "%s" + subnetwork = "%s" +} + +resource "google_container_node_pool" "np" { + name = "%s" + location = "us-central1-a" + cluster = google_container_cluster.cluster.name + initial_node_count = 1 + node_config { + machine_type = "n1-standard-1" + local_ssd_encryption_mode = "%s" + local_nvme_ssd_block_config { + local_ssd_count = 1 + } + } +} +`, clusterName, mode, networkName, subnetworkName, np, mode) +} + func TestAccContainerNodePool_tpuTopology(t *testing.T) { t.Parallel() t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/15254#issuecomment-1646277473") diff --git a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown index 229241d93a9d..368c1b2a441d 100644 --- a/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/container_cluster.html.markdown @@ -840,6 +840,11 @@ The `master_authorized_networks_config.cidr_blocks` block supports: * `enable_confidential_storage` - (Optional) Enabling Confidential Storage will create boot disk with confidential mode. It is disabled by default. +* `local_ssd_encryption_mode` - (Optional) Possible Local SSD encryption modes: + Accepted values are: + * `STANDARD_ENCRYPTION`: The given node will be encrypted using keys managed by Google infrastructure and the keys wll be deleted when the node is deleted. + * `EPHEMERAL_KEY_ENCRYPTION`: The given node will opt-in for using ephemeral key for encrypting Local SSDs. The Local SSDs will not be able to recover data in case of node crash. + * `ephemeral_storage_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Parameters for the ephemeral storage filesystem. If unspecified, ephemeral storage is backed by the boot disk. Structure is [documented below](#nested_ephemeral_storage_config). ```hcl diff --git a/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown b/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown index 08759e68c1a2..9a2cc5411523 100644 --- a/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/container_node_pool.html.markdown @@ -270,6 +270,11 @@ cluster. * `batch_node_count` - (Optional) Number of blue nodes to drain in a batch. * `batch_soak_duration` - (Optionial) Soak time after each batch gets drained. +* `local_ssd_encryption_mode` - (Optional) Possible Local SSD encryption modes: + Accepted values are: + * `STANDARD_ENCRYPTION`: The given node will be encrypted using keys managed by Google infrastructure and the keys wll be deleted when the node is deleted. + * `EPHEMERAL_KEY_ENCRYPTION`: The given node will opt-in for using ephemeral key for encrypting Local SSDs. The Local SSDs will not be able to recover data in case of node crash. + * `node_pool_soak_duration` - (Optional) Time needed after draining the entire blue pool. After this period, the blue pool will be cleaned up. From 2f6a08d1bf846c149d63e48adb5fa2ebe52002e3 Mon Sep 17 00:00:00 2001 From: chayan kumar roy Date: Tue, 19 Nov 2024 00:17:58 +0100 Subject: [PATCH 34/44] Promote InstanceFlexibilityPolicy to GA (#12244) --- ...e_compute_region_instance_group_manager.go.tmpl | 14 +------------- ...pute_region_instance_group_manager_test.go.tmpl | 5 +---- ...ute_region_instance_group_manager.html.markdown | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl index 0afcf93719a0..f6db9cf7f694 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl @@ -94,7 +94,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, - {{- if ne $.TargetVersionName "ga" }} "instance_flexibility_policy": { Type: schema.TypeList, Optional: true, @@ -134,7 +133,6 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { }, }, }, - {{- end }} "name": { Type: schema.TypeString, @@ -672,9 +670,7 @@ func resourceComputeRegionInstanceGroupManagerCreate(d *schema.ResourceData, met TargetSuspendedSize: int64(d.Get("target_suspended_size").(int)), TargetStoppedSize: int64(d.Get("target_stopped_size").(int)), {{- end }} - {{- if ne $.TargetVersionName "ga" }} InstanceFlexibilityPolicy: expandInstanceFlexibilityPolicy(d), - {{- end }} UpdatePolicy: expandRegionUpdatePolicy(d.Get("update_policy").([]interface{})), InstanceLifecyclePolicy: expandInstanceLifecyclePolicy(d.Get("instance_lifecycle_policy").([]interface{})), AllInstancesConfig: expandAllInstancesConfig(nil, d.Get("all_instances_config").([]interface{})), @@ -878,11 +874,9 @@ func resourceComputeRegionInstanceGroupManagerRead(d *schema.ResourceData, meta return fmt.Errorf("Error setting target_stopped_size: %s", err) } {{- end }} - {{- if ne $.TargetVersionName "ga" }} if err := d.Set("instance_flexibility_policy", flattenInstanceFlexibilityPolicy(manager.InstanceFlexibilityPolicy)); err != nil { return err } - {{- end }} if err := d.Set("update_policy", flattenRegionUpdatePolicy(manager.UpdatePolicy)); err != nil { return fmt.Errorf("Error setting update_policy in state: %s", err.Error()) } @@ -956,7 +950,6 @@ func resourceComputeRegionInstanceGroupManagerUpdate(d *schema.ResourceData, met change = true } - {{- if ne $.TargetVersionName "ga" }} var targetSizePatchUpdate bool if d.HasChange("instance_flexibility_policy") { updatedManager.InstanceFlexibilityPolicy = expandInstanceFlexibilityPolicy(d) @@ -969,7 +962,6 @@ func resourceComputeRegionInstanceGroupManagerUpdate(d *schema.ResourceData, met targetSizePatchUpdate = true } } - {{- end }} if d.HasChange("distribution_policy_target_shape") { updatedManager.DistributionPolicy = expandDistributionPolicyForUpdate(d) @@ -1060,7 +1052,7 @@ func resourceComputeRegionInstanceGroupManagerUpdate(d *schema.ResourceData, met } // target size should use resize - if d.HasChange("target_size") {{- if ne $.TargetVersionName "ga" }} && !targetSizePatchUpdate {{- end}} { + if d.HasChange("target_size") && !targetSizePatchUpdate { d.Partial(true) targetSize := int64(d.Get("target_size").(int)) op, err := config.NewComputeClient(userAgent).RegionInstanceGroupManagers.Resize( @@ -1210,7 +1202,6 @@ func flattenRegionUpdatePolicy(updatePolicy *compute.InstanceGroupManagerUpdateP return results } -{{- if ne $.TargetVersionName "ga" }} func expandInstanceFlexibilityPolicy(d *schema.ResourceData) *compute.InstanceGroupManagerInstanceFlexibilityPolicy { instanceFlexibilityPolicy := &compute.InstanceGroupManagerInstanceFlexibilityPolicy{} oldFlexibilityPolicy, newFlexibilityPolicy := d.GetChange("instance_flexibility_policy") @@ -1244,7 +1235,6 @@ func expandInstanceSelections(instanceSelections []any) map[string]compute.Insta } return instanceSelectionsMap } -{{- end }} func expandDistributionPolicyForUpdate(d *schema.ResourceData) *compute.DistributionPolicy { dpts := d.Get("distribution_policy_target_shape").(string) @@ -1281,7 +1271,6 @@ func expandDistributionPolicyForCreate(d *schema.ResourceData) *compute.Distribu return distributionPolicy } -{{- if ne $.TargetVersionName "ga" }} func flattenInstanceFlexibilityPolicy(instanceFlexibilityPolicy *compute.InstanceGroupManagerInstanceFlexibilityPolicy) []map[string]any { flattenedInstanceFlexibilityPolicy := []map[string]any{} if instanceFlexibilityPolicy != nil { @@ -1303,7 +1292,6 @@ func flattenInstanceSelections(instanceSelections map[string]compute.InstanceGro } return instanceSelectionsMap } -{{- end }} func flattenDistributionPolicy(distributionPolicy *compute.DistributionPolicy) []string { zones := make([]string, 0) diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.tmpl index bdf636e5a69e..9f6738d1790e 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.tmpl @@ -431,7 +431,6 @@ func TestAccRegionInstanceGroupManager_stoppedSuspendedTargetSize(t *testing.T) } {{- end }} -{{- if ne $.TargetVersionName "ga" }} func TestAccRegionInstanceGroupManager_instanceFlexibilityPolicy(t *testing.T) { t.Parallel() @@ -474,7 +473,7 @@ func TestAccRegionInstanceGroupManager_instanceFlexibilityPolicy(t *testing.T) { }, }) } -{{- end }} + func TestAccRegionInstanceGroupManager_APISideListRecordering(t *testing.T) { t.Parallel() @@ -1969,7 +1968,6 @@ resource "google_compute_region_instance_group_manager" "sr-igm" { } {{- end }} -{{- if ne $.TargetVersionName "ga" }} func testAccRegionInstanceGroupManager_instanceFlexibilityPolicy(network, template, igm string) string { return fmt.Sprintf(` data "google_compute_image" "my_image" { @@ -2138,7 +2136,6 @@ resource "google_compute_region_instance_group_manager" "igm-basic" { } `, network, template, igm) } -{{- end }} {{- if ne $.TargetVersionName "ga" }} func testAccRegionInstanceGroupManager_resourceManagerTags(template_name, tag_name, igm_name, project_id string) string { diff --git a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_group_manager.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_group_manager.html.markdown index 465bfb373898..9becef0feddf 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_region_instance_group_manager.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_region_instance_group_manager.html.markdown @@ -205,7 +205,7 @@ group. You can specify one or more values. For more information, see the [offici * `params` - (Optional [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Input only additional params for instance group manager creation. Structure is [documented below](#nested_params). For more information, see [API](https://cloud.google.com/compute/docs/reference/rest/beta/instanceGroupManagers/insert). -* `instance_flexibility_policy` - (Optional [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) The flexibility policy for managed instance group. Instance flexibility allows managed instance group to create VMs from multiple types of machines. Instance flexibility configuration on managed instance group overrides instance template configuration. Structure is [documented below](#nested_instance_flexibility_policy). +* `instance_flexibility_policy` - (Optional) The flexibility policy for managed instance group. Instance flexibility allows managed instance group to create VMs from multiple types of machines. Instance flexibility configuration on managed instance group overrides instance template configuration. Structure is [documented below](#nested_instance_flexibility_policy). - - - The `standby_policy` block supports: From 5be6d053f6eecef46df4739bb57660321f7eb0aa Mon Sep 17 00:00:00 2001 From: Tomoya <5311731+entertvl@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:20:00 +0900 Subject: [PATCH 35/44] fix(apigee): Error of update in google_apigee_developer (#12347) --- mmv1/products/apigee/Developer.yaml | 2 +- .../resource_apigee_developer_update_test.go | 123 ++++++++++++++++++ 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 mmv1/third_party/terraform/services/apigee/resource_apigee_developer_update_test.go diff --git a/mmv1/products/apigee/Developer.yaml b/mmv1/products/apigee/Developer.yaml index 858a7f9cf884..e26a5ee6593e 100644 --- a/mmv1/products/apigee/Developer.yaml +++ b/mmv1/products/apigee/Developer.yaml @@ -24,7 +24,7 @@ base_url: "developers" self_link: "{{org_id}}/developers/{{email}}" create_url: "{{org_id}}/developers" delete_url: "{{org_id}}/developers/{{email}}" -update_mask: true +update_mask: false immutable: false import_format: - "{{org_id}}/developers/{{email}}" diff --git a/mmv1/third_party/terraform/services/apigee/resource_apigee_developer_update_test.go b/mmv1/third_party/terraform/services/apigee/resource_apigee_developer_update_test.go new file mode 100644 index 000000000000..0f5c19918bdf --- /dev/null +++ b/mmv1/third_party/terraform/services/apigee/resource_apigee_developer_update_test.go @@ -0,0 +1,123 @@ +package apigee_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccApigeeDeveloper_apigeeDeveloperUpdateTest(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "billing_account": envvar.GetTestBillingAccountFromEnv(t), + "org_id": envvar.GetTestOrgFromEnv(t), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckApigeeDeveloperDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccApigeeDeveloper_apigeeDeveloperBasicTestExample(context), + }, + { + ResourceName: "google_apigee_developer.apigee_developer", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"org_id"}, + }, + { + Config: testAccApigeeDeveloper_apigeeDeveloperUpdateTest(context), + }, + { + ResourceName: "google_apigee_developer.apigee_developer", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"org_id"}, + }, + }, + }) +} + +func testAccApigeeDeveloper_apigeeDeveloperUpdateTest(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_project" "project" { + project_id = "tf-test%{random_suffix}" + name = "tf-test%{random_suffix}" + org_id = "%{org_id}" + billing_account = "%{billing_account}" + deletion_policy = "DELETE" +} + +resource "google_project_service" "apigee" { + project = google_project.project.project_id + service = "apigee.googleapis.com" +} + +resource "google_project_service" "compute" { + project = google_project.project.project_id + service = "compute.googleapis.com" +} + +resource "google_project_service" "servicenetworking" { + project = google_project.project.project_id + service = "servicenetworking.googleapis.com" +} + +resource "google_compute_network" "apigee_network" { + name = "apigee-network" + project = google_project.project.project_id + depends_on = [google_project_service.compute] +} + +resource "google_compute_global_address" "apigee_range" { + name = "apigee-range" + purpose = "VPC_PEERING" + address_type = "INTERNAL" + prefix_length = 16 + network = google_compute_network.apigee_network.id + project = google_project.project.project_id +} + +resource "google_service_networking_connection" "apigee_vpc_connection" { + network = google_compute_network.apigee_network.id + service = "servicenetworking.googleapis.com" + reserved_peering_ranges = [google_compute_global_address.apigee_range.name] + depends_on = [google_project_service.servicenetworking] +} + +resource "google_apigee_organization" "apigee_org" { + analytics_region = "us-central1" + project_id = google_project.project.project_id + authorized_network = google_compute_network.apigee_network.id + depends_on = [ + google_service_networking_connection.apigee_vpc_connection, + google_project_service.apigee, + ] +} + +resource "google_apigee_instance" "apigee_instance" { + name = "tf-test%{random_suffix}" + location = "us-central1" + org_id = google_apigee_organization.apigee_org.id + peering_cidr_range = "SLASH_22" +} + +resource "google_apigee_developer" "apigee_developer" { + email = "tf-test%{random_suffix}@acme.com" + first_name = "Yamada" + last_name = "Taro" + user_name = "yamada.taro" + org_id = google_apigee_organization.apigee_org.id + depends_on = [ + google_apigee_instance.apigee_instance + ] +} +`, context) +} From 3fa84e2702fdf07958b347e07726288f50afed84 Mon Sep 17 00:00:00 2001 From: Shuya Ma <87669292+shuyama1@users.noreply.github.com> Date: Tue, 19 Nov 2024 08:54:33 -0800 Subject: [PATCH 36/44] update vacation for shuyama1 (#12349) --- .ci/magician/github/membership_data.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.ci/magician/github/membership_data.go b/.ci/magician/github/membership_data.go index 55735dc86b79..5b0bba634f60 100644 --- a/.ci/magician/github/membership_data.go +++ b/.ci/magician/github/membership_data.go @@ -116,5 +116,10 @@ var ( startDate: newDate(2024, 11, 1, pdtLoc), endDate: newDate(2024, 11, 11, pdtLoc), }, + { + id: "shuyama1", + startDate: newDate(2024, 11, 26, pdtLoc), + endDate: newDate(2024, 12, 4, pdtLoc), + }, } ) From 77315f8f88322e7bc019cc42437b56124448329c Mon Sep 17 00:00:00 2001 From: tulika-aakriti Date: Tue, 19 Nov 2024 22:33:46 +0530 Subject: [PATCH 37/44] Add deletion_protection field in cloudvmcluster resource (#12297) --- .../products/oracledatabase/CloudVmCluster.yaml | 17 +++++++++++++++++ ...oracledatabase_cloud_vmcluster_basic.tf.tmpl | 2 ++ .../oracledatabase_cloud_vmcluster_full.tf.tmpl | 2 ++ .../oracledatabase_cloud_vmcluster.go.tmpl | 3 +++ 4 files changed, 24 insertions(+) create mode 100644 mmv1/templates/terraform/pre_delete/oracledatabase_cloud_vmcluster.go.tmpl diff --git a/mmv1/products/oracledatabase/CloudVmCluster.yaml b/mmv1/products/oracledatabase/CloudVmCluster.yaml index ddc28f039c1e..e61c3e55295c 100644 --- a/mmv1/products/oracledatabase/CloudVmCluster.yaml +++ b/mmv1/products/oracledatabase/CloudVmCluster.yaml @@ -49,6 +49,8 @@ async: error: path: 'error' message: 'message' +custom_code: + pre_delete: 'templates/terraform/pre_delete/oracledatabase_cloud_vmcluster.go.tmpl' examples: - name: 'oracledatabase_cloud_vmcluster_basic' primary_resource_id: 'my_vmcluster' @@ -56,7 +58,11 @@ examples: project: 'my-project' cloud_vm_cluster_id: 'my-instance' cloud_exadata_infrastructure_id: 'my-exadata' + deletion_protection: 'true' + ignore_read_extra: + - 'deletion_protection' test_vars_overrides: + 'deletion_protection': 'false' 'project': '"oci-terraform-testing"' 'cloud_vm_cluster_id': '"ofake-vmcluster-basic"' 'cloud_exadata_infrastructure_id': '"ofake-exadata-for-vm-basic"' @@ -66,10 +72,21 @@ examples: project: 'my-project' cloud_vm_cluster_id: 'my-instance' cloud_exadata_infrastructure_id: 'my-exadata' + deletion_protection: 'true' + ignore_read_extra: + - 'deletion_protection' test_vars_overrides: + 'deletion_protection': 'false' 'project': '"oci-terraform-testing"' 'cloud_vm_cluster_id': '"ofake-vmcluster-full"' 'cloud_exadata_infrastructure_id': '"ofake-exadata-for-vm-full"' +virtual_fields: + - name: 'deletion_protection' + type: Boolean + default_value: true + description: 'Whether or not to allow Terraform to destroy the instance. + Unless this field is set to false in Terraform state, a terraform destroy + or terraform apply that would delete the instance will fail.' parameters: - name: 'location' type: String diff --git a/mmv1/templates/terraform/examples/oracledatabase_cloud_vmcluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/oracledatabase_cloud_vmcluster_basic.tf.tmpl index bef49b1943e8..7ac2edfa9301 100644 --- a/mmv1/templates/terraform/examples/oracledatabase_cloud_vmcluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/oracledatabase_cloud_vmcluster_basic.tf.tmpl @@ -14,6 +14,8 @@ resource "google_oracle_database_cloud_vm_cluster" "{{$.PrimaryResourceId}}"{ gi_version = "19.0.0.0" hostname_prefix = "hostname1" } + + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_oracle_database_cloud_exadata_infrastructure" "cloudExadataInfrastructures"{ diff --git a/mmv1/templates/terraform/examples/oracledatabase_cloud_vmcluster_full.tf.tmpl b/mmv1/templates/terraform/examples/oracledatabase_cloud_vmcluster_full.tf.tmpl index e33babc91b9d..3cfe225f6454 100644 --- a/mmv1/templates/terraform/examples/oracledatabase_cloud_vmcluster_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/oracledatabase_cloud_vmcluster_full.tf.tmpl @@ -35,6 +35,8 @@ resource "google_oracle_database_cloud_vm_cluster" "{{$.PrimaryResourceId}}"{ } memory_size_gb = 60 } + + deletion_protection = "{{index $.Vars "deletion_protection"}}" } resource "google_oracle_database_cloud_exadata_infrastructure" "cloudExadataInfrastructures"{ diff --git a/mmv1/templates/terraform/pre_delete/oracledatabase_cloud_vmcluster.go.tmpl b/mmv1/templates/terraform/pre_delete/oracledatabase_cloud_vmcluster.go.tmpl new file mode 100644 index 000000000000..3e00631873ad --- /dev/null +++ b/mmv1/templates/terraform/pre_delete/oracledatabase_cloud_vmcluster.go.tmpl @@ -0,0 +1,3 @@ +if d.Get("deletion_protection").(bool) { + return fmt.Errorf("cannot destroy google_oracle_database_cloud_vm_cluster resource with id : %q without setting deletion_protection=false and running `terraform apply`", d.Id()) +} From 821357e87c510c090aabc8502fae4190152a5d99 Mon Sep 17 00:00:00 2001 From: skysarthak Date: Tue, 19 Nov 2024 10:03:29 -0800 Subject: [PATCH 38/44] =?UTF-8?q?Fix=20edition=20downgrade=20failure=20for?= =?UTF-8?q?=20an=20ENTERPRISE=5FPLUS=20instance=20with=20da=E2=80=A6=20(#1?= =?UTF-8?q?2289)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sarthak Tandon --- .../services/sql/resource_sql_database_instance.go.tmpl | 1 + .../services/sql/resource_sql_database_instance_test.go | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) 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 1ffe1aed81d5..fee345035643 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 @@ -2024,6 +2024,7 @@ func resourceSqlDatabaseInstanceUpdate(d *schema.ResourceData, meta interface{}) instance.Settings.SettingsVersion = int64(_settings["version"].(int)) // Collation cannot be included in the update request instance.Settings.Collation = "" + instance.Settings.DataCacheConfig = expandDataCacheConfig(_settings["data_cache_config"].([]interface{})) // Lock on the master_instance_name just in case updating any replica // settings causes operations on the master. 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 b1abff5d5f7f..98e1614f4929 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 @@ -1879,7 +1879,6 @@ func TestAccSqlDatabaseInstance_Postgres_Edition_Upgrade(t *testing.T) { } func TestAccSqlDatabaseInstance_Edition_Downgrade(t *testing.T) { - t.Skip("https://github.com/hashicorp/terraform-provider-google/issues/20010") t.Parallel() enterprisePlusTier := "db-perf-optimized-N-2" enterpriseTier := "db-custom-2-13312" From d7777055cb7618648725abd16d3b05e5c138fc56 Mon Sep 17 00:00:00 2001 From: Ahzaz Hingora <5833893+ahzaz@users.noreply.github.com> Date: Wed, 20 Nov 2024 01:19:20 +0530 Subject: [PATCH 39/44] Add ProvisioningModelMix to InstanceFlexibilityPolicy for Dataproc cluster (#12327) --- .../dataproc/resource_dataproc_cluster.go | 63 ++++++++++++++++- .../resource_dataproc_cluster_test.go.tmpl | 67 +++++++++++++++++++ 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster.go b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster.go index e6b7c6e27d1a..288b722f0a35 100644 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster.go +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster.go @@ -1183,6 +1183,7 @@ func ResourceDataprocCluster() *schema.Resource { ForceNew: true, AtLeastOneOf: []string{ "cluster_config.0.preemptible_worker_config.0.instance_flexibility_policy.0.instance_selection_list", + "cluster_config.0.preemptible_worker_config.0.instance_flexibility_policy.0.provisioning_model_mix", }, Description: `List of instance selection options that the group will use when creating new VMs.`, Elem: &schema.Resource{ @@ -1227,6 +1228,36 @@ func ResourceDataprocCluster() *schema.Resource { }, }, }, + "provisioning_model_mix": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + AtLeastOneOf: []string{ + "cluster_config.0.preemptible_worker_config.0.instance_flexibility_policy.0.instance_selection_list", + "cluster_config.0.preemptible_worker_config.0.instance_flexibility_policy.0.provisioning_model_mix", + }, + MaxItems: 1, + Description: `Defines how Dataproc should create VMs with a mixture of provisioning models.`, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "standard_capacity_base": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: `The base capacity that will always use Standard VMs to avoid risk of more preemption than the minimum capacity you need.`, + ValidateFunc: validation.IntAtLeast(0), + }, + + "standard_capacity_percent_above_base": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: `The percentage of target capacity that should use Standard VM. The remaining percentage will use Spot VMs.`, + ValidateFunc: validation.IntBetween(0, 100), + }, + }, + }, + }, }, }, }, @@ -2413,6 +2444,9 @@ func expandPreemptibleInstanceGroupConfig(cfg map[string]interface{}) *dataproc. if v, ok := flexibilityPolicy["instance_selection_list"]; ok { icg.InstanceFlexibilityPolicy.InstanceSelectionList = expandInstanceSelectionList(v) } + if v, ok := flexibilityPolicy["provisioning_model_mix"]; ok { + icg.InstanceFlexibilityPolicy.ProvisioningModelMix = expandProvisioningModelMix(v) + } } } @@ -2444,6 +2478,18 @@ func expandInstanceSelectionList(v interface{}) []*dataproc.InstanceSelection { return instanceSelections } +func expandProvisioningModelMix(v interface{}) *dataproc.ProvisioningModelMix { + pmm := v.([]interface{}) + if len(pmm) > 0 { + provisioningModelMix := pmm[0].(map[string]interface{}) + return &dataproc.ProvisioningModelMix{ + StandardCapacityBase: int64(provisioningModelMix["standard_capacity_base"].(int)), + StandardCapacityPercentAboveBase: int64(provisioningModelMix["standard_capacity_percent_above_base"].(int)), + } + } + return nil +} + func expandMasterInstanceGroupConfig(cfg map[string]interface{}) *dataproc.InstanceGroupConfig { icg := &dataproc.InstanceGroupConfig{} @@ -3184,8 +3230,13 @@ func flattenPreemptibleInstanceGroupConfig(d *schema.ResourceData, icg *dataproc disk["local_ssd_interface"] = icg.DiskConfig.LocalSsdInterface } if icg.InstanceFlexibilityPolicy != nil { - instanceFlexibilityPolicy["instance_selection_list"] = flattenInstanceSelectionList(icg.InstanceFlexibilityPolicy.InstanceSelectionList) - instanceFlexibilityPolicy["instance_selection_results"] = flattenInstanceSelectionResults(icg.InstanceFlexibilityPolicy.InstanceSelectionResults) + if icg.InstanceFlexibilityPolicy.InstanceSelectionList != nil { + instanceFlexibilityPolicy["instance_selection_list"] = flattenInstanceSelectionList(icg.InstanceFlexibilityPolicy.InstanceSelectionList) + instanceFlexibilityPolicy["instance_selection_results"] = flattenInstanceSelectionResults(icg.InstanceFlexibilityPolicy.InstanceSelectionResults) + } + if icg.InstanceFlexibilityPolicy.ProvisioningModelMix != nil { + instanceFlexibilityPolicy["provisioning_model_mix"] = flattenProvisioningModelMix(icg.InstanceFlexibilityPolicy.ProvisioningModelMix) + } } } @@ -3222,6 +3273,14 @@ func flattenInstanceSelectionResults(isr []*dataproc.InstanceSelectionResult) [] } +func flattenProvisioningModelMix(pmm *dataproc.ProvisioningModelMix) []map[string]interface{} { + provisioningModelMix := map[string]interface{}{} + provisioningModelMix["standard_capacity_base"] = pmm.StandardCapacityBase + provisioningModelMix["standard_capacity_percent_above_base"] = pmm.StandardCapacityPercentAboveBase + + return []map[string]interface{}{provisioningModelMix} +} + func flattenMasterInstanceGroupConfig(d *schema.ResourceData, icg *dataproc.InstanceGroupConfig) []map[string]interface{} { disk := map[string]interface{}{} data := map[string]interface{}{} diff --git a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl index 040f08ac4402..2fe9b046a8ba 100644 --- a/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataproc/resource_dataproc_cluster_test.go.tmpl @@ -534,6 +534,29 @@ func TestAccDataprocCluster_spotWithInstanceFlexibilityPolicy(t *testing.T) { }) } +func TestAccDataprocCluster_spotOnDemandMixing(t *testing.T) { + t.Parallel() + + rnd := acctest.RandString(t, 10) + var cluster dataproc.Cluster + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckDataprocClusterDestroy(t), + Steps: []resource.TestStep{ + { + Config: testAccDataprocCluster_spotOnDemandMixing(rnd), + Check: resource.ComposeTestCheckFunc( + testAccCheckDataprocClusterExists(t, "google_dataproc_cluster.spot_mixing", &cluster), + resource.TestCheckResourceAttr("google_dataproc_cluster.spot_mixing", "cluster_config.0.preemptible_worker_config.0.preemptibility", "SPOT"), + resource.TestCheckResourceAttr("google_dataproc_cluster.spot_mixing", "cluster_config.0.preemptible_worker_config.0.instance_flexibility_policy.0.provisioning_model_mix.0.standard_capacity_base", "1"), + resource.TestCheckResourceAttr("google_dataproc_cluster.spot_mixing", "cluster_config.0.preemptible_worker_config.0.instance_flexibility_policy.0.provisioning_model_mix.0.standard_capacity_percent_above_base", "50"), + ), + }, + }, + }) +} + func TestAccDataprocCluster_spotWithAuxiliaryNodeGroups(t *testing.T) { t.Parallel() @@ -1955,6 +1978,50 @@ resource "google_dataproc_cluster" "spot_with_instance_flexibility_policy" { `, rnd) } +func testAccDataprocCluster_spotOnDemandMixing(rnd string) string { + return fmt.Sprintf(` +resource "google_dataproc_cluster" "spot_mixing" { + name = "tf-test-dproc-%s" + region = "us-central1" + + cluster_config { + gce_cluster_config { + internal_ip_only = false + } + master_config { + num_instances = "1" + machine_type = "e2-medium" + disk_config { + boot_disk_size_gb = 35 + } + } + + worker_config { + num_instances = "2" + machine_type = "e2-medium" + disk_config { + boot_disk_size_gb = 35 + } + } + + preemptible_worker_config { + num_instances = "3" + preemptibility = "SPOT" + disk_config { + boot_disk_size_gb = 35 + } + instance_flexibility_policy { + provisioning_model_mix { + standard_capacity_base = 1 + standard_capacity_percent_above_base = 50 + } + } + } + } +} + `, rnd) +} + func testAccDataprocCluster_withAuxiliaryNodeGroups(rnd string) string { return fmt.Sprintf(` resource "google_dataproc_cluster" "with_auxiliary_node_groups" { From c5cee4e16c45a09dd07e2c046b7a5a4ec21f68d7 Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Tue, 19 Nov 2024 13:42:17 -0800 Subject: [PATCH 40/44] Use project name for PSC allowlist (#12303) --- .../examples/vertex_ai_index_endpoint_with_psc.tf.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_psc.tf.tmpl b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_psc.tf.tmpl index 792a18f9e750..37e8995870bf 100644 --- a/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_psc.tf.tmpl +++ b/mmv1/templates/terraform/examples/vertex_ai_index_endpoint_with_psc.tf.tmpl @@ -9,7 +9,7 @@ resource "google_vertex_ai_index_endpoint" "{{$.PrimaryResourceId}}" { private_service_connect_config { enable_private_service_connect = true project_allowlist = [ - data.google_project.project.number, + data.google_project.project.name, ] } } From eb456f7c48191e6c2fbe393a5b7d7fccb1e92ecb Mon Sep 17 00:00:00 2001 From: Brandon Ha <107650670+brandonmichigangithub@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:09:41 -0800 Subject: [PATCH 41/44] Remove unused test case (#12331) --- .../data_source_artifact_registry_docker_image_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image_test.go b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image_test.go index f63f591f7598..9d11c3ed5e36 100644 --- a/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image_test.go +++ b/mmv1/third_party/terraform/services/artifactregistry/data_source_artifact_registry_docker_image_test.go @@ -28,9 +28,6 @@ func TestAccDataSourceArtifactRegistryDockerImage(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName+"Tag", "image_size_bytes"), validateTimeStamps(resourceName+"Tag"), - resource.TestCheckResourceAttrSet(resourceName+"Digest", "image_size_bytes"), - validateTimeStamps(resourceName+"Digest"), - // url safe docker name using a tag checkTaggedDataSources(resourceName+"UrlTag", "latest"), From 4e19bc58baf784584802d222f5b67d242bb7ecd7 Mon Sep 17 00:00:00 2001 From: nomi3 <42667020+nomi3@users.noreply.github.com> Date: Wed, 20 Nov 2024 07:11:13 +0900 Subject: [PATCH 42/44] =?UTF-8?q?Fix=20typo=20in=20documentation:=20?= =?UTF-8?q?=E2=80=9CBackendServiceor=E2=80=9D=20to=20=E2=80=9CBackendServi?= =?UTF-8?q?ce=20or=E2=80=9D=20(#12337)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mmv1/products/compute/UrlMap.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmv1/products/compute/UrlMap.yaml b/mmv1/products/compute/UrlMap.yaml index faf41b8a315a..220e44837ec9 100644 --- a/mmv1/products/compute/UrlMap.yaml +++ b/mmv1/products/compute/UrlMap.yaml @@ -320,7 +320,7 @@ properties: - name: 'defaultCustomErrorResponsePolicy' type: NestedObject description: | - defaultCustomErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. + defaultCustomErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendService or BackendBucket responds with an error. This policy takes effect at the PathMatcher level and applies only when no policy has been defined for the error code at lower levels like RouteRule and PathRule within this PathMatcher. If an error code does not have a policy defined in defaultCustomErrorResponsePolicy, then a policy defined for the error code in UrlMap.defaultCustomErrorResponsePolicy takes effect. @@ -487,7 +487,7 @@ properties: - name: 'customErrorResponsePolicy' type: NestedObject description: | - customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. + customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendService or BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors @@ -2102,7 +2102,7 @@ properties: - name: 'defaultCustomErrorResponsePolicy' type: NestedObject description: | - defaultCustomErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. + defaultCustomErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendService or BackendBucket responds with an error. This policy takes effect at the PathMatcher level and applies only when no policy has been defined for the error code at lower levels like RouteRule and PathRule within this PathMatcher. If an error code does not have a policy defined in defaultCustomErrorResponsePolicy, then a policy defined for the error code in UrlMap.defaultCustomErrorResponsePolicy takes effect. From b311e8aa22c2cf401fc54c12097734c727dc31c1 Mon Sep 17 00:00:00 2001 From: Scott Suarez Date: Tue, 19 Nov 2024 16:01:54 -0800 Subject: [PATCH 43/44] add server-side id for a few resources (#12351) --- mmv1/products/compute/GlobalForwardingRule.yaml | 6 ++++++ mmv1/products/compute/InstanceGroupManager.yaml | 6 ++++++ mmv1/products/compute/RegionHealthCheck.yaml | 6 ++++++ mmv1/products/compute/RegionInstanceGroupManager.yaml | 6 ++++++ mmv1/products/compute/RegionNetworkEndpoint.yaml | 6 ++++++ mmv1/products/compute/Subnetwork.yaml | 6 ++++++ ...source_compute_global_forwarding_rule_test.go.tmpl | 3 ++- .../resource_compute_instance_group_manager.go.tmpl | 11 +++++++++++ ...source_compute_instance_group_manager_test.go.tmpl | 3 +++ .../resource_compute_region_health_check_test.go.tmpl | 4 ++++ ...urce_compute_region_instance_group_manager.go.tmpl | 9 +++++++++ ...compute_region_instance_group_manager_test.go.tmpl | 3 +++ ...ource_compute_region_network_endpoint_test.go.tmpl | 4 ++++ .../compute/resource_compute_subnetwork_test.go.tmpl | 3 ++- 14 files changed, 74 insertions(+), 2 deletions(-) diff --git a/mmv1/products/compute/GlobalForwardingRule.yaml b/mmv1/products/compute/GlobalForwardingRule.yaml index 760bc472528f..8cc0bffb71c3 100644 --- a/mmv1/products/compute/GlobalForwardingRule.yaml +++ b/mmv1/products/compute/GlobalForwardingRule.yaml @@ -215,6 +215,12 @@ properties: description: | An optional description of this resource. Provide this property when you create the resource. + - name: 'forwardingRuleId' + type: Integer + description: | + The unique identifier number for the resource. This identifier is defined by the server. + api_name: id + output: true # This is a multi-resource resource reference (Address, GlobalAddress) - name: 'IPAddress' type: String diff --git a/mmv1/products/compute/InstanceGroupManager.yaml b/mmv1/products/compute/InstanceGroupManager.yaml index ec957fa1924e..814d41abd0e4 100644 --- a/mmv1/products/compute/InstanceGroupManager.yaml +++ b/mmv1/products/compute/InstanceGroupManager.yaml @@ -65,6 +65,12 @@ properties: hyphen and a random four-character string to the base instance name. The base instance name must comply with RFC1035. required: true + - name: 'instanceGroupManagerId' + type: Integer + description: | + The unique identifier number for the resource. This identifier is defined by the server. + api_name: id + output: true - name: 'creationTimestamp' type: Time description: | diff --git a/mmv1/products/compute/RegionHealthCheck.yaml b/mmv1/products/compute/RegionHealthCheck.yaml index 616491ff6558..88adaa7ec03f 100644 --- a/mmv1/products/compute/RegionHealthCheck.yaml +++ b/mmv1/products/compute/RegionHealthCheck.yaml @@ -141,6 +141,12 @@ properties: An optional description of this resource. Provide this property when you create the resource. send_empty_value: true + - name: 'healthCheckId' + type: Integer + description: | + The unique identifier number for the resource. This identifier is defined by the server. + api_name: id + output: true - name: 'healthyThreshold' type: Integer description: | diff --git a/mmv1/products/compute/RegionInstanceGroupManager.yaml b/mmv1/products/compute/RegionInstanceGroupManager.yaml index c80b73a6c148..ac4a36de2c9d 100644 --- a/mmv1/products/compute/RegionInstanceGroupManager.yaml +++ b/mmv1/products/compute/RegionInstanceGroupManager.yaml @@ -64,6 +64,12 @@ properties: hyphen and a random four-character string to the base instance name. The base instance name must comply with RFC1035. required: true + - name: 'instanceGroupManagerId' + type: Integer + description: | + The unique identifier number for the resource. This identifier is defined by the server. + api_name: id + output: true - name: 'creationTimestamp' type: Time description: | diff --git a/mmv1/products/compute/RegionNetworkEndpoint.yaml b/mmv1/products/compute/RegionNetworkEndpoint.yaml index 044805b852bb..94feb20a0368 100644 --- a/mmv1/products/compute/RegionNetworkEndpoint.yaml +++ b/mmv1/products/compute/RegionNetworkEndpoint.yaml @@ -128,6 +128,12 @@ properties: IPv4 address external endpoint. This can only be specified when network_endpoint_type of the NEG is INTERNET_IP_PORT. + - name: 'networkEndpointId' + type: Integer + description: | + The unique identifier number for the resource. This identifier is defined by the server. + api_name: id + output: true - name: 'fqdn' type: String description: | diff --git a/mmv1/products/compute/Subnetwork.yaml b/mmv1/products/compute/Subnetwork.yaml index 0ddddb1e9c02..cb97cf761167 100644 --- a/mmv1/products/compute/Subnetwork.yaml +++ b/mmv1/products/compute/Subnetwork.yaml @@ -153,6 +153,12 @@ properties: An optional description of this resource. Provide this property when you create the resource. This field can be set only at resource creation time. + - name: 'subnetworkId' + type: Integer + description: | + The unique identifier number for the resource. This identifier is defined by the server. + api_name: id + output: true - name: 'gatewayAddress' type: String description: | diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.tmpl index 25002bbfbd70..565f88130f62 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_global_forwarding_rule_test.go.tmpl @@ -30,7 +30,8 @@ func TestAccComputeGlobalForwardingRule_updateTarget(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr( "google_compute_global_forwarding_rule.forwarding_rule", "target", regexp.MustCompile(proxy + "$")), - ), + resource.TestCheckResourceAttrSet( + "google_compute_global_forwarding_rule.forwarding_rule", "forwarding_rule_id")), }, { ResourceName: "google_compute_global_forwarding_rule.forwarding_rule", diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager.go.tmpl index 514c513b9d54..61e911f809b1 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager.go.tmpl @@ -119,6 +119,12 @@ func ResourceComputeInstanceGroupManager() *schema.Resource { Description: `An optional textual description of the instance group manager.`, }, + "instance_group_manager_id": { + Type: schema.TypeInt, + Computed: true, + Description: `The unique identifier number for the resource. This identifier is defined by the server.`, + }, + "fingerprint": { Type: schema.TypeString, Computed: true, @@ -839,6 +845,11 @@ func resourceComputeInstanceGroupManagerRead(d *schema.ResourceData, meta interf if err := d.Set("description", manager.Description); err != nil { return fmt.Errorf("Error setting description: %s", err) } + + if err := d.Set("instance_group_manager_id", manager.Id); err != nil { + return fmt.Errorf("Error setting description: %s", err) + } + if err := d.Set("project", project); err != nil { return fmt.Errorf("Error setting project: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.tmpl index 029ed68659b9..eeb7e45cd581 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_instance_group_manager_test.go.tmpl @@ -27,6 +27,9 @@ func TestAccInstanceGroupManager_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccInstanceGroupManager_basic(template, target, igm1, igm2), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet( + "google_compute_instance_group_manager.igm-no-tp", "instance_group_manager_id")), }, { ResourceName: "google_compute_instance_group_manager.igm-basic", diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_health_check_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_health_check_test.go.tmpl index 74905b822185..a0d12639dd3c 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_health_check_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_health_check_test.go.tmpl @@ -21,6 +21,10 @@ func TestAccComputeRegionHealthCheck_tcp_update(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccComputeRegionHealthCheck_tcp(hckName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet( + "google_compute_region_health_check.foobar", "health_check_id"), + ), }, { ResourceName: "google_compute_region_health_check.foobar", diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl index f6db9cf7f694..a6457ee97b32 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager.go.tmpl @@ -162,6 +162,12 @@ func ResourceComputeRegionInstanceGroupManager() *schema.Resource { Description: `An optional textual description of the instance group manager.`, }, + "instance_group_manager_id": { + Type: schema.TypeInt, + Computed: true, + Description: `The unique identifier number for the resource. This identifier is defined by the server.`, + }, + "fingerprint": { Type: schema.TypeString, Computed: true, @@ -826,6 +832,9 @@ func resourceComputeRegionInstanceGroupManagerRead(d *schema.ResourceData, meta if err := d.Set("description", manager.Description); err != nil { return fmt.Errorf("Error setting description: %s", err) } + if err := d.Set("instance_group_manager_id", manager.Id); err != nil { + return fmt.Errorf("Error setting description: %s", err) + } if err := d.Set("project", project); err != nil { return fmt.Errorf("Error setting project: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.tmpl index 9f6738d1790e..7df6c05380d5 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_instance_group_manager_test.go.tmpl @@ -28,6 +28,9 @@ func TestAccRegionInstanceGroupManager_basic(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccRegionInstanceGroupManager_basic(template, target, igm1, igm2), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet( + "google_compute_region_instance_group_manager.igm-basic", "instance_group_manager_id")), }, { ResourceName: "google_compute_region_instance_group_manager.igm-basic", diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_region_network_endpoint_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_region_network_endpoint_test.go.tmpl index b9bfd4189e10..9e0f4988ec75 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_region_network_endpoint_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_region_network_endpoint_test.go.tmpl @@ -31,6 +31,10 @@ func TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointBasic(t *testing.T { // Create one endpoint Config: testAccComputeRegionNetworkEndpoint_regionNetworkEndpointBasic(context), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet( + "google_compute_region_network_endpoint.default", "network_endpoint_id"), + ), }, { ResourceName: "google_compute_region_network_endpoint.default", diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_subnetwork_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_subnetwork_test.go.tmpl index 2f298fdbc6ec..f9500747ee46 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_subnetwork_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_subnetwork_test.go.tmpl @@ -78,7 +78,8 @@ func TestAccComputeSubnetwork_basic(t *testing.T) { t, "google_compute_subnetwork.network-ref-by-url", &subnetwork1), testAccCheckComputeSubnetworkExists( t, "google_compute_subnetwork.network-ref-by-name", &subnetwork2), - ), + resource.TestCheckResourceAttrSet( + "google_compute_subnetwork.network-ref-by-name", "subnetwork_id"), ), }, { ResourceName: "google_compute_subnetwork.network-ref-by-url", From 727c6c279f274b2668f6954604d36c6e7a2a6102 Mon Sep 17 00:00:00 2001 From: nityaravi <32396647+nityaravi@users.noreply.github.com> Date: Tue, 19 Nov 2024 19:03:10 -0500 Subject: [PATCH 44/44] Updategenproviders (#12350) Co-authored-by: Stephen Lewis (Burrows) --- docs/content/_index.md | 2 +- docs/content/contribution-process.md | 5 +- .../develop/add-handwritten-datasource.md | 4 +- docs/content/develop/custom-code.md | 4 +- docs/content/develop/diffs.md | 2 +- docs/content/develop/generate-providers.md | 96 +++++++++ docs/content/develop/promote-to-ga.md | 4 +- docs/content/develop/resource.md | 12 +- .../content/develop/set-up-dev-environment.md | 77 +++++++ docs/content/develop/test/run-tests.md | 4 +- docs/content/develop/test/test.md | 6 +- docs/content/develop/update-dependencies.md | 2 +- docs/content/get-started/_index.md | 4 - .../content/get-started/generate-providers.md | 197 ------------------ 14 files changed, 196 insertions(+), 223 deletions(-) create mode 100644 docs/content/develop/generate-providers.md create mode 100644 docs/content/develop/set-up-dev-environment.md delete mode 100644 docs/content/get-started/_index.md delete mode 100644 docs/content/get-started/generate-providers.md diff --git a/docs/content/_index.md b/docs/content/_index.md index ef60d84e8dc7..f85822683a53 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -1,6 +1,6 @@ --- title: "Overview" -weight: 20 +weight: 10 aliases: - /docs/how-to/types-of-resources - /how-to/types-of-resources diff --git a/docs/content/contribution-process.md b/docs/content/contribution-process.md index 89ff42a68ed0..5cff76fdbb2d 100644 --- a/docs/content/contribution-process.md +++ b/docs/content/contribution-process.md @@ -1,6 +1,6 @@ --- title: "Contribution process" -weight: 9 +weight: 11 aliases: - /docs/getting-started/contributing - /getting-started/contributing @@ -22,6 +22,7 @@ This page explains how you can contribute code and documentation to the `magic-m ## Contribute code +1. [Set up your development environment]({{< ref "/develop/set-up-dev-environment" >}}) 1. [Create a new branch for your change](https://docs.github.com/en/get-started/quickstart/github-flow#create-a-branch) 1. Make the code change. For example: - [Add or modify a resource]({{< ref "/develop/resource" >}}) @@ -29,7 +30,7 @@ This page explains how you can contribute code and documentation to the `magic-m - [Add a datasource]({{< ref "/develop/add-handwritten-datasource" >}}) - [Promote to GA]({{< ref "/develop/promote-to-ga" >}}) - [Make a breaking change]({{< ref "/develop/breaking-changes/make-a-breaking-change" >}}) -1. [Generate the providers]({{< ref "/get-started/generate-providers" >}}) that include your change. +1. [Generate the providers]({{< ref "/develop/generate-providers" >}}) that include your change. 1. [Run provider tests locally]({{< ref "/develop/test/run-tests" >}}) that are relevant to the change you made 1. [Create a pull request (PR)]({{< ref "/contribute/create-pr" >}}) 1. Make changes in response to [code review]({{< ref "/contribute/create-pr#code-review" >}}) diff --git a/docs/content/develop/add-handwritten-datasource.md b/docs/content/develop/add-handwritten-datasource.md index 2bc5800a50f4..c25081f5ebf3 100644 --- a/docs/content/develop/add-handwritten-datasource.md +++ b/docs/content/develop/add-handwritten-datasource.md @@ -1,7 +1,7 @@ --- title: "Add a datasource" summary: "Datasources are like terraform resources except they don't *create* anything." -weight: 40 +weight: 14 aliases: - /docs/how-to/add-handwritten-datasource - /how-to/add-handwritten-datasource @@ -52,5 +52,5 @@ 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" >}}). -4. [Generate the providers]({{< ref "/get-started/generate-providers.md" >}}) +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/custom-code.md b/docs/content/develop/custom-code.md index c5ae9dea9996..298e59b66cb2 100644 --- a/docs/content/develop/custom-code.md +++ b/docs/content/develop/custom-code.md @@ -1,6 +1,6 @@ --- title: "Add custom resource code" -weight: 39 +weight: 15 --- # Add custom resource code @@ -17,7 +17,7 @@ custom_code: By convention, the template files are stored in a directory matching the type of custom code, and the name of the file includes the resource (and, if relevant, field) impacted by the custom code. Like handwritten resource and test code, custom code is written as go templates which render go code. -When in doubt about the behavior of custom code, write the custom code, [generate the providers]({{< ref "/get-started/generate-providers" >}}), and inspect what changed in the providers using `git diff`. +When in doubt about the behavior of custom code, write the custom code, [generate the providers]({{< ref "/develop/generate-providers" >}}), and inspect what changed in the providers using `git diff`. The following sections describe types of custom code in more detail. diff --git a/docs/content/develop/diffs.md b/docs/content/develop/diffs.md index 55d9c6e68b8f..a8785972636b 100644 --- a/docs/content/develop/diffs.md +++ b/docs/content/develop/diffs.md @@ -1,6 +1,6 @@ --- title: "Fix diffs" -weight: 60 +weight: 18 aliases: - /develop/permadiff --- diff --git a/docs/content/develop/generate-providers.md b/docs/content/develop/generate-providers.md new file mode 100644 index 000000000000..c581b8099feb --- /dev/null +++ b/docs/content/develop/generate-providers.md @@ -0,0 +1,96 @@ +--- +title: "Generate the providers" +weight: 19 +aliases: + - /docs/getting-started/setup + - /getting-started/setup + - /docs/getting-started/generate-providers + - /getting-started/generate-providers + - /get-started/generate-providers +--- + +# Generate `google` and `google-beta` providers + +After making a change to the Terraform providers for Google Cloud, you must +integrate your changes with the providers. This page explains how to generate +provider changes to the `google` and `google-beta` Terraform providers. + +## Before you begin + +1. [Set up your development environment]({{< ref "/develop/set-up-dev-environment" >}}). +1. Update `magic-modules` as needed. These updates could be any of the following changes: + + [Adding or modifying a resource]({{< ref "/develop/resource" >}}). + + [Adding a datasource]({{< ref "/develop/add-handwritten-datasource" >}}). + + [Adding custom resource code]({{< ref "/develop/custom-code" >}}). + + [Promoting a resource to GA]({{< ref "/develop/promote-to-ga" >}}). + +## Generate a provider change + +1. Clone the `google` and `google-beta` provider repositories with the following commands: + + ```bash + git clone https://github.com/hashicorp/terraform-provider-google.git $GOPATH/src/github.com/hashicorp/terraform-provider-google + git clone https://github.com/hashicorp/terraform-provider-google-beta.git $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta + ``` +1. Generate changes for the `google` provider: + ```bash + make provider VERSION=ga OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google" PRODUCT=[PRODUCT_NAME] + ``` + Where `[PRODUCT_NAME]` is one of the folder names in + https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products. + + For example, if your product is `bigqueryanalyticshub`, the command would be + the following: + + ```bash + make provider VERSION=ga OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google" PRODUCT=bigqueryanalyticshub + ``` + +1. Generate changes for the `google-beta` provider: + ```bash + make provider VERSION=beta OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google-beta" PRODUCT=[PRODUCT_NAME] + ``` + + Where `[PRODUCT_NAME]` is one of the folder names in https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products. + + For example, if your product name is `bigqueryanalyticshub`, the command would be the following: + + ```bash + make provider VERSION=beta OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google-beta" PRODUCT=bigqueryanalyticshub + ``` + +1. Confirm that the expected changes were generated: + ```bash + cd $GOPATH/src/github.com/hashicorp/terraform-provider-google + git diff -U0 + cd $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta + git diff -U0 + ``` + + + {{< hint info >}} + **Note**: There may be additional changes present due to specifying a + `PRODUCT=` value or due to the `magic-modules` repository being out of sync + with the provider repositories. + {{< /hint >}} + + +## Troubleshoot + +### Too many open files {#too-many-open-files} + +If you are getting “Too many open files” ulimit needs to be raised. + +{{< tabs "ulimit" >}} +{{< tab "Mac OS" >}} +```bash +ulimit -n 8192 +``` +{{< /tab >}} +{{< /tabs >}} + +## What's next + ++ [Learn how to add resource tests]({{< ref "/develop/test/test" >}}) ++ [Learn how to run tests]({{< ref "/develop/test/run-tests" >}}) ++ [Learn about `make` commands]({{< ref "/reference/make-commands" >}}) \ No newline at end of file diff --git a/docs/content/develop/promote-to-ga.md b/docs/content/develop/promote-to-ga.md index c03bcefcc83f..dbc9ac29b644 100644 --- a/docs/content/develop/promote-to-ga.md +++ b/docs/content/develop/promote-to-ga.md @@ -1,6 +1,6 @@ --- title: "Promote to GA" -weight: 50 +weight: 16 --- # Promote from beta to GA @@ -13,7 +13,7 @@ For more information about types of resources and the generation process overall ## Before you begin -1. Complete the [Generate the providers]({{< ref "/get-started/generate-providers" >}}) quickstart to set up your environment and your Google Cloud project. +1. Complete the steps in [Set up your development environment]({{< ref "/develop/set-up-dev-environment" >}}) to set up your environment and your Google Cloud project. 2. Ensure that your `magic-modules`, `terraform-provider-google`, and `terraform-provider-google-beta` repositories are up to date. ``` cd ~/magic-modules diff --git a/docs/content/develop/resource.md b/docs/content/develop/resource.md index 1e1e8107e2f4..e66cd8b75f18 100644 --- a/docs/content/develop/resource.md +++ b/docs/content/develop/resource.md @@ -1,6 +1,6 @@ --- title: "Add or modify a resource" -weight: 30 +weight: 13 aliases: - /docs/how-to/add-mmv1-resource - /how-to/add-mmv1-resource @@ -31,7 +31,7 @@ For more information about types of resources and the generation process overall ## Before you begin -1. Complete the steps in [Generate the providers]({{< ref "/get-started/generate-providers" >}}) to set up your environment and your Google Cloud project. +1. Complete the steps in [Set up your development environment]({{< ref "/develop/set-up-dev-environment" >}}) to set up your environment and your Google Cloud project. 2. Ensure that your `magic-modules`, `terraform-provider-google`, and `terraform-provider-google-beta` repositories are up to date. ``` cd ~/magic-modules @@ -151,7 +151,7 @@ For more information about types of resources and the generation process overall > **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. 1. Add the resource in MMv1. -2. [Generate the beta provider]({{< ref "/get-started/generate-providers.md" >}}) +2. [Generate the beta provider]({{< ref "/develop/generate-providers.md" >}}) 3. From the beta provider, copy the files generated for the resource to the following locations: - Resource: Copy to the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) - Documentation: [`magic-modules/mmv1/third_party/terraform/website/docs/r`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) @@ -420,7 +420,7 @@ iam_policy: ### Convert to handwritten (not usually necessary) -1. [Generate the beta provider]({{< ref "/get-started/generate-providers.md" >}}) +1. [Generate the beta provider]({{< ref "/develop/generate-providers.md" >}}) 2. From the beta provider, copy the files generated for the IAM resources to the following locations: - Resource: Copy to the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) - Documentation: [`magic-modules/mmv1/third_party/terraform/website/docs/r`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/website/docs/r) @@ -442,7 +442,7 @@ iam_policy: {{< tab "MMv1" >}} Documentation is autogenerated based on the resource and field configurations. To preview the documentation: -1. [Generate the providers]({{< ref "/get-started/generate-providers.md" >}}) +1. [Generate the providers]({{< ref "/develop/generate-providers.md" >}}) 2. 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 >}} {{< tab "Handwritten" >}} @@ -451,7 +451,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" >}}). -3. [Generate the providers]({{< ref "/get-started/generate-providers.md" >}}) +3. [Generate the providers]({{< ref "/develop/generate-providers.md" >}}) 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 >}} {{< /tabs >}} diff --git a/docs/content/develop/set-up-dev-environment.md b/docs/content/develop/set-up-dev-environment.md new file mode 100644 index 000000000000..f325c1865b50 --- /dev/null +++ b/docs/content/develop/set-up-dev-environment.md @@ -0,0 +1,77 @@ +--- +title: "Set up your development environment" +weight: 12 +--- + +# Set up your development environment + +Before you start adding or updating a Terraform resource using +[magic-modules]({{< ref "/" >}}), you must first set up your environment by +installing the necessary tools. This page explains the steps for setting up your +development environment. + +1. [Install the gcloud CLI.](https://cloud.google.com/sdk/docs/install) +1. In the Google Cloud console, on the project selector page, select or + [create a Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + {{< hint info >}} + + **Note:** If you don't already have a project to use for testing changes to + the Terraform providers, create a project instead of selecting an existing + poject. After you finish these steps, you can delete the project, removing + all resources associated with the project. + + {{< /hint >}} + {{< button href="https://console.cloud.google.com/projectselector2/home/dashboard" >}}Go to project selector{{< /button >}} +1. Make sure that billing is enabled for your Google Cloud project. Learn how to + [check if billing is enabled on a project](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled). + + +1. [Install git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) +1. [Install go](https://go.dev/doc/install) +1. Add the following values to your environment settings such as `.bashrc`: + ```bash + # Add GOPATH variable for convenience + export GOPATH=$(go env GOPATH) + # Add Go binaries to PATH + export PATH=$PATH:$(go env GOPATH)/bin + ``` +1. Install goimports + ```bash + go install golang.org/x/tools/cmd/goimports@latest + ``` +1. [Install terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) +1. Clone the `magic-modules` repository + ```bash + cd ~ + git clone https://github.com/GoogleCloudPlatform/magic-modules.git + ``` + +1. Run the following command from the root of your cloned `magic-modules` repository. + + ```bash + cd magic-modules + ./scripts/doctor + ``` + + Expected output if everything is installed properly: + + ``` + Check for go in path... + found! + Check for goimports in path... + found! + Check for git in path... + found! + Check for terraform in path... + found! + Check for make in path... + found! + ``` + +## What's next + ++ [Learn how to add or modify a resource]({{< ref "/develop/resource" >}}) ++ [Learn how to add custom resource code]({{< ref "/develop/custom-code" >}}) ++ [Learn how to add a datasource]({{< ref "/develop/add-handwritten-datasource" >}}) ++ [Learn how to promote a resource to GA]({{< ref "/develop/promote-to-ga" >}}) + diff --git a/docs/content/develop/test/run-tests.md b/docs/content/develop/test/run-tests.md index 85ec7e63685e..a75f38f81151 100644 --- a/docs/content/develop/test/run-tests.md +++ b/docs/content/develop/test/run-tests.md @@ -15,7 +15,7 @@ aliases: ## Before you begin -[Generate the modified provider(s)]({{< ref "/get-started/generate-providers" >}}) +[Generate the modified provider(s)]({{< ref "/develop/generate-providers" >}}) 1. Set up application default credentials for Terraform @@ -243,7 +243,7 @@ Configure Terraform to use locally-built binaries for `google` and `google-beta` ### Run manual tests -1. [Generate the provider(s) you want to test]({{< ref "/get-started/generate-providers" >}}) +1. [Generate the provider(s) you want to test]({{< ref "/develop/generate-providers" >}}) 2. Build the provider(s) you want to test ```bash diff --git a/docs/content/develop/test/test.md b/docs/content/develop/test/test.md index d6e55784cf1b..3e77aa9f5b7a 100644 --- a/docs/content/develop/test/test.md +++ b/docs/content/develop/test/test.md @@ -100,7 +100,7 @@ This section assumes you've used the [Add a resource]({{< ref "/develop/resource > **Note:** If not, you can create one now, or skip this guide and construct the test by hand. Writing tests by hand can sometimes be a better option if there is a similar test you can copy from. 1. Add the test in MMv1. Repeat for all the create tests you will need. -2. [Generate the beta provider]({{< ref "/get-started/generate-providers.md" >}}). +2. [Generate the beta provider]({{< ref "/develop/generate-providers.md" >}}). 3. From the beta provider, copy and paste the generated `*_generated_test.go` file into the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services/) as a new file call `*_test.go`. 4. Modify the tests as needed. - Replace all occurrences of `github.com/hashicorp/terraform-provider-google-beta/google-beta` with `github.com/hashicorp/terraform-provider-google/google` @@ -120,7 +120,7 @@ An update test is a test that creates the target resource and then makes updates {{< tabs "update" >}} {{< tab "MMv1" >}} -1. [Generate the beta provider]({{< ref "/get-started/generate-providers.md" >}}). +1. [Generate the beta provider]({{< ref "/develop/generate-providers" >}}). 2. From the beta provider, copy and paste the generated `*_generated_test.go` file into the appropriate service folder inside [`magic-modules/mmv1/third_party/terraform/services`](https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services) as a new file call `*_test.go`. 3. Using an editor of your choice, delete the `*DestroyProducer` function, and all but one test. The remaining test should be the "full" test, or if there is no "full" test, the "basic" test. This will be the starting point for your new update test. 4. Modify the `TestAcc*` *test function* to support updates. @@ -274,4 +274,4 @@ func TestSignatureAlgorithmDiffSuppress(t *testing.T) { ## What's next? -- [Run your tests]({{< ref "/develop/test/run-tests.md" >}}) +- [Run your tests]({{< ref "/develop/test/run-tests" >}}) diff --git a/docs/content/develop/update-dependencies.md b/docs/content/develop/update-dependencies.md index cca8822406bf..b50d31b5afe2 100644 --- a/docs/content/develop/update-dependencies.md +++ b/docs/content/develop/update-dependencies.md @@ -1,6 +1,6 @@ --- title: "Update dependencies" -weight: 300 +weight: 17 aliases: - /docs/update-dependencies --- diff --git a/docs/content/get-started/_index.md b/docs/content/get-started/_index.md deleted file mode 100644 index 3fad30cd2d2c..000000000000 --- a/docs/content/get-started/_index.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: "Get started" -weight: 10 ---- \ No newline at end of file diff --git a/docs/content/get-started/generate-providers.md b/docs/content/get-started/generate-providers.md deleted file mode 100644 index eaf0e1ae109e..000000000000 --- a/docs/content/get-started/generate-providers.md +++ /dev/null @@ -1,197 +0,0 @@ ---- -title: "Generate the providers" -weight: 10 -aliases: - - /docs/getting-started/setup - - /getting-started/setup - - /docs/getting-started/generate-providers - - /getting-started/generate-providers ---- - - -# Generate `google` and `google-beta` providers - -This quickstart guides you through setting up your development environment, making a change to `magic-modules`, generating provider changes to the `google` and `google-beta` Terraform providers, and running tests related to the change. - -## Before you begin - -1. [Install the gcloud CLI.](https://cloud.google.com/sdk/docs/install) -1. In the Google Cloud console, on the project selector page, select or [create a Google Cloud project](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - {{< hint info >}} - **Note:** If you don't already have a project to use for testing changes to the Terraform providers, create a project instead of selecting an existing poject. After you finish these steps, you can delete the project, removing all resources associated with the project. - {{< /hint >}} - {{< button href="https://console.cloud.google.com/projectselector2/home/dashboard" >}}Go to project selector{{< /button >}} -1. Make sure that billing is enabled for your Google Cloud project. Learn how to [check if billing is enabled on a project](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled). - -## Set up your development environment - -{{< hint warning >}} -If you are familiar with Docker or Podman, you may want to use the experimental [container-based environment]({{< ref "/reference/make-commands.md#container-based-environment" >}}) instead of this section. -{{< /hint >}} - -1. [Install git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) -1. [Install go](https://go.dev/doc/install) -1. Add the following values to your environment settings such as `.bashrc`: - ```bash - # Add GOPATH variable for convenience - export GOPATH=$(go env GOPATH) - # Add Go binaries to PATH - export PATH=$PATH:$(go env GOPATH)/bin - ``` -1. Install goimports - ```bash - go install golang.org/x/tools/cmd/goimports@latest - ``` -1. [Install terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) -1. Clone the `magic-modules` repository - ```bash - cd ~ - git clone https://github.com/GoogleCloudPlatform/magic-modules.git - ``` -1. Run the following command from the root of your cloned `magic-modules` repository. - - ```bash - cd magic-modules - ./scripts/doctor - ``` - - Expected output if everything is installed properly: - - ``` - Check for go in path... - found! - Check for goimports in path... - found! - Check for git in path... - found! - Check for terraform in path... - found! - Check for make in path... - found! - ``` - -## Generate a provider change - -1. In your cloned magic-modules repository, edit `mmv1/products/bigqueryanalyticshub/DataExchange.yaml` to change the description for the `displayName` field: - ```yaml - - name: 'displayName' - type: NestedObject - description: | - UPDATED_DESCRIPTION - properties: - [] - ``` -1. Clone the `google` and `google-beta` provider repositories with the following commands: - - ```bash - git clone https://github.com/hashicorp/terraform-provider-google.git $GOPATH/src/github.com/hashicorp/terraform-provider-google - git clone https://github.com/hashicorp/terraform-provider-google-beta.git $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta - ``` -1. Generate changes for the `google` provider - ```bash - make provider VERSION=ga OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google" PRODUCT=bigqueryanalyticshub - ``` -1. Generate changes for the `google-beta` provider - ```bash - make provider VERSION=beta OUTPUT_PATH="$GOPATH/src/github.com/hashicorp/terraform-provider-google-beta" PRODUCT=bigqueryanalyticshub - ``` -1. Confirm that the expected changes were generated - ```bash - cd $GOPATH/src/github.com/hashicorp/terraform-provider-google - git diff -U0 - cd $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta - git diff -U0 - ``` - - In both cases, the changes should include: - - ```diff - diff --git a/google/services/bigqueryanalyticshub/resource_bigquery_analytics_hudiff --git a/google/services/bigqueryanalyticshub/resource_bigquery_analytics_hub_data_exchange.go b/google/services/bigqueryanalyticshub/resource_bigquery_analytics_hub_data_exchange.go - --- a/google/services/bigqueryanalyticshub/resource_bigquery_analytics_hub_data_exchange.go - +++ b/google/services/bigqueryanalyticshub/resource_bigquery_analytics_hub_data_exchange.go - @@ -66 +66 @@ func ResourceBigqueryAnalyticsHubDataExchange() *schema.Resource { - - Description: `Human-readable display name of the data exchange. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), and must not start or end with spaces.`, - + Description: `UPDATED_DESCRIPTION`, - diff --git a/website/docs/r/bigquery_analytics_hub_data_exchange.html.markdown b/website/docs/r/bigquery_analytics_hub_data_exchange.html.markdown - --- a/website/docs/r/bigquery_analytics_hub_data_exchange.html.markdown - +++ b/website/docs/r/bigquery_analytics_hub_data_exchange.html.markdown - @@ -63 +63 @@ The following arguments are supported: - - Human-readable display name of the data exchange. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), and must not start or end with spaces. - + UPDATED_DESCRIPTION - ``` - - {{< hint info >}} - **Note**: There may be additional changes present due to specifying a `PRODUCT=` value or due to the `magic-modules` repository being out of sync with the provider repositories. This is okay as long as tests in the following section pass. - {{< /hint >}} - - -## Test changes - -1. Set up application default credentials for Terraform - ```bash - gcloud auth application-default login - export GOOGLE_USE_DEFAULT_CREDENTIALS=true - ``` -1. Set required environment variables - ```bash - export GOOGLE_PROJECT=PROJECT_ID - export GOOGLE_REGION=us-central1 - export GOOGLE_ZONE=us-central1-a - ``` - Replace `PROJECT_ID` with the ID of your Google Cloud project. - -1. Enable required APIs - ```bash - gcloud config set project $GOOGLE_PROJECT - gcloud services enable analyticshub.googleapis.com - ``` -1. Run all linters - ```bash - cd $GOPATH/src/github.com/hashicorp/terraform-provider-google - make lint - cd $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta - make lint - ``` -1. Run all unit tests - ```bash - cd $GOPATH/src/github.com/hashicorp/terraform-provider-google - make test - cd $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta - make test - ``` -1. Run acceptance tests for BigqueryAnalyticsHub DataExchange - - ```bash - cd $GOPATH/src/github.com/hashicorp/terraform-provider-google - make testacc TEST=./google/services/bigqueryanalyticshub TESTARGS='-run=TestAccBigqueryAnalyticsHubDataExchange_' - cd $GOPATH/src/github.com/hashicorp/terraform-provider-google-beta - make testacc TEST=./google-beta/services/bigqueryanalyticshub TESTARGS='-run=TestAccBigqueryAnalyticsHubDataExchange_' - ``` - -## Troubleshoot - -### Too many open files {#too-many-open-files} - -If you are getting “Too many open files” ulimit needs to be raised. - -{{< tabs "ulimit" >}} -{{< tab "Mac OS" >}} -```bash -ulimit -n 8192 -``` -{{< /tab >}} -{{< /tabs >}} - -## Cleanup - -1. Optional: Revoke credentials from the gcloud CLI. - -```bash -gcloud auth revoke -``` - -## What's next - -- [Learn about Magic Modules]({{< ref "/" >}}) -- [Learn about the contribution process]({{< ref "/contribution-process.md" >}}) -- [Learn about make commands]({{< ref "/reference/make-commands.md" >}}) \ No newline at end of file