Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent locations in some resources - Part II #2863

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changelog/4394.txt
Original file line number Diff line number Diff line change
@@ -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.
```
21 changes: 7 additions & 14 deletions google-beta/resource_memcache_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
Expand Down
1 change: 0 additions & 1 deletion google-beta/resource_memcache_instance_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 7 additions & 6 deletions google-beta/resource_tpu_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
13 changes: 7 additions & 6 deletions google-beta/resource_vpc_access_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
9 changes: 4 additions & 5 deletions website/docs/r/memcache_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -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.

Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/tpu_node.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.


- - -

Expand Down Expand Up @@ -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.

Expand Down
9 changes: 4 additions & 5 deletions website/docs/r/vpc_access_connector.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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


- - -

Expand All @@ -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.

Expand Down