diff --git a/.changelog/4394.txt b/.changelog/4394.txt new file mode 100644 index 0000000000..d07d3afe30 --- /dev/null +++ b/.changelog/4394.txt @@ -0,0 +1,9 @@ +```release-note:enhancement +memcache: fixed an issue where `google_memcached_instance` resource was not inferring the region from the provider. +``` +```release-note:enhancement +vpcaccess: fixed an issue where `google_vpc_access_connector` resource was not inferring the region from the provider. +``` +```release-note:enhancement +tpu: fixed an issue where `google_tpu_node` resource was not inferring the zone from the provider. +``` diff --git a/google-beta/resource_memcache_instance.go b/google-beta/resource_memcache_instance.go index 7dd3146db8..ec675b1283 100644 --- a/google-beta/resource_memcache_instance.go +++ b/google-beta/resource_memcache_instance.go @@ -76,12 +76,6 @@ func resourceMemcacheInstance() *schema.Resource { Required: true, Description: `Number of nodes in the memcache instance.`, }, - "region": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The name of the Memcache region of the instance.`, - }, "authorized_network": { Type: schema.TypeString, Optional: true, @@ -132,6 +126,13 @@ Currently the latest supported major version is MEMCACHE_1_5. The minor version determined by our system based on the latest supported minor version. Default value: "MEMCACHE_1_5" Possible values: ["MEMCACHE_1_5"]`, Default: "MEMCACHE_1_5", }, + "region": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + Description: `The region of the Memcache instance. If it is not provided, the provider region is used.`, + }, "zones": { Type: schema.TypeSet, Computed: true, @@ -350,14 +351,6 @@ func resourceMemcacheInstanceRead(d *schema.ResourceData, meta interface{}) erro return fmt.Errorf("Error reading Instance: %s", err) } - region, err := getRegion(d, config) - if err != nil { - return err - } - if err := d.Set("region", region); err != nil { - return fmt.Errorf("Error reading Instance: %s", err) - } - if err := d.Set("display_name", flattenMemcacheInstanceDisplayName(res["displayName"], d, config)); err != nil { return fmt.Errorf("Error reading Instance: %s", err) } diff --git a/google-beta/resource_memcache_instance_generated_test.go b/google-beta/resource_memcache_instance_generated_test.go index 16702b58f0..654f5e0a51 100644 --- a/google-beta/resource_memcache_instance_generated_test.go +++ b/google-beta/resource_memcache_instance_generated_test.go @@ -71,7 +71,6 @@ resource "google_service_networking_connection" "private_service_connection" { resource "google_memcache_instance" "instance" { provider = google-beta name = "tf-test-test-instance%{random_suffix}" - region = "us-central1" authorized_network = google_service_networking_connection.private_service_connection.network node_config { diff --git a/google-beta/resource_tpu_node.go b/google-beta/resource_tpu_node.go index 24c6b48a30..dbc2585322 100644 --- a/google-beta/resource_tpu_node.go +++ b/google-beta/resource_tpu_node.go @@ -110,12 +110,6 @@ func resourceTPUNode() *schema.Resource { Required: true, Description: `The version of Tensorflow running in the Node.`, }, - "zone": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `The GCP location for the TPU.`, - }, "cidr_block": { Type: schema.TypeString, Computed: true, @@ -186,6 +180,13 @@ TPU Node to is a Shared VPC network, the node must be created with this this fie Default: false, ConflictsWith: []string{"cidr_block"}, }, + "zone": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + Description: `The GCP location for the TPU. If it is not provided, the provider zone is used.`, + }, "network_endpoints": { Type: schema.TypeList, Computed: true, diff --git a/google-beta/resource_vpc_access_connector.go b/google-beta/resource_vpc_access_connector.go index 6ca8f94dbb..9f6b87a0ba 100644 --- a/google-beta/resource_vpc_access_connector.go +++ b/google-beta/resource_vpc_access_connector.go @@ -59,12 +59,6 @@ func resourceVPCAccessConnector() *schema.Resource { ForceNew: true, Description: `Name of a VPC network.`, }, - "region": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - Description: `Region where the VPC Access connector resides`, - }, "max_throughput": { Type: schema.TypeInt, Optional: true, @@ -81,6 +75,13 @@ func resourceVPCAccessConnector() *schema.Resource { Description: `Minimum throughput of the connector in Mbps. Default and min is 200.`, Default: 200, }, + "region": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + Description: `Region where the VPC Access connector resides. If it is not provided, the provider region is used.`, + }, "self_link": { Type: schema.TypeString, Computed: true, diff --git a/google-beta/resource_vpc_access_connector_generated_test.go b/google-beta/resource_vpc_access_connector_generated_test.go index 37edce3e17..74829ec1a7 100644 --- a/google-beta/resource_vpc_access_connector_generated_test.go +++ b/google-beta/resource_vpc_access_connector_generated_test.go @@ -55,7 +55,6 @@ func testAccVPCAccessConnector_vpcAccessConnectorExample(context map[string]inte return Nprintf(` resource "google_vpc_access_connector" "connector" { name = "tf-test-vpc-con%{random_suffix}" - region = "us-central1" ip_cidr_range = "10.8.0.0/28" network = "default" } diff --git a/website/docs/r/memcache_instance.html.markdown b/website/docs/r/memcache_instance.html.markdown index b05246e11d..229abf404c 100644 --- a/website/docs/r/memcache_instance.html.markdown +++ b/website/docs/r/memcache_instance.html.markdown @@ -66,7 +66,6 @@ resource "google_service_networking_connection" "private_service_connection" { resource "google_memcache_instance" "instance" { provider = google-beta name = "test-instance" - region = "us-central1" authorized_network = google_service_networking_connection.private_service_connection.network node_config { @@ -96,10 +95,6 @@ The following arguments are supported: Configuration for memcache nodes. Structure is documented below. -* `region` - - (Required) - The name of the Memcache region of the instance. - The `node_config` block supports: @@ -145,6 +140,10 @@ The `node_config` block supports: User-specified parameters for this memcache instance. Structure is documented below. +* `region` - + (Optional) + The region of the Memcache instance. If it is not provided, the provider region is used. + * `project` - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used. diff --git a/website/docs/r/tpu_node.html.markdown b/website/docs/r/tpu_node.html.markdown index d027ee06d6..d5d73fd71f 100644 --- a/website/docs/r/tpu_node.html.markdown +++ b/website/docs/r/tpu_node.html.markdown @@ -123,10 +123,6 @@ The following arguments are supported: (Required) The version of Tensorflow running in the Node. -* `zone` - - (Required) - The GCP location for the TPU. - - - - @@ -169,6 +165,10 @@ The following arguments are supported: (Optional) Resource labels to represent user provided metadata. +* `zone` - + (Optional) + The GCP location for the TPU. If it is not provided, the provider zone is used. + * `project` - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used. diff --git a/website/docs/r/vpc_access_connector.html.markdown b/website/docs/r/vpc_access_connector.html.markdown index a2c60dc8b4..12af814ceb 100644 --- a/website/docs/r/vpc_access_connector.html.markdown +++ b/website/docs/r/vpc_access_connector.html.markdown @@ -42,7 +42,6 @@ To get more information about Connector, see: ```hcl resource "google_vpc_access_connector" "connector" { name = "vpc-con" - region = "us-central1" ip_cidr_range = "10.8.0.0/28" network = "default" } @@ -65,10 +64,6 @@ The following arguments are supported: (Required) The range of internal addresses that follows RFC 4632 notation. Example: `10.132.0.0/28`. -* `region` - - (Required) - Region where the VPC Access connector resides - - - - @@ -81,6 +76,10 @@ The following arguments are supported: (Optional) Maximum throughput of the connector in Mbps, must be greater than `min_throughput`. Default is 1000. +* `region` - + (Optional) + Region where the VPC Access connector resides. If it is not provided, the provider region is used. + * `project` - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.