diff --git a/products/compute/api.yaml b/products/compute/api.yaml index e0693626a79a..597e3543a49c 100644 --- a/products/compute/api.yaml +++ b/products/compute/api.yaml @@ -2717,16 +2717,6 @@ objects: description: | A BackendService to receive the matched traffic. This is used only for INTERNAL load balancing. - - !ruby/object:Api::Type::Enum - name: 'ipVersion' - deprecation_message: >- - ipVersion is not used for regional forwarding rules. Please remove - this field if you are using it. - description: | - ipVersion is not a valid field for regional forwarding rules. - values: - - :IPV4 - - :IPV6 - !ruby/object:Api::Type::Enum name: 'loadBalancingScheme' description: | @@ -5933,25 +5923,6 @@ objects: name: 'id' description: 'The unique identifier for the resource.' output: true - - !ruby/object:Api::Type::String - name: 'ipv4_range' - # We override this in api.yaml so that the name is more aesthetic - api_name: 'IPv4Range' - deprecation_message: >- - Legacy Networks are deprecated and you will no longer be able to - create them using this field from Feb 1, 2020 onwards. - input: true - conflicts: - - autoCreateSubnetworks - description: | - If this field is specified, a deprecated legacy network is created. - You will no longer be able to create a legacy network on Feb 1, 2020. - See the [legacy network docs](https://cloud.google.com/vpc/docs/legacy) - for more details. - - The range of internal addresses that are legal on this legacy network. - This range is a CIDR specification, for example: `192.168.0.0/16`. - The resource must be recreated to modify this field. - !ruby/object:Api::Type::String name: 'name' description: | diff --git a/products/compute/terraform.yaml b/products/compute/terraform.yaml index 3315d804ecc5..4818b61394b1 100644 --- a/products/compute/terraform.yaml +++ b/products/compute/terraform.yaml @@ -525,6 +525,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides network_name: "website-net" custom_code: !ruby/object:Provider::Terraform::CustomCode post_create: templates/terraform/post_create/labels.erb + extra_schema_entry: templates/terraform/extra_schema_entry/forwarding_rule.erb properties: id: !ruby/object:Overrides::Terraform::PropertyOverride exclude: true @@ -923,9 +924,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides default_value: True # autoCreateSubnetworks defaults to true, so we need to disable it explicitly conflicts: [] - ipv4_range: !ruby/object:Overrides::Terraform::PropertyOverride - # autoCreateSubnetworks defaults to true, so we need to disable it explicitly - conflicts: [] routingConfig: !ruby/object:Overrides::Terraform::PropertyOverride flatten_object: true routingConfig.routingMode: !ruby/object:Overrides::Terraform::PropertyOverride @@ -939,6 +937,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides default_from_api: true custom_code: !ruby/object:Provider::Terraform::CustomCode post_create: templates/terraform/post_create/compute_network_delete_default_route.erb + extra_schema_entry: templates/terraform/extra_schema_entry/network.erb encoder: templates/terraform/encoders/network.erb NetworkEndpoint: !ruby/object:Overrides::Terraform::ResourceOverride id_format: "{{project}}/{{zone}}/{{network_endpoint_group}}/{{instance}}/{{ip_address}}/{{port}}" diff --git a/products/monitoring/terraform.yaml b/products/monitoring/terraform.yaml index b00fda5757ca..8b1ee7d0f70d 100644 --- a/products/monitoring/terraform.yaml +++ b/products/monitoring/terraform.yaml @@ -101,7 +101,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides group_display_name: "uptime-check-group" custom_code: !ruby/object:Provider::Terraform::CustomCode custom_import: templates/terraform/custom_import/self_link_as_name.erb - decoder: 'templates/terraform/decoders/monitoring_uptime_check_internal.go.erb' extra_schema_entry: 'templates/terraform/extra_schema_entry/monitoring_uptime_check_config_internal.go.erb' post_create: templates/terraform/post_create/set_computed_name.erb properties: diff --git a/templates/terraform/decoders/monitoring_uptime_check_internal.go.erb b/templates/terraform/decoders/monitoring_uptime_check_internal.go.erb deleted file mode 100644 index b09250fa6843..000000000000 --- a/templates/terraform/decoders/monitoring_uptime_check_internal.go.erb +++ /dev/null @@ -1,2 +0,0 @@ -d.Set("internal_checkers", nil) -return res, nil diff --git a/templates/terraform/extra_schema_entry/alert_policy.erb b/templates/terraform/extra_schema_entry/alert_policy.erb index 241f6e1f319e..d1577a79b0e0 100644 --- a/templates/terraform/extra_schema_entry/alert_policy.erb +++ b/templates/terraform/extra_schema_entry/alert_policy.erb @@ -18,5 +18,5 @@ Elem: &schema.Schema{ Type: schema.TypeString, }, - Deprecated: "labels is removed as it was never used. See user_labels for the correct field", + Removed: "labels is removed as it was never used. See user_labels for the correct field", }, \ No newline at end of file diff --git a/templates/terraform/extra_schema_entry/forwarding_rule.erb b/templates/terraform/extra_schema_entry/forwarding_rule.erb new file mode 100644 index 000000000000..41a7a0dbe9ef --- /dev/null +++ b/templates/terraform/extra_schema_entry/forwarding_rule.erb @@ -0,0 +1,19 @@ +<%# The license inside this block applies to this file. + # Copyright 2019 Google Inc. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-%> +"ip_version": { + Type: schema.TypeString, + Optional: true, + Removed: "ipVersion is not used for regional forwarding rules. Please remove this field if you are using it.", +}, \ No newline at end of file diff --git a/templates/terraform/extra_schema_entry/monitoring_uptime_check_config_internal.go.erb b/templates/terraform/extra_schema_entry/monitoring_uptime_check_config_internal.go.erb index bf9b2f82a26d..3132ebe20e70 100644 --- a/templates/terraform/extra_schema_entry/monitoring_uptime_check_config_internal.go.erb +++ b/templates/terraform/extra_schema_entry/monitoring_uptime_check_config_internal.go.erb @@ -15,40 +15,38 @@ "is_internal": { Type: schema.TypeBool, Optional: true, - Computed: true, - Deprecated: "This field never worked, and will be removed in 3.0.0.", + Removed: "This field never worked, and will be removed in 3.0.0.", }, "internal_checkers": { Type: schema.TypeList, Optional: true, - Computed: true, - Deprecated: "This field never worked, and will be removed in 3.0.0.", + Removed: "This field never worked, and will be removed in 3.0.0.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "display_name": { Type: schema.TypeString, Optional: true, - Deprecated: "This field never worked, and will be removed in 3.0.0.", + Removed: "This field never worked, and will be removed in 3.0.0.", }, "gcp_zone": { Type: schema.TypeString, Optional: true, - Deprecated: "This field never worked, and will be removed in 3.0.0.", + Removed: "This field never worked, and will be removed in 3.0.0.", }, "name": { Type: schema.TypeString, Optional: true, - Deprecated: "This field never worked, and will be removed in 3.0.0.", + Removed: "This field never worked, and will be removed in 3.0.0.", }, "network": { Type: schema.TypeString, Optional: true, - Deprecated: "This field never worked, and will be removed in 3.0.0.", + Removed: "This field never worked, and will be removed in 3.0.0.", }, "peer_project_id": { Type: schema.TypeString, Optional: true, - Deprecated: "This field never worked, and will be removed in 3.0.0.", + Removed: "This field never worked, and will be removed in 3.0.0.", }, }, }, diff --git a/templates/terraform/extra_schema_entry/network.erb b/templates/terraform/extra_schema_entry/network.erb new file mode 100644 index 000000000000..b69aa20b0079 --- /dev/null +++ b/templates/terraform/extra_schema_entry/network.erb @@ -0,0 +1,19 @@ +<%# The license inside this block applies to this file. + # Copyright 2019 Google Inc. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-%> +"ipv4_range": { + Type: schema.TypeString, + Optional: true, + Removed: "Legacy Networks are deprecated and you will no longer be able to create them using this field from Feb 1, 2020 onwards.", +}, \ No newline at end of file diff --git a/third_party/terraform/data_sources/data_source_google_container_engine_versions.go.erb b/third_party/terraform/data_sources/data_source_google_container_engine_versions.go.erb index e2ff4f9376e0..58fcb5652975 100644 --- a/third_party/terraform/data_sources/data_source_google_container_engine_versions.go.erb +++ b/third_party/terraform/data_sources/data_source_google_container_engine_versions.go.erb @@ -23,19 +23,16 @@ func dataSourceGoogleContainerEngineVersions() *schema.Resource { "location": { Type: schema.TypeString, Optional: true, - ConflictsWith: []string{"zone", "region"}, }, "zone": { Type: schema.TypeString, Optional: true, - Deprecated: "Use location instead", - ConflictsWith: []string{"region", "location"}, + Removed: "Use location instead", }, "region": { Type: schema.TypeString, Optional: true, - Deprecated: "Use location instead", - ConflictsWith: []string{"zone", "location"}, + Removed: "Use location instead", }, "default_cluster_version": { Type: schema.TypeString, @@ -76,7 +73,7 @@ func dataSourceGoogleContainerEngineVersionsRead(d *schema.ResourceData, meta in return err } if len(location) == 0 { - return fmt.Errorf("Cannot determine location: set location, zone, or region in this data source or at provider-level") + return fmt.Errorf("Cannot determine location: set location in this data source or at provider-level") } location = fmt.Sprintf("projects/%s/locations/%s", project, location) diff --git a/third_party/terraform/resources/resource_compute_network_peering.go.erb b/third_party/terraform/resources/resource_compute_network_peering.go.erb index 0273e77e125f..a575e0a06971 100644 --- a/third_party/terraform/resources/resource_compute_network_peering.go.erb +++ b/third_party/terraform/resources/resource_compute_network_peering.go.erb @@ -42,13 +42,12 @@ func resourceComputeNetworkPeering() *schema.Resource { DiffSuppressFunc: compareSelfLinkRelativePaths, }, // The API only accepts true as a value for exchange_subnet_routes or auto_create_routes (of which only one can be set in a valid request). - // Also, you can't set auto_create_routes if you use the networkPeering object. auto_create_routes is also deprecated + // Also, you can't set auto_create_routes if you use the networkPeering object. auto_create_routes is also removed "auto_create_routes": { Type: schema.TypeBool, Optional: true, - Deprecated: "auto_create_routes has been deprecated because it's redundant and not user-configurable. It can safely be removed from your config", + Removed: "auto_create_routes has been removed because it's redundant and not user-configurable. It can safely be removed from your config", ForceNew: true, - Default: true, }, "state": { Type: schema.TypeString, diff --git a/third_party/terraform/resources/resource_compute_region_instance_group_manager.go.erb b/third_party/terraform/resources/resource_compute_region_instance_group_manager.go.erb index cb6b374ac478..c6d6f56a813d 100644 --- a/third_party/terraform/resources/resource_compute_region_instance_group_manager.go.erb +++ b/third_party/terraform/resources/resource_compute_region_instance_group_manager.go.erb @@ -160,9 +160,8 @@ func resourceComputeRegionInstanceGroupManager() *schema.Resource { <% if version == 'ga' -%> "update_strategy": &schema.Schema{ Type: schema.TypeString, - Deprecated: "This field will be replaced by `update_policy` in 3.0.0", + Removed: "This field is removed.", Optional: true, - ConflictsWith: []string{"update_policy"}, }, <% end -%> diff --git a/third_party/terraform/resources/resource_container_cluster.go.erb b/third_party/terraform/resources/resource_container_cluster.go.erb index abe17bb3b6a3..07c8e717b8c9 100644 --- a/third_party/terraform/resources/resource_container_cluster.go.erb +++ b/third_party/terraform/resources/resource_container_cluster.go.erb @@ -131,25 +131,18 @@ func resourceContainerCluster() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - ConflictsWith: []string{"zone", "region"}, }, "region": { Type: schema.TypeString, Optional: true, - Computed: true, - ForceNew: true, - Deprecated: "Use location instead", - ConflictsWith: []string{"zone", "location"}, + Removed: "Use location instead", }, "zone": { Type: schema.TypeString, Optional: true, - Computed: true, - ForceNew: true, - Deprecated: "Use location instead", - ConflictsWith: []string{"region", "location"}, + Removed: "Use location instead", }, "node_locations": { @@ -162,8 +155,7 @@ func resourceContainerCluster() *schema.Resource { "additional_zones": { Type: schema.TypeSet, Optional: true, - Computed: true, - Deprecated: "Use node_locations instead", + Removed: "Use node_locations instead", Elem: &schema.Schema{Type: schema.TypeString}, }, @@ -1005,14 +997,6 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er return err } - // When parsing a subnetwork by name, we expect region or zone to be set. - // Users may have set location to either value, so set that value. - if isZone(location) { - d.Set("zone", location) - } else { - d.Set("region", location) - } - clusterName := d.Get("name").(string) cluster := &containerBeta.Cluster{ @@ -1072,20 +1056,7 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er if v, ok := d.GetOk("node_locations"); ok { locationsSet := v.(*schema.Set) if locationsSet.Contains(location) { - return fmt.Errorf("when using a multi-zonal cluster, additional_zones should not contain the original 'zone'") - } - - // GKE requires a full list of node locations - // but when using a multi-zonal cluster our schema only asks for the - // additional zones, so append the cluster location if it's a zone - if isZone(location) { - locationsSet.Add(location) - } - cluster.Locations = convertStringSet(locationsSet) - } else if v, ok := d.GetOk("additional_zones"); ok { - locationsSet := v.(*schema.Set) - if locationsSet.Contains(location) { - return fmt.Errorf("when using a multi-zonal cluster, additional_zones should not contain the original 'zone'") + return fmt.Errorf("when using a multi-zonal cluster, node_locations should not contain the original 'zone'") } // GKE requires a full list of node locations @@ -1259,16 +1230,10 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro } d.Set("location", cluster.Location) - if isZone(cluster.Location) { - d.Set("zone", cluster.Location) - } else { - d.Set("region", cluster.Location) - } locations := schema.NewSet(schema.HashString, convertStringArrToInterface(cluster.Locations)) locations.Remove(cluster.Zone) // Remove the original zone since we only store additional zones d.Set("node_locations", locations) - d.Set("additional_zones", locations) d.Set("endpoint", cluster.Endpoint) if err := d.Set("maintenance_policy", flattenMaintenancePolicy(cluster.MaintenancePolicy)); err != nil { @@ -1575,57 +1540,7 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er d.SetPartial("maintenance_policy") } - // we can only ever see a change to one of additional_zones and node_locations; because - // thy conflict with each other and are each computed, Terraform will suppress the diff - // on one of them even when migrating from one to the other. - if d.HasChange("additional_zones") { - azSetOldI, azSetNewI := d.GetChange("additional_zones") - azSetNew := azSetNewI.(*schema.Set) - azSetOld := azSetOldI.(*schema.Set) - if azSetNew.Contains(location) { - return fmt.Errorf("additional_zones should not contain the original 'zone'") - } - // Since we can't add & remove zones in the same request, first add all the - // zones, then remove the ones we aren't using anymore. - azSet := azSetOld.Union(azSetNew) - - if isZone(location) { - azSet.Add(location) - } - - req := &containerBeta.UpdateClusterRequest{ - Update: &containerBeta.ClusterUpdate{ - DesiredLocations: convertStringSet(azSet), - }, - } - - updateF := updateFunc(req, "updating GKE cluster node locations") - // Call update serially. - if err := lockedCall(lockKey, updateF); err != nil { - return err - } - - if isZone(location) { - azSetNew.Add(location) - } - if !azSet.Equal(azSetNew) { - req = &containerBeta.UpdateClusterRequest{ - Update: &containerBeta.ClusterUpdate{ - DesiredLocations: convertStringSet(azSetNew), - }, - } - - updateF := updateFunc(req, "updating GKE cluster node locations") - // Call update serially. - if err := lockedCall(lockKey, updateF); err != nil { - return err - } - } - - log.Printf("[INFO] GKE cluster %s node locations have been updated to %v", d.Id(), azSet.List()) - - d.SetPartial("additional_zones") - } else if d.HasChange("node_locations") { + if d.HasChange("node_locations") { azSetOldI, azSetNewI := d.GetChange("node_locations") azSetNew := azSetNewI.(*schema.Set) azSetOld := azSetOldI.(*schema.Set) @@ -2948,12 +2863,6 @@ func resourceContainerClusterStateImporter(d *schema.ResourceData, meta interfac } d.Set("project", project) - d.Set("location", location) - if isZone(location) { - d.Set("zone", location) - } else { - d.Set("region", location) - } d.Set("name", clusterName) d.SetId(clusterName) diff --git a/third_party/terraform/resources/resource_container_node_pool.go.erb b/third_party/terraform/resources/resource_container_node_pool.go.erb index 5f5630ca446f..14b10e3a2cc2 100644 --- a/third_party/terraform/resources/resource_container_node_pool.go.erb +++ b/third_party/terraform/resources/resource_container_node_pool.go.erb @@ -55,16 +55,12 @@ func resourceContainerNodePool() *schema.Resource { "zone": { Type: schema.TypeString, Optional: true, - Computed: true, - Deprecated: "use location instead", - ForceNew: true, + Removed: "use location instead", }, "region": { Type: schema.TypeString, Optional: true, - Computed: true, - Deprecated: "use location instead", - ForceNew: true, + Removed: "use location instead", }, "location": { Type: schema.TypeString, @@ -323,12 +319,6 @@ func resourceContainerNodePoolRead(d *schema.ResourceData, meta interface{}) err d.Set(k, v) } - if isZone(nodePoolInfo.location) { - d.Set("zone", nodePoolInfo.location) - } else { - d.Set("region", nodePoolInfo.location) - } - d.Set("location", nodePoolInfo.location) d.Set("project", nodePoolInfo.project) @@ -429,11 +419,6 @@ func resourceContainerNodePoolStateImporter(d *schema.ResourceData, meta interfa switch len(parts) { case 3: location := parts[0] - if isZone(location) { - d.Set("zone", location) - } else { - d.Set("region", location) - } d.Set("location", location) d.Set("cluster", parts[1]) @@ -442,11 +427,6 @@ func resourceContainerNodePoolStateImporter(d *schema.ResourceData, meta interfa d.Set("project", parts[0]) location := parts[1] - if isZone(location) { - d.Set("zone", location) - } else { - d.Set("region", location) - } d.Set("location", location) d.Set("cluster", parts[2]) diff --git a/third_party/terraform/resources/resource_storage_bucket.go b/third_party/terraform/resources/resource_storage_bucket.go index a2edfa1658b5..2ef34f2248d0 100644 --- a/third_party/terraform/resources/resource_storage_bucket.go +++ b/third_party/terraform/resources/resource_storage_bucket.go @@ -147,10 +147,9 @@ func resourceStorageBucket() *schema.Resource { Optional: true, }, "is_live": { - Type: schema.TypeBool, - Optional: true, - Computed: true, - Deprecated: "Please use `with_state` instead", + Type: schema.TypeBool, + Optional: true, + Removed: "Please use `with_state` instead", }, "with_state": { Type: schema.TypeString, @@ -879,10 +878,8 @@ func flattenBucketLifecycleRuleCondition(condition *storage.BucketLifecycleRuleC } else { if *condition.IsLive { ruleCondition["with_state"] = "LIVE" - ruleCondition["is_live"] = true } else { ruleCondition["with_state"] = "ARCHIVED" - ruleCondition["is_live"] = false } } return ruleCondition @@ -1045,18 +1042,9 @@ func expandStorageBucketLifecycleRuleCondition(v interface{}) (*storage.BucketLi transformed.IsLive = googleapi.Bool(true) case "ARCHIVED": transformed.IsLive = googleapi.Bool(false) - case "ANY": + case "ANY", "": // This is unnecessary, but set explicitly to nil for readability. transformed.IsLive = nil - case "": - // Support deprecated `is_live` behavior - // is_live was always read (ok always true) - // so it can only support LIVE/ARCHIVED. - // TODO: When removing is_live, combine this case with case "ANY" - if v, ok := condition["is_live"]; ok { - log.Printf("[WARN] using deprecated field `is_live` because with_state is empty") - transformed.IsLive = googleapi.Bool(v.(bool)) - } default: return nil, fmt.Errorf("unexpected value %q for condition.with_state", withStateV.(string)) } @@ -1112,32 +1100,8 @@ func resourceGCSBucketLifecycleRuleConditionHash(v interface{}) int { buf.WriteString(fmt.Sprintf("%s-", v.(string))) } - // Note that we are keeping the boolean notation from when is_live was - // the only field (i.e. not deprecated) in order to prevent a diff from - // hash key. - // There are three possible states for the actual condition - // and correspond to the following hash codes: - // - // 1. LIVE only: "true-" - // Applies for one of: - // with_state = "" && is_live = true - // with_state = "LIVE" - // - // 2. ARCHIVED only: "false-" - // Applies for one of: - // with_state = "" && is_live = false - // with_state = "ARCHIVED" - // - // 3. ANY (i.e. LIVE and ARCHIVED): "" - // Applies for one of: - // with_state = "ANY" - withStateV, withStateOk := m["with_state"] - if !withStateOk || withStateV.(string) == "" { - if isLiveV, ok := m["is_live"]; ok { - buf.WriteString(fmt.Sprintf("%t-", isLiveV.(bool))) - } - } else if withStateOk { + if withStateOk { switch withStateV.(string) { case "LIVE": buf.WriteString(fmt.Sprintf("%t-", true)) diff --git a/third_party/terraform/tests/data_source_google_container_engine_versions_test.go b/third_party/terraform/tests/data_source_google_container_engine_versions_test.go index 84e13eae07db..eef37286ab6d 100644 --- a/third_party/terraform/tests/data_source_google_container_engine_versions_test.go +++ b/third_party/terraform/tests/data_source_google_container_engine_versions_test.go @@ -21,7 +21,6 @@ func TestAccContainerEngineVersions_basic(t *testing.T) { Config: testAccCheckGoogleContainerEngineVersionsConfig, Check: resource.ComposeTestCheckFunc( testAccCheckGoogleContainerEngineVersionsMeta("data.google_container_engine_versions.location"), - testAccCheckGoogleContainerEngineVersionsMeta("data.google_container_engine_versions.versions"), ), }, }, @@ -46,24 +45,6 @@ func TestAccContainerEngineVersions_filtered(t *testing.T) { }) } -func TestAccContainerEngineVersions_regional(t *testing.T) { - t.Parallel() - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - Steps: []resource.TestStep{ - { - Config: testAccCheckGoogleContainerEngineVersionsRegionalConfig, - Check: resource.ComposeTestCheckFunc( - testAccCheckGoogleContainerEngineVersionsMeta("data.google_container_engine_versions.location"), - testAccCheckGoogleContainerEngineVersionsMeta("data.google_container_engine_versions.versions"), - ), - }, - }, - }) -} - func testAccCheckGoogleContainerEngineVersionsMeta(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -138,25 +119,11 @@ var testAccCheckGoogleContainerEngineVersionsConfig = ` data "google_container_engine_versions" "location" { location = "us-central1-b" } - -data "google_container_engine_versions" "versions" { - zone = "us-central1-b" -} ` var testAccCheckGoogleContainerEngineVersions_filtered = ` data "google_container_engine_versions" "versions" { - zone = "us-central1-b" + location = "us-central1-b" version_prefix = "1.1." } ` - -var testAccCheckGoogleContainerEngineVersionsRegionalConfig = ` -data "google_container_engine_versions" "location" { - location = "us-central1" -} - -data "google_container_engine_versions" "versions" { - region = "us-central1" -} -` diff --git a/third_party/terraform/tests/resource_cloudiot_registry_test.go b/third_party/terraform/tests/resource_cloudiot_registry_test.go index 8d2e4704562a..a002e8216670 100644 --- a/third_party/terraform/tests/resource_cloudiot_registry_test.go +++ b/third_party/terraform/tests/resource_cloudiot_registry_test.go @@ -231,52 +231,6 @@ resource "google_cloudiot_registry" "foobar" { `, acctest.RandString(10), acctest.RandString(10), registryName) } -func testAccCloudIoTRegistry_singleEventNotificationConfig(topic, registryName string) string { - return fmt.Sprintf(` -resource "google_project_iam_binding" "cloud-iot-iam-binding" { - members = ["serviceAccount:cloud-iot@system.gserviceaccount.com"] - role = "roles/pubsub.publisher" -} - -resource "google_pubsub_topic" "event-topic" { - name = "%s" -} - -resource "google_cloudiot_registry" "foobar" { - depends_on = ["google_project_iam_binding.cloud-iot-iam-binding"] - - name = "%s" - - event_notification_config = { - pubsub_topic_name = "${google_pubsub_topic.event-topic.id}" - } -} -`, topic, registryName) -} - -func testAccCloudIoTRegistry_pluralEventNotificationConfigs(topic, registryName string) string { - return fmt.Sprintf(` -resource "google_project_iam_binding" "cloud-iot-iam-binding" { - members = ["serviceAccount:cloud-iot@system.gserviceaccount.com"] - role = "roles/pubsub.publisher" -} - -resource "google_pubsub_topic" "event-topic" { - name = "%s" -} - -resource "google_cloudiot_registry" "foobar" { - depends_on = ["google_project_iam_binding.cloud-iot-iam-binding"] - - name = "%s" - - event_notification_config = { - pubsub_topic_name = "${google_pubsub_topic.event-topic.id}" - } -} -`, topic, registryName) -} - func testAccCloudIoTRegistry_singleEventNotificationConfigs(topic, registryName string) string { return fmt.Sprintf(` resource "google_project_iam_binding" "cloud-iot-iam-binding" { diff --git a/third_party/terraform/tests/resource_compute_network_peering_test.go.erb b/third_party/terraform/tests/resource_compute_network_peering_test.go.erb index 0fe3a3c29ec1..d53ee1080e87 100644 --- a/third_party/terraform/tests/resource_compute_network_peering_test.go.erb +++ b/third_party/terraform/tests/resource_compute_network_peering_test.go.erb @@ -151,7 +151,6 @@ func testAccComputeNetworkPeering_basic() string { network = "${google_compute_network.network2.self_link}" peer_network = "${google_compute_network.network1.self_link}" name = "peering-test-2-%s" - auto_create_routes = true ` <% unless version == 'ga' -%> diff --git a/third_party/terraform/tests/resource_compute_network_test.go b/third_party/terraform/tests/resource_compute_network_test.go index 4f1d6ccac598..9652cf4f08a4 100644 --- a/third_party/terraform/tests/resource_compute_network_test.go +++ b/third_party/terraform/tests/resource_compute_network_test.go @@ -66,31 +66,6 @@ func TestAccComputeNetwork_customSubnet(t *testing.T) { }) } -func TestAccComputeNetwork_legacyNetwork(t *testing.T) { - t.Parallel() - - var network compute.Network - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckComputeNetworkDestroy, - Steps: []resource.TestStep{ - { - Config: testAccComputeNetwork_legacyNetwork(), - Check: resource.ComposeTestCheckFunc( - testAccCheckComputeNetworkExists("google_compute_network.default", &network), - resource.TestCheckResourceAttrSet("google_compute_network.default", "ipv4_range"), - ), - }, - { - ResourceName: "google_compute_network.default", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func TestAccComputeNetwork_routingModeAndUpdate(t *testing.T) { t.Parallel() @@ -275,15 +250,6 @@ resource "google_compute_network" "bar" { }`, acctest.RandString(10)) } -func testAccComputeNetwork_legacyNetwork() string { - return fmt.Sprintf(` -resource "google_compute_network" "default" { - name = "network-test-%s" - auto_create_subnetworks = false - ipv4_range = "10.0.0.0/16" -}`, acctest.RandString(10)) -} - func testAccComputeNetwork_custom_subnet() string { return fmt.Sprintf(` resource "google_compute_network" "baz" { diff --git a/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb b/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb index b9e3778991e4..58e90fa4eccf 100644 --- a/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb +++ b/third_party/terraform/tests/resource_compute_region_instance_group_manager_test.go.erb @@ -130,30 +130,6 @@ func TestAccRegionInstanceGroupManager_updateLifecycle(t *testing.T) { }) } -<% if version == 'ga' -%> -func TestAccRegionInstanceGroupManager_updateStrategy(t *testing.T) { - t.Parallel() - - igm := fmt.Sprintf("igm-test-%s", acctest.RandString(10)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckInstanceGroupManagerDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccRegionInstanceGroupManager_updateStrategy(igm), - }, - { - ResourceName: "google_compute_region_instance_group_manager.igm-update-strategy", - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} -<% end -%> - func TestAccRegionInstanceGroupManager_rollingUpdatePolicy(t *testing.T) { t.Parallel() @@ -927,6 +903,7 @@ resource "google_compute_region_instance_group_manager" "igm-basic" { } `, template, igm, strings.Join(zones, "\",\"")) } +<<<<<<< HEAD <% if version == 'ga' -%> func testAccRegionInstanceGroupManager_updateStrategy(igm string) string { return fmt.Sprintf(` @@ -974,6 +951,10 @@ resource "google_compute_region_instance_group_manager" "igm-update-strategy" { } <% end -%> +======= + +<% unless version == 'ga' -%> +>>>>>>> Removing deprecated fields (#2436) func testAccRegionInstanceGroupManager_rollingUpdatePolicy(igm string) string { return fmt.Sprintf(` data "google_compute_image" "my_image" { diff --git a/third_party/terraform/tests/resource_container_cluster_test.go.erb b/third_party/terraform/tests/resource_container_cluster_test.go.erb index 3a0a704f56de..c765a486645f 100644 --- a/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -562,7 +562,7 @@ func TestAccContainerCluster_regionalWithNodePool(t *testing.T) { }) } -func TestAccContainerCluster_regionalWithAdditionalZones(t *testing.T) { +func TestAccContainerCluster_regionalWithNodeLocations(t *testing.T) { t.Parallel() clusterName := fmt.Sprintf("cluster-test-%s", acctest.RandString(10)) @@ -573,19 +573,19 @@ func TestAccContainerCluster_regionalWithAdditionalZones(t *testing.T) { CheckDestroy: testAccCheckContainerClusterDestroy, Steps: []resource.TestStep{ { - Config: testAccContainerCluster_regionalAdditionalZones(clusterName), + Config: testAccContainerCluster_regionalNodeLocations(clusterName), }, { - ResourceName: "google_container_cluster.with_additional_zones", + ResourceName: "google_container_cluster.with_node_locations", ImportStateIdPrefix: "us-central1/", ImportState: true, ImportStateVerify: true, }, { - Config: testAccContainerCluster_regionalUpdateAdditionalZones(clusterName), + Config: testAccContainerCluster_regionalUpdateNodeLocations(clusterName), }, { - ResourceName: "google_container_cluster.with_additional_zones", + ResourceName: "google_container_cluster.with_node_locations", ImportStateIdPrefix: "us-central1/", ImportState: true, ImportStateVerify: true, @@ -1011,7 +1011,7 @@ func TestAccContainerCluster_withNodePoolResize(t *testing.T) { CheckDestroy: testAccCheckContainerClusterDestroy, Steps: []resource.TestStep{ { - Config: testAccContainerCluster_withNodePoolAdditionalZones(clusterName, npName), + Config: testAccContainerCluster_withNodePoolNodeLocations(clusterName, npName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("google_container_cluster.with_node_pool", "node_pool.0.node_count", "2"), ), @@ -1760,7 +1760,7 @@ func testAccContainerCluster_masterAuthorizedNetworksDisabled(resource_name stri attributes := rs.Primary.Attributes cluster, err := config.clientContainer.Projects.Zones.Clusters.Get( - config.Project, attributes["zone"], attributes["name"]).Do() + config.Project, attributes["location"], attributes["name"]).Do() if err != nil { return err } @@ -1783,7 +1783,7 @@ func testAccCheckContainerClusterDestroy(s *terraform.State) error { attributes := rs.Primary.Attributes _, err := config.clientContainer.Projects.Zones.Clusters.Get( - config.Project, attributes["zone"], attributes["name"]).Do() + config.Project, attributes["location"], attributes["name"]).Do() if err == nil { return fmt.Errorf("Cluster still exists") } @@ -1896,13 +1896,12 @@ func testAccContainerCluster_misc(name string) string { return fmt.Sprintf(` resource "google_container_cluster" "primary" { name = "%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true - # This uses zone/additional_zones over location/node_locations to ensure we can update from old -> new - additional_zones = [ + node_locations = [ "us-central1-b", "us-central1-c" ] @@ -2013,8 +2012,8 @@ resource "google_container_cluster" "primary" { func testAccContainerCluster_withMasterAuth(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_master_auth" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 3 master_auth { @@ -2027,8 +2026,8 @@ resource "google_container_cluster" "with_master_auth" { func testAccContainerCluster_updateMasterAuth(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_master_auth" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 3 master_auth { @@ -2041,8 +2040,8 @@ resource "google_container_cluster" "with_master_auth" { func testAccContainerCluster_disableMasterAuth(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_master_auth" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 3 master_auth { @@ -2055,8 +2054,8 @@ resource "google_container_cluster" "with_master_auth" { func testAccContainerCluster_withMasterAuthNoCert() string { return fmt.Sprintf(` resource "google_container_cluster" "with_master_auth_no_cert" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" initial_node_count = 3 master_auth { @@ -2072,8 +2071,8 @@ resource "google_container_cluster" "with_master_auth_no_cert" { func testAccContainerCluster_withNetworkPolicyEnabled(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_network_policy_enabled" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true @@ -2118,8 +2117,8 @@ resource "google_container_cluster" "with_default_release_channel" { func testAccContainerCluster_removeNetworkPolicy(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_network_policy_enabled" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true }`, clusterName) @@ -2128,8 +2127,8 @@ resource "google_container_cluster" "with_network_policy_enabled" { func testAccContainerCluster_withNetworkPolicyDisabled(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_network_policy_enabled" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true @@ -2140,8 +2139,8 @@ resource "google_container_cluster" "with_network_policy_enabled" { func testAccContainerCluster_withNetworkPolicyConfigDisabled(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_network_policy_enabled" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 remove_default_node_pool = true @@ -2167,7 +2166,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { name = "${google_compute_network.container_network.name}" network = "${google_compute_network.container_network.name}" ip_cidr_range = "10.0.36.0/24" - region = "us-central1" + location = "us-central1" private_ip_google_access = true secondary_ip_range { @@ -2182,8 +2181,8 @@ resource "google_compute_subnetwork" "container_subnetwork" { } resource "google_container_cluster" "with_authenticator_groups" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 network = "${google_compute_network.container_network.name}" subnetwork = "${google_compute_subnetwork.container_subnetwork.name}" @@ -2249,8 +2248,8 @@ resource "google_container_cluster" "regional" { func testAccContainerCluster_regionalWithNodePool(cluster, nodePool string) string { return fmt.Sprintf(` resource "google_container_cluster" "regional" { - name = "%s" - region = "us-central1" + name = "%s" + location = "us-central1" node_pool { name = "%s" @@ -2258,24 +2257,23 @@ resource "google_container_cluster" "regional" { }`, cluster, nodePool) } -// This uses region/additional_zones over location/node_locations to ensure we can update from old -> new -func testAccContainerCluster_regionalAdditionalZones(clusterName string) string { +func testAccContainerCluster_regionalNodeLocations(clusterName string) string { return fmt.Sprintf(` -resource "google_container_cluster" "with_additional_zones" { - name = "%s" - region = "us-central1" +resource "google_container_cluster" "with_node_locations" { + name = "%s" + location = "us-central1" initial_node_count = 1 - additional_zones = [ + node_locations = [ "us-central1-f", "us-central1-c", ] }`, clusterName) } -func testAccContainerCluster_regionalUpdateAdditionalZones(clusterName string) string { +func testAccContainerCluster_regionalUpdateNodeLocations(clusterName string) string { return fmt.Sprintf(` -resource "google_container_cluster" "with_additional_zones" { +resource "google_container_cluster" "with_node_locations" { name = "%s" location = "us-central1" initial_node_count = 1 @@ -2296,9 +2294,9 @@ resource "google_compute_network" "container_network" { } resource "google_compute_subnetwork" "container_subnetwork" { - name = "${google_compute_network.container_network.name}" - network = "${google_compute_network.container_network.name}" - region = "us-central1" + name = "${google_compute_network.container_network.name}" + network = "${google_compute_network.container_network.name}" + location = "us-central1" ip_cidr_range = "10.0.35.0/24" private_ip_google_access = true @@ -2316,7 +2314,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { resource "google_container_cluster" "with_tpu" { name = "cluster-test-%s" - zone = "us-central1-b" + location = "us-central1-b" initial_node_count = 1 enable_tpu = true @@ -2343,8 +2341,8 @@ resource "google_container_cluster" "with_tpu" { func testAccContainerCluster_withIntraNodeVisibility(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_intranode_visibility" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" initial_node_count = 1 enable_intranode_visibility = true }`, clusterName) @@ -2353,8 +2351,8 @@ resource "google_container_cluster" "with_intranode_visibility" { func testAccContainerCluster_updateIntraNodeVisibility(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_intranode_visibility" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" initial_node_count = 1 enable_intranode_visibility = false }`, clusterName) @@ -2365,12 +2363,12 @@ resource "google_container_cluster" "with_intranode_visibility" { func testAccContainerCluster_withVersion(clusterName string) string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "with_version" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" initial_node_count = 1 }`, clusterName) @@ -2379,12 +2377,12 @@ resource "google_container_cluster" "with_version" { func testAccContainerCluster_withLowerVersion(clusterName string) string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "with_version" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" min_master_version = "${data.google_container_engine_versions.central1a.valid_master_versions.2}" initial_node_count = 1 }`, clusterName) @@ -2393,12 +2391,12 @@ resource "google_container_cluster" "with_version" { func testAccContainerCluster_updateVersion(clusterName string) string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "with_version" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" min_master_version = "${data.google_container_engine_versions.central1a.valid_master_versions.1}" node_version = "${data.google_container_engine_versions.central1a.valid_node_versions.1}" initial_node_count = 1 @@ -2408,8 +2406,8 @@ resource "google_container_cluster" "with_version" { func testAccContainerCluster_withNodeConfig(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_config" { - name = "%s" - zone = "us-central1-f" + name = "%s" + location = "us-central1-f" initial_node_count = 1 node_config { @@ -2456,8 +2454,8 @@ resource "google_container_cluster" "with_node_config" { func testAccContainerCluster_withNodeConfigUpdate(clusterName string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_config" { - name = "%s" - zone = "us-central1-f" + name = "%s" + location = "us-central1-f" initial_node_count = 1 node_config { @@ -2504,8 +2502,8 @@ resource "google_container_cluster" "with_node_config" { func testAccContainerCluster_withNodeConfigScopeAlias() string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_config_scope_alias" { - name = "cluster-test-%s" - zone = "us-central1-f" + name = "cluster-test-%s" + location = "us-central1-f" initial_node_count = 1 node_config { @@ -2561,12 +2559,12 @@ resource "google_container_cluster" "with_node_config" { func testAccContainerCluster_withWorkloadMetadataConfig() string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "with_workload_metadata_config" { name = "cluster-test-%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 1 min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" @@ -2591,8 +2589,8 @@ data "google_project" "project" { } resource "google_container_cluster" "with_workload_identity_config" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 node_config { @@ -2611,12 +2609,12 @@ resource "google_container_cluster" "with_workload_identity_config" { func testAccContainerCluster_withSandboxConfig() string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "with_sandbox_config" { name = "cluster-test-%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 1 min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" @@ -2645,16 +2643,16 @@ resource "google_compute_network" "container_network" { } resource "google_container_cluster" "with_net_ref_by_url" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" initial_node_count = 1 network = "${google_compute_network.container_network.self_link}" } resource "google_container_cluster" "with_net_ref_by_name" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" initial_node_count = 1 network = "${google_compute_network.container_network.name}" @@ -2684,10 +2682,10 @@ resource "google_compute_http_health_check" "default" { resource "google_container_cluster" "primary" { name = "terraform-test-%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 3 - additional_zones = [ + node_locations = [ "us-central1-b", "us-central1-c", ] @@ -2707,8 +2705,8 @@ resource "google_container_cluster" "primary" { func testAccContainerCluster_withNodePoolBasic(cluster, nodePool string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_pool" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" node_pool { name = "%s" @@ -2720,12 +2718,12 @@ resource "google_container_cluster" "with_node_pool" { func testAccContainerCluster_withNodePoolLowerVersion(cluster, nodePool string) string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "with_node_pool" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" min_master_version = "${data.google_container_engine_versions.central1a.valid_master_versions.1}" @@ -2740,12 +2738,12 @@ resource "google_container_cluster" "with_node_pool" { func testAccContainerCluster_withNodePoolUpdateVersion(cluster, nodePool string) string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "with_node_pool" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" min_master_version = "${data.google_container_engine_versions.central1a.valid_master_versions.1}" @@ -2757,13 +2755,13 @@ resource "google_container_cluster" "with_node_pool" { }`, cluster, nodePool) } -func testAccContainerCluster_withNodePoolAdditionalZones(cluster, nodePool string) string { +func testAccContainerCluster_withNodePoolNodeLocations(cluster, nodePool string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_pool" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" - additional_zones = [ + node_locations = [ "us-central1-b", "us-central1-c" ] @@ -2778,10 +2776,10 @@ resource "google_container_cluster" "with_node_pool" { func testAccContainerCluster_withNodePoolResize(cluster, nodePool string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_pool" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" - additional_zones = [ + node_locations = [ "us-central1-b", "us-central1-c" ] @@ -2797,12 +2795,12 @@ resource "google_container_cluster" "with_node_pool" { func testAccContainerCluster_autoprovisioning(cluster string, autoprovisioning bool) string { config := fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "with_autoprovisioning" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" initial_node_count = 1 `, cluster) @@ -2834,8 +2832,8 @@ resource "google_container_cluster" "with_autoprovisioning" { func testAccContainerCluster_withNodePoolAutoscaling(cluster, np string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_pool" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" node_pool { name = "%s" @@ -2851,8 +2849,8 @@ resource "google_container_cluster" "with_node_pool" { func testAccContainerCluster_withNodePoolUpdateAutoscaling(cluster, np string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_pool" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" node_pool { name = "%s" @@ -2868,8 +2866,8 @@ resource "google_container_cluster" "with_node_pool" { func testAccContainerCluster_withNodePoolNamePrefix() string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_pool_name_prefix" { - name = "tf-cluster-nodepool-test-%s" - zone = "us-central1-a" + name = "tf-cluster-nodepool-test-%s" + location = "us-central1-a" node_pool { name_prefix = "tf-np-test" @@ -2881,8 +2879,8 @@ resource "google_container_cluster" "with_node_pool_name_prefix" { func testAccContainerCluster_withNodePoolMultiple() string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_pool_multiple" { - name = "tf-cluster-nodepool-test-%s" - zone = "us-central1-a" + name = "tf-cluster-nodepool-test-%s" + location = "us-central1-a" node_pool { name = "tf-cluster-nodepool-test-%s" @@ -2899,8 +2897,8 @@ resource "google_container_cluster" "with_node_pool_multiple" { func testAccContainerCluster_withNodePoolConflictingNameFields() string { return fmt.Sprintf(` resource "google_container_cluster" "with_node_pool_multiple" { - name = "tf-cluster-nodepool-test-%s" - zone = "us-central1-a" + name = "tf-cluster-nodepool-test-%s" + location = "us-central1-a" node_pool { # ERROR: name and name_prefix cannot be both specified @@ -2915,8 +2913,8 @@ func testAccContainerCluster_withNodePoolNodeConfig() string { testId := acctest.RandString(10) return fmt.Sprintf(` resource "google_container_cluster" "with_node_pool_node_config" { - name = "tf-cluster-nodepool-test-%s" - zone = "us-central1-a" + name = "tf-cluster-nodepool-test-%s" + location = "us-central1-a" node_pool { name = "tf-cluster-nodepool-test-%s" node_count = 2 @@ -2960,8 +2958,8 @@ func testAccContainerCluster_withMaintenanceWindow(clusterName string, startTime return fmt.Sprintf(` resource "google_container_cluster" "with_maintenance_window" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" initial_node_count = 1 %s @@ -3006,7 +3004,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { name = "${google_compute_network.container_network.name}" network = "${google_compute_network.container_network.name}" ip_cidr_range = "10.0.0.0/24" - region = "us-central1" + location = "us-central1" secondary_ip_range { range_name = "pods" @@ -3019,8 +3017,8 @@ resource "google_compute_subnetwork" "container_subnetwork" { } resource "google_container_cluster" "with_ip_allocation_policy" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" network = "${google_compute_network.container_network.name}" subnetwork = "${google_compute_subnetwork.container_subnetwork.name}" @@ -3043,7 +3041,7 @@ resource "google_compute_network" "container_network" { resource "google_container_cluster" "with_ip_allocation_policy" { name = "%s" - zone = "us-central1-a" + location = "us-central1-a" network = "${google_compute_network.container_network.name}" initial_node_count = 1 @@ -3068,12 +3066,12 @@ resource "google_compute_subnetwork" "container_subnetwork" { name = "${google_compute_network.container_network.name}" network = "${google_compute_network.container_network.name}" ip_cidr_range = "10.0.0.0/24" - region = "us-central1" + location = "us-central1" } resource "google_container_cluster" "with_ip_allocation_policy" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" network = "${google_compute_network.container_network.name}" @@ -3146,8 +3144,8 @@ resource "google_compute_network" "container_network" { } resource "google_container_cluster" "with_ip_allocation_policy" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 @@ -3178,7 +3176,7 @@ func testAccContainerCluster_withResourceUsageExportConfig(clusterName, datasetI resource "google_container_cluster" "with_resource_usage_export_config" { name = "cluster-test-%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 1 %s }`, datasetId, clusterName, resourceUsageConfig) @@ -3197,7 +3195,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { name = "${google_compute_network.container_network.name}" network = "${google_compute_network.container_network.name}" ip_cidr_range = "10.0.36.0/24" - region = "us-central1" + location = "us-central1" private_ip_google_access = true secondary_ip_range { @@ -3212,8 +3210,8 @@ resource "google_compute_subnetwork" "container_subnetwork" { } resource "google_container_cluster" "with_private_cluster" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" initial_node_count = 1 network = "${google_compute_network.container_network.name}" @@ -3242,7 +3240,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { name = "${google_compute_network.container_network.name}" network = "${google_compute_network.container_network.name}" ip_cidr_range = "10.0.36.0/24" - region = "us-central1" + location = "us-central1" private_ip_google_access = true secondary_ip_range { @@ -3257,8 +3255,8 @@ resource "google_compute_subnetwork" "container_subnetwork" { } resource "google_container_cluster" "with_private_cluster" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" initial_node_count = 1 network = "${google_compute_network.container_network.name}" @@ -3344,7 +3342,7 @@ resource "google_compute_network" "shared_network" { resource "google_compute_subnetwork" "shared_subnetwork" { name = "test-%s" ip_cidr_range = "10.0.0.0/16" - region = "us-central1" + location = "us-central1" network = "${google_compute_network.shared_network.self_link}" project = "${google_compute_shared_vpc_host_project.host_project.project}" @@ -3361,7 +3359,7 @@ resource "google_compute_subnetwork" "shared_subnetwork" { resource "google_container_cluster" "shared_vpc_cluster" { name = "%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 1 project = "${google_compute_shared_vpc_service_project.service_project.service_project}" @@ -3388,8 +3386,8 @@ data "google_project" "project" { } resource "google_container_cluster" "with_workload_identity_config" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 workload_identity_config { @@ -3413,8 +3411,8 @@ data "google_project" "project" { } resource "google_container_cluster" "with_workload_identity_config" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 %s @@ -3424,8 +3422,8 @@ resource "google_container_cluster" "with_workload_identity_config" { func testAccContainerCluster_withBinaryAuthorization(clusterName string, enabled bool) string { return fmt.Sprintf(` resource "google_container_cluster" "with_binary_authorization" { - name = "%s" - zone = "us-central1-a" + name = "%s" + locatin = "us-central1-a" initial_node_count = 1 enable_binary_authorization = %v @@ -3456,7 +3454,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { name = "${google_compute_network.container_network.name}" network = "${google_compute_network.container_network.name}" ip_cidr_range = "10.0.35.0/24" - region = "us-central1" + location = "us-central1" private_ip_google_access = true secondary_ip_range { @@ -3471,8 +3469,8 @@ resource "google_compute_subnetwork" "container_subnetwork" { } resource "google_container_cluster" "with_flexible_cidr" { - name = "%s" - zone = "us-central1-a" + name = "%s" + locatin = "us-central1-a" initial_node_count = 3 network = "${google_compute_network.container_network.name}" @@ -3511,8 +3509,8 @@ resource "google_compute_subnetwork" "container_subnetwork" { } resource "google_container_cluster" "cidr_error_preempt" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" network = "${google_compute_network.container_network.name}" subnetwork = "${google_compute_subnetwork.container_subnetwork.name}" @@ -3532,8 +3530,8 @@ func testAccContainerCluster_withCIDROverlap(initConfig, secondCluster string) s %s resource "google_container_cluster" "cidr_error_overlap" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" network = "${google_compute_network.container_network.name}" subnetwork = "${google_compute_subnetwork.container_subnetwork.name}" @@ -3551,8 +3549,8 @@ resource "google_container_cluster" "cidr_error_overlap" { func testAccContainerCluster_withInvalidLocation(location string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_resource_labels" { - name = "invalid-gke-cluster" - zone = "%s" + name = "invalid-gke-cluster" + location = "%s" initial_node_count = 1 } `, location) @@ -3579,8 +3577,8 @@ resource "google_kms_key_ring_iam_policy" "test_key_ring_iam_policy" { } resource "google_container_cluster" "with_database_encryption" { - name = "cluster-test-%[3]s" - zone = "us-central1-a" + name = "cluster-test-%[3]s" + location = "us-central1-a" initial_node_count = 1 database_encryption { @@ -3602,7 +3600,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { name = "${google_compute_network.container_network.name}" network = "${google_compute_network.container_network.name}" ip_cidr_range = "10.0.36.0/24" - region = "us-central1" + location = "us-central1" private_ip_google_access = true secondary_ip_range { @@ -3617,8 +3615,8 @@ resource "google_compute_subnetwork" "container_subnetwork" { } resource "google_container_cluster" "with_private_cluster" { - name = "cluster-test-%s" - zone = "us-central1-a" + name = "cluster-test-%s" + location = "us-central1-a" initial_node_count = 1 network = "${google_compute_network.container_network.name}" diff --git a/third_party/terraform/tests/resource_container_node_pool_test.go.erb b/third_party/terraform/tests/resource_container_node_pool_test.go.erb index 013e651aa1a7..b4b4ef9b2609 100644 --- a/third_party/terraform/tests/resource_container_node_pool_test.go.erb +++ b/third_party/terraform/tests/resource_container_node_pool_test.go.erb @@ -653,17 +653,17 @@ func testAccCheckContainerNodePoolDestroy(s *terraform.State) error { } attributes := rs.Primary.Attributes - zone := attributes["zone"] + location := attributes["location"] var err error - if zone != "" { + if location != "" { _, err = config.clientContainer.Projects.Zones.Clusters.NodePools.Get( - config.Project, attributes["zone"], attributes["cluster"], attributes["name"]).Do() + config.Project, attributes["location"], attributes["cluster"], attributes["name"]).Do() } else { name := fmt.Sprintf( "projects/%s/locations/%s/clusters/%s/nodePools/%s", config.Project, - attributes["region"], + attributes["location"], attributes["cluster"], attributes["name"], ) @@ -706,7 +706,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { name = "${google_compute_network.container_network.name}" network = "${google_compute_network.container_network.name}" ip_cidr_range = "10.0.36.0/24" - region = "us-central1" + location = "us-central1" private_ip_google_access = true secondary_ip_range { @@ -763,7 +763,7 @@ resource "google_compute_subnetwork" "container_subnetwork" { name = "${google_compute_network.container_network.name}" network = "${google_compute_network.container_network.name}" ip_cidr_range = "10.0.36.0/24" - region = "us-central1" + location = "us-central1" private_ip_google_access = true secondary_ip_range { @@ -778,8 +778,8 @@ resource "google_compute_subnetwork" "container_subnetwork" { } resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 3 network = "${google_compute_network.container_network.name}" @@ -800,8 +800,8 @@ resource "google_container_cluster" "cluster" { } resource "google_container_node_pool" "np" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" max_pods_per_node = 30 initial_node_count = 2 @@ -827,13 +827,13 @@ resource "google_container_node_pool" "np" { func testAccContainerNodePool_namePrefix(cluster, np string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 3 } resource "google_container_node_pool" "np" { name_prefix = "%s" - zone = "us-central1-a" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 2 }`, cluster, np) @@ -842,13 +842,13 @@ resource "google_container_node_pool" "np" { func testAccContainerNodePool_noName(cluster string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 3 } resource "google_container_node_pool" "np" { - zone = "us-central1-a" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 2 }`, cluster) @@ -857,14 +857,14 @@ resource "google_container_node_pool" "np" { func testAccContainerNodePool_regionalAutoscaling(cluster, np string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "%s" - region = "us-central1" + name = "%s" + location = "us-central1" initial_node_count = 3 } resource "google_container_node_pool" "np" { - name = "%s" - region = "us-central1" + name = "%s" + location = "us-central1" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 2 autoscaling { @@ -877,14 +877,14 @@ resource "google_container_node_pool" "np" { func testAccContainerNodePool_autoscaling(cluster, np string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 3 } resource "google_container_node_pool" "np" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 2 autoscaling { @@ -897,14 +897,14 @@ resource "google_container_node_pool" "np" { func testAccContainerNodePool_updateAutoscaling(cluster, np string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 3 } resource "google_container_node_pool" "np" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 2 autoscaling { @@ -914,23 +914,22 @@ resource "google_container_node_pool" "np" { }`, cluster, np) } -// This uses zone/additional_zones over location/node_locations to ensure we can update from old -> new func testAccContainerNodePool_additionalZones(cluster, nodePool string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 - additional_zones = [ + node_locations = [ "us-central1-b", "us-central1-c" ] } resource "google_container_node_pool" "np" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" node_count = 2 }`, cluster, nodePool) @@ -961,13 +960,13 @@ func testAccContainerNodePool_withManagement(cluster, nodePool, management strin return fmt.Sprintf(` resource "google_container_cluster" "cluster" { name = "%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 1 } resource "google_container_node_pool" "np_with_management" { name = "%s" - zone = "us-central1-a" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 @@ -984,13 +983,13 @@ resource "google_container_node_pool" "np_with_management" { func testAccContainerNodePool_withNodeConfig(cluster, nodePool string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 } resource "google_container_node_pool" "np_with_node_config" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 node_config { @@ -1026,13 +1025,13 @@ resource "google_container_node_pool" "np_with_node_config" { func testAccContainerNodePool_withNodeConfigUpdate(cluster, nodePool string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 } resource "google_container_node_pool" "np_with_node_config" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 node_config { @@ -1069,19 +1068,19 @@ resource "google_container_node_pool" "np_with_node_config" { func testAccContainerNodePool_withWorkloadMetadataConfig() string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "cluster" { name = "tf-cluster-nodepool-test-%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 1 min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" } resource "google_container_node_pool" "with_workload_metadata_config" { - name = "tf-nodepool-test-%s" - zone = "us-central1-a" + name = "tf-nodepool-test-%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 node_config { @@ -1105,12 +1104,12 @@ data "google_project" "project" { } data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "cluster" { name = "tf-cluster-nodepool-test-%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 1 min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" @@ -1120,8 +1119,8 @@ resource "google_container_cluster" "cluster" { } resource "google_container_node_pool" "with_workload_metadata_config" { - name = "tf-nodepool-test-%s" - zone = "us-central1-a" + name = "tf-nodepool-test-%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 node_config { @@ -1142,19 +1141,19 @@ resource "google_container_node_pool" "with_workload_metadata_config" { func testAccContainerNodePool_withSandboxConfig() string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "cluster" { name = "tf-cluster-nodepool-test-%s" - zone = "us-central1-a" + location = "us-central1-a" initial_node_count = 1 min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" } resource "google_container_node_pool" "with_sandbox_config" { name = "tf-nodepool-test-%s" - zone = "us-central1-a" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 node_config { @@ -1175,20 +1174,20 @@ resource "google_container_node_pool" "with_sandbox_config" { func testAccContainerNodePool_withGPU() string { return fmt.Sprintf(` data "google_container_engine_versions" "central1c" { - zone = "us-central1-c" + location = "us-central1-c" } resource "google_container_cluster" "cluster" { - name = "tf-cluster-nodepool-test-%s" - zone = "us-central1-c" + name = "tf-cluster-nodepool-test-%s" + location = "us-central1-c" initial_node_count = 1 node_version = "${data.google_container_engine_versions.central1c.latest_node_version}" min_master_version = "${data.google_container_engine_versions.central1c.latest_master_version}" } resource "google_container_node_pool" "np_with_gpu" { - name = "tf-nodepool-test-%s" - zone = "us-central1-c" + name = "tf-nodepool-test-%s" + location = "us-central1-c" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 @@ -1221,13 +1220,13 @@ resource "google_container_node_pool" "np_with_gpu" { func testAccContainerNodePool_withNodeConfigScopeAlias() string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { - name = "tf-cluster-nodepool-test-%s" - zone = "us-central1-a" + name = "tf-cluster-nodepool-test-%s" + location = "us-central1-a" initial_node_count = 1 } resource "google_container_node_pool" "np_with_node_config_scope_alias" { name = "tf-nodepool-test-%s" - zone = "us-central1-a" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 node_config { @@ -1241,19 +1240,19 @@ resource "google_container_node_pool" "np_with_node_config_scope_alias" { func testAccContainerNodePool_version(cluster, np string) string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" } resource "google_container_node_pool" "np" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 @@ -1264,19 +1263,19 @@ resource "google_container_node_pool" "np" { func testAccContainerNodePool_updateVersion(cluster, np string) string { return fmt.Sprintf(` data "google_container_engine_versions" "central1a" { - zone = "us-central1-a" + location = "us-central1-a" } resource "google_container_cluster" "cluster" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" initial_node_count = 1 min_master_version = "${data.google_container_engine_versions.central1a.latest_master_version}" } resource "google_container_node_pool" "np" { - name = "%s" - zone = "us-central1-a" + name = "%s" + location = "us-central1-a" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 @@ -1288,13 +1287,13 @@ func testAccContainerNodePool_012_ConfigModeAttr1(cluster, np string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" initial_node_count = 3 } resource "google_container_node_pool" "np" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 @@ -1311,13 +1310,13 @@ func testAccContainerNodePool_012_ConfigModeAttr2(cluster, np string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" initial_node_count = 3 } resource "google_container_node_pool" "np" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 @@ -1331,13 +1330,13 @@ func testAccContainerNodePool_EmptyGuestAccelerator(cluster, np string) string { return fmt.Sprintf(` resource "google_container_cluster" "cluster" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" initial_node_count = 3 } resource "google_container_node_pool" "np" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 @@ -1354,13 +1353,13 @@ func testAccContainerNodePool_PartialEmptyGuestAccelerator(cluster, np string, c return fmt.Sprintf(` resource "google_container_cluster" "cluster" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" initial_node_count = 3 } resource "google_container_node_pool" "np" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 @@ -1382,13 +1381,13 @@ func testAccContainerNodePool_PartialEmptyGuestAccelerator2(cluster, np string) return fmt.Sprintf(` resource "google_container_cluster" "cluster" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" initial_node_count = 3 } resource "google_container_node_pool" "np" { name = "%s" - zone = "us-central1-f" + location = "us-central1-f" cluster = "${google_container_cluster.cluster.name}" initial_node_count = 1 diff --git a/third_party/terraform/tests/resource_storage_bucket_test.go b/third_party/terraform/tests/resource_storage_bucket_test.go index acbd3ca2818c..45ca19539cee 100644 --- a/third_party/terraform/tests/resource_storage_bucket_test.go +++ b/third_party/terraform/tests/resource_storage_bucket_test.go @@ -165,31 +165,12 @@ func TestAccStorageBucket_lifecycleRuleStateLive(t *testing.T) { Providers: testAccProviders, CheckDestroy: testAccStorageBucketDestroy, Steps: []resource.TestStep{ - { - Config: testAccStorageBucket_lifecycleRule_IsLiveTrue(bucketName), - Check: resource.ComposeTestCheckFunc( - testAccCheckStorageBucketExists( - "google_storage_bucket.bucket", bucketName, &bucket), - testAccCheckStorageBucketLifecycleConditionState(googleapi.Bool(true), &bucket), - resource.TestCheckResourceAttr( - "google_storage_bucket.bucket", attrPrefix+"is_live", "true"), - resource.TestCheckResourceAttr( - "google_storage_bucket.bucket", attrPrefix+"with_state", "LIVE"), - ), - }, - { - ResourceName: "google_storage_bucket.bucket", - ImportState: true, - ImportStateVerify: true, - }, { Config: testAccStorageBucket_lifecycleRule_withStateLive(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( "google_storage_bucket.bucket", bucketName, &bucket), testAccCheckStorageBucketLifecycleConditionState(googleapi.Bool(true), &bucket), - resource.TestCheckResourceAttr( - "google_storage_bucket.bucket", attrPrefix+"is_live", "true"), resource.TestCheckResourceAttr( "google_storage_bucket.bucket", attrPrefix+"with_state", "LIVE"), ), @@ -226,28 +207,7 @@ func TestAccStorageBucket_lifecycleRuleStateArchived(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckStorageBucketExists( "google_storage_bucket.bucket", bucketName, &bucket), - testAccCheckStorageBucketLifecycleConditionState(googleapi.Bool(false), &bucket), - resource.TestCheckResourceAttr( - "google_storage_bucket.bucket", attrPrefix+"is_live", "false"), - resource.TestCheckResourceAttr( - "google_storage_bucket.bucket", attrPrefix+"with_state", "ARCHIVED"), - ), - }, - { - ResourceName: "google_storage_bucket.bucket", - ImportState: true, - ImportStateVerify: true, - }, - { - Config: testAccStorageBucket_lifecycleRule_isLiveFalse(bucketName), - Check: resource.ComposeTestCheckFunc( - testAccCheckStorageBucketExists( - "google_storage_bucket.bucket", bucketName, &bucket), - testAccCheckStorageBucketLifecycleConditionState(googleapi.Bool(false), &bucket), - resource.TestCheckResourceAttr( - "google_storage_bucket.bucket", attrPrefix+"is_live", "false"), - resource.TestCheckResourceAttr( - "google_storage_bucket.bucket", attrPrefix+"with_state", "ARCHIVED"), + testAccCheckStorageBucketLifecycleConditionState(nil, &bucket), ), }, { @@ -261,8 +221,6 @@ func TestAccStorageBucket_lifecycleRuleStateArchived(t *testing.T) { testAccCheckStorageBucketExists( "google_storage_bucket.bucket", bucketName, &bucket), testAccCheckStorageBucketLifecycleConditionState(googleapi.Bool(false), &bucket), - resource.TestCheckResourceAttr( - "google_storage_bucket.bucket", attrPrefix+"is_live", "false"), resource.TestCheckResourceAttr( "google_storage_bucket.bucket", attrPrefix+"with_state", "ARCHIVED"), ), @@ -1302,24 +1260,6 @@ resource "google_storage_bucket" "bucket" { `, bucketName) } -func testAccStorageBucket_lifecycleRule_isLiveFalse(bucketName string) string { - return fmt.Sprintf(` -resource "google_storage_bucket" "bucket" { - name = "%s" - lifecycle_rule { - action { - type = "Delete" - } - - condition { - age = 10 - is_live = false - } - } -} -`, bucketName) -} - func testAccStorageBucket_lifecycleRule_withStateArchived(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { @@ -1338,24 +1278,6 @@ resource "google_storage_bucket" "bucket" { `, bucketName) } -func testAccStorageBucket_lifecycleRule_IsLiveTrue(bucketName string) string { - return fmt.Sprintf(` -resource "google_storage_bucket" "bucket" { - name = "%s" - lifecycle_rule { - action { - type = "Delete" - } - - condition { - age = 10 - is_live = true - } - } -} -`, bucketName) -} - func testAccStorageBucket_lifecycleRule_withStateLive(bucketName string) string { return fmt.Sprintf(` resource "google_storage_bucket" "bucket" { diff --git a/third_party/terraform/website/docs/d/google_container_engine_versions.html.markdown b/third_party/terraform/website/docs/d/google_container_engine_versions.html.markdown index 49ff7cf47c47..3c36eabb9ebe 100644 --- a/third_party/terraform/website/docs/d/google_container_engine_versions.html.markdown +++ b/third_party/terraform/website/docs/d/google_container_engine_versions.html.markdown @@ -47,14 +47,6 @@ Must exactly match the location the cluster will be deployed in, or listed versions may not be available. If `location`, `region`, and `zone` are not specified, the provider-level zone must be set and is used instead. -* `zone` (Optional, Deprecated) - Zone to list available cluster versions for. -Should match the zone the cluster will be deployed in. `zone` has been -deprecated in favour of `location`. - -* `region` (Optional, Deprecated) - Region to list available cluster versions -for. Should match the region the cluster will be deployed in. `region` has been -deprecated in favour of `location`. - * `project` (Optional) - ID of the project to list available cluster versions for. Should match the project the cluster will be deployed to. Defaults to the project that the provider is authenticated with. diff --git a/third_party/terraform/website/docs/guides/version_3_upgrade.html.markdown b/third_party/terraform/website/docs/guides/version_3_upgrade.html.markdown index 6ce54757511b..b873e36c277d 100644 --- a/third_party/terraform/website/docs/guides/version_3_upgrade.html.markdown +++ b/third_party/terraform/website/docs/guides/version_3_upgrade.html.markdown @@ -50,8 +50,21 @@ so Terraform knows to manage them. ## Upgrade Topics + +- [Provider Version Configuration](#provider-version-configuration) +- [Data Source: `google_container_engine_versions`](#data-source-google_container_engine_versions) +- [Resource: `google_container_cluster`](#resource-google_container_cluster) +- [Resource: `google_cloudiot_registry`](#resource-google_cloudiot_registry) +- [Resource: `google_compute_forwarding_rule`](#resource-google_compute_forwarding_rule) +- [Resource: `google_compute_network`](#resource-google_compute_network) +- [Resource: `google_compute_network_peering`](#resource-google_compute_network_peering) +- [Resource: `google_compute_region_instance_group_manager`](#resource-google_compute_region_instance_group_manager) - [Resource: `google_container_cluster`](#resource-google_container_cluster) +- [Resource: `google_container_node_pool`](#resource-google_container_node_pool) +- [Resource: `google_monitoring_alert_policy`](#resource-google_monitoring_alert_policy) +- [Resource: `google_monitoring_uptime_check_config`](#resource-google_monitoring_uptime_check_config) - [Resource: `google_project_services`](#resource-google_project_services) +- [Resource: `google_storage_bucket`](#resource-google_storage_bucket) @@ -91,6 +104,12 @@ provider "google" { } ``` +## Data Source: `google_container_engine_versions` + +### `region` and `zone` are now removed + +Use `location` instead. + ## Resource: `google_container_cluster` ### Automatic subnetwork creation for VPC-native clusters removed @@ -238,6 +257,65 @@ introducing an incompatibility for users who specify config in JSON instead of HCL or who use `dynamic` blocks. See more details in the [Attributes as Blocks](https://www.terraform.io/docs/configuration/attr-as-blocks.html) documentation. +## Resource: `google_cloudiot_registry` + +### `event_notification_config` is now removed + +`event_notification_config` has been removed in favor of +`event_notification_configs` (plural). Please switch to using the plural field. + +## Resource: `google_compute_forwarding_rule` + +### `ip_version` is now removed + +`ip_version` is not used for regional forwarding rules. + +## Resource: `google_compute_network` + +### `ipv4_range` is now removed + +Legacy Networks are deprecated and you will no longer be able to create them +using this field from Feb 1, 2020 onwards. + +## Resource: `google_compute_network_peering` + +### `auto_create_routes` is now removed + +`auto_create_routes` has been removed because it's redundant and not +user-configurable. + +## Resource: `google_compute_region_instance_group_manager` + +### `update_strategy` no longer has any effect and is removed + +With `rolling_update_policy` removed, `update_strategy` has no effect anymore. +Before updating, remove it from your config. + +## Resource: `google_container_cluster` + +### `zone`, `region` and `additional_zones` are now removed + +`zone` and `region` have been removed in favor of `location` and +`additional_zones` has been removed in favor of `node_locations` + +## Resource: `google_container_node_pool` + +### `zone` and `region` are now removed + +`zone` and `region` have been removed in favor of `location` + +## Resource: `google_monitoring_alert_policy` + +### `labels` is now removed + +`labels` is removed as it was never used. See `user_labels` for the correct field. + +## Resource: `google_monitoring_uptime_check_config` + +### `is_internal` and `internal_checker` are now removed + +`is_internal` and `internal_checker` never worked, and are now removed. + ## Resource: `google_project_services` ### `google_project_services` has been removed from the provider @@ -310,3 +388,9 @@ resource "google_project_service" "project_cloudresourcemanager" { disable_on_destroy = false } ``` + +## Resource: `google_storage_bucket` + +### `is_live` is now removed + +Please use `with_state` instead, as `is_live` is now removed. diff --git a/third_party/terraform/website/docs/r/compute_network_peering.html.markdown b/third_party/terraform/website/docs/r/compute_network_peering.html.markdown index c8d0fdb20a3b..a35d79ab104f 100644 --- a/third_party/terraform/website/docs/r/compute_network_peering.html.markdown +++ b/third_party/terraform/website/docs/r/compute_network_peering.html.markdown @@ -54,9 +54,6 @@ The following arguments are supported: * `peer_network` - (Required) Resource link of the peer network. -* `auto_create_routes` - (Optional) If set to `true`, the routes between the two networks will - be created and managed automatically. Defaults to `true`. - ## Attributes Reference In addition to the arguments listed above, the following computed attributes are diff --git a/third_party/terraform/website/docs/r/container_cluster.html.markdown b/third_party/terraform/website/docs/r/container_cluster.html.markdown index 6caf0d7b66e8..dee03452f12d 100644 --- a/third_party/terraform/website/docs/r/container_cluster.html.markdown +++ b/third_party/terraform/website/docs/r/container_cluster.html.markdown @@ -115,19 +115,7 @@ master will be created, as well as the default node location. If you specify a zone (such as `us-central1-a`), the cluster will be a zonal cluster with a single cluster master. If you specify a region (such as `us-west1`), the cluster will be a regional cluster with multiple masters spread across zones in -the region, and with default node locations in those zones as well. - -* `zone` - (Optional, Deprecated) The zone that the cluster master and nodes -should be created in. If specified, this cluster will be a zonal cluster. `zone` -has been deprecated in favour of `location`. - -* `region` (Optional, Deprecated) The region that the cluster master and nodes -should be created in. If specified, this cluster will be a [regional clusters](https://cloud.google.com/kubernetes-engine/docs/concepts/multi-zone-and-regional-clusters#regional) -where the cluster master and nodes (by default) will be created in several zones -throughout the region. `region` has been deprecated in favour of `location`. - -~> Only one of `location`, `zone`, and `region` may be set. If none are set, -the provider zone is used to create a zonal cluster. +the region, and with default node locations in those zones as well * `node_locations` - (Optional) The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the @@ -141,14 +129,6 @@ locations. In contrast, in a regional cluster, cluster master nodes are present in multiple zones in the region. For that reason, regional clusters should be preferred. -* `additional_zones` - (Optional) The list of zones in which the cluster's nodes -should be located. These must be in the same region as the cluster zone for -zonal clusters, or in the region of a regional cluster. In a multi-zonal cluster, -the number of nodes specified in `initial_node_count` is created in -all specified zones as well as the primary zone. If specified for a regional -cluster, nodes will only be created in these zones. `additional_zones` has been -deprecated in favour of `node_locations`. - * `addons_config` - (Optional) The configuration for addons supported by GKE. Structure is documented below. @@ -234,9 +214,9 @@ Structure is documented below. [the docs](https://cloud.google.com/kubernetes-engine/versioning-and-upgrades#specifying_cluster_version) describe the various acceptable formats for this field. --> If you are using the `google_container_engine_versions` datasource with a regional cluster, ensure that you have provided a `region` -to the datasource. A `region` can have a different set of supported versions than its corresponding `zone`s, and not all `zone`s in a -`region` are guaranteed to support the same version. +-> If you are using the `google_container_engine_versions` datasource with a regional cluster, ensure that you have provided a `location` +to the datasource. A region can have a different set of supported versions than its corresponding zones, and not all zones in a +region are guaranteed to support the same version. * `monitoring_service` - (Optional) The monitoring service that the cluster should write metrics to. @@ -749,7 +729,7 @@ This resource provides the following ## Import -GKE clusters can be imported using the `project` , `zone` or `region`, and `name`. If the project is omitted, the default +GKE clusters can be imported using the `project` , `location`, and `name`. If the project is omitted, the default provider value will be used. Examples: ``` diff --git a/third_party/terraform/website/docs/r/container_node_pool.html.markdown b/third_party/terraform/website/docs/r/container_node_pool.html.markdown index cce77db73f71..81508110540c 100644 --- a/third_party/terraform/website/docs/r/container_node_pool.html.markdown +++ b/third_party/terraform/website/docs/r/container_node_pool.html.markdown @@ -99,21 +99,12 @@ resource "google_container_cluster" "primary" { ## Argument Reference -* `cluster` - (Required) The cluster to create the node pool for. Cluster must be present in `zone` provided for zonal clusters. +* `cluster` - (Required) The cluster to create the node pool for. Cluster must be present in `location` provided for zonal clusters. - - - * `location` - (Optional) The location (region or zone) of the cluster. -* `zone` - (Optional, Deprecated) The zone in which the cluster resides. `zone` -has been deprecated in favor of `location`. - -* `region` - (Optional, Deprecated) The region in which the cluster resides (for -regional clusters). `region` has been deprecated in favor of `location`. - --> Note: You must specify a `location` for either cluster type or the -type-specific `region` for regional clusters / `zone` for zonal clusters. - - - - * `autoscaling` - (Optional) Configuration required by cluster autoscaler to adjust diff --git a/third_party/terraform/website/docs/r/storage_bucket.html.markdown b/third_party/terraform/website/docs/r/storage_bucket.html.markdown index b96fd891bc8f..752bd7a4a5c5 100644 --- a/third_party/terraform/website/docs/r/storage_bucket.html.markdown +++ b/third_party/terraform/website/docs/r/storage_bucket.html.markdown @@ -96,9 +96,7 @@ The `condition` block supports the following elements, and requires at least one * `created_before` - (Optional) Creation date of an object in RFC 3339 (e.g. `2017-06-13`) to satisfy this condition. -* `with_state` - (Optional) Match to live and/or archived objects. Unversioned buckets have only live objects. Supported values include: `"LIVE"`, `"ARCHIVED"`, `"ANY"`. Unset or empty strings will be treated as `ARCHIVED` to maintain backwards compatibility with `is_live`. - -* `is_live` - (Optional, Deprecated) Defaults to `false` to match archived objects. If `true`, this condition matches live objects. Unversioned buckets have only live objects. +* `with_state` - (Optional) Match to live and/or archived objects. Unversioned buckets have only live objects. Supported values include: `"LIVE"`, `"ARCHIVED"`, `"ANY"`. * `matches_storage_class` - (Optional) [Storage Class](https://cloud.google.com/storage/docs/storage-classes) of objects to satisfy this condition. Supported values include: `MULTI_REGIONAL`, `REGIONAL`, `NEARLINE`, `COLDLINE`, `STANDARD`, `DURABLE_REDUCED_AVAILABILITY`.