Skip to content

Commit

Permalink
Revert "Add Update Connector Support for VPC Access Connectors (#8205)…
Browse files Browse the repository at this point in the history
…" (#8456)

This reverts commit 85ff1c2.
  • Loading branch information
hao-nan-li authored Jul 27, 2023
1 parent 003a824 commit 7c8cf18
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 101 deletions.
26 changes: 9 additions & 17 deletions mmv1/products/vpcaccess/Connector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
name: 'Connector'
kind: 'vpcaccess#Connector'
description: 'Serverless VPC Access connector resource.'
immutable: true
base_url: projects/{{project}}/locations/{{region}}/connectors
create_url: projects/{{project}}/locations/{{region}}/connectors?connectorId={{name}}
update_verb: :PATCH
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Configuring Serverless VPC Access': 'https://cloud.google.com/vpc/docs/configure-serverless-vpc-access'
api: 'https://cloud.google.com/vpc/docs/reference/vpcaccess/rest/v1/projects.locations.connectors'
update_mask: true
async: !ruby/object:Api::OpAsync
operation: !ruby/object:Api::OpAsync::Operation
path: 'name'
Expand Down Expand Up @@ -56,8 +55,6 @@ custom_code: !ruby/object:Provider::Terraform::CustomCode
encoder: templates/terraform/encoders/no_send_name.go.erb
post_create: templates/terraform/post_create/sleep.go.erb
decoder: templates/terraform/decoders/long_name_to_self_link.go.erb
constants: templates/terraform/constants/connector.erb
resource_definition: templates/terraform/resource_definition/connector.erb
parameters:
- !ruby/object:Api::Type::String
name: 'region'
Expand All @@ -71,7 +68,6 @@ properties:
name: name
description: |
The name of the resource (Max 25 characters).
immutable: true
required: true
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb'
- !ruby/object:Api::Type::String
Expand All @@ -81,7 +77,6 @@ properties:
exactly_one_of:
- network
- subnet.0.name
immutable: true
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb'
custom_expand: 'templates/terraform/custom_expand/resource_from_self_link.go.erb'
diff_suppress_func: 'tpgresource.CompareResourceNames'
Expand All @@ -92,7 +87,6 @@ properties:
The range of internal addresses that follows RFC 4632 notation. Example: `10.132.0.0/28`.
required_with:
- network
immutable: true
- !ruby/object:Api::Type::Enum
name: state
description: |
Expand All @@ -108,36 +102,34 @@ properties:
name: machineType
description: |
Machine type of VM Instance underlying connector. Default is e2-micro
immutable: false
default_value: e2-micro
- !ruby/object:Api::Type::Integer
name: minThroughput
description: |
Minimum throughput of the connector in Mbps. Default and min is 200.
immutable: true
default_from_api: true
default_value: 200
validation: !ruby/object:Provider::Terraform::Validation
function: 'validation.IntBetween(200, 900)'
function: 'validation.IntBetween(200, 1000)'
- !ruby/object:Api::Type::Integer
name: minInstances
description: |
Minimum value of instances in autoscaling group underlying the connector.
immutable: false
default_from_api: true
- !ruby/object:Api::Type::Integer
name: maxInstances
description: |
Maximum value of instances in autoscaling group underlying the connector.
immutable: false
default_from_api: true
- !ruby/object:Api::Type::Integer
name: maxThroughput
# The API documentation says this will default to 200, but when I tried that I got an error that the minimum
# throughput must be lower than the maximum. The console defaults to 1000, so I changed it to that.
# API returns 300 if it is not sent
description: |
Maximum throughput of the connector in Mbps, must be greater than `min_throughput`. Default is 1000.
immutable: true
default_from_api: true
Maximum throughput of the connector in Mbps, must be greater than `min_throughput`. Default is 300.
default_value: 300
validation: !ruby/object:Provider::Terraform::Validation
function: 'validation.IntBetween(300, 1000)'
function: 'validation.IntBetween(200, 1000)'
- !ruby/object:Api::Type::String
name: 'selfLink'
description: |
Expand Down
4 changes: 0 additions & 4 deletions mmv1/templates/terraform/constants/connector.erb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
resource "google_vpc_access_connector" "connector" {
name = "<%= ctx[:vars]['name'] %>"
ip_cidr_range = "10.18.0.0/28"
ip_cidr_range = "10.8.0.0/28"
network = "default"
min_instances = 2
max_instances = 3
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ resource "google_vpc_access_connector" "connector" {
name = google_compute_subnetwork.custom_test.name
}
machine_type = "e2-standard-4"
min_instances = 2
max_instances = 3
}

resource "google_compute_subnetwork" "custom_test" {
Expand All @@ -18,4 +16,4 @@ resource "google_compute_subnetwork" "custom_test" {
resource "google_compute_network" "custom_test" {
name = "<%= ctx[:vars]['name'] %>"
auto_create_subnetworks = false
}
}
3 changes: 0 additions & 3 deletions mmv1/templates/terraform/resource_definition/connector.erb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ resource "google_vpc_access_connector" "connector" {
ip_cidr_range = "10.8.0.0/28"
network = "default"
region = "us-central1"
min_instances = 2
max_instances = 3
}
data "google_vpc_access_connector" "connector" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ resource "google_vpc_access_connector" "bar" {
region = "us-central1"
ip_cidr_range = "10.8.0.0/28"
network = "default"
min_instances = 3
max_instances = 10
}
resource "google_app_engine_standard_app_version" "foo" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,6 @@ resource "google_vpc_access_connector" "%s" {
region = "us-central1"
ip_cidr_range = "%s"
network = google_compute_network.vpc.name
min_instances = 3
max_instances = 10
}

resource "google_storage_bucket" "bucket" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,6 @@ func TestAccVPCAccessConnector_vpcAccessConnectorThroughput(t *testing.T) {
})
}

func TestAccVPCAccessConnector_vpcAccessConnectorMachineAndInstancesChanged(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"random_suffix": RandString(t, 10),
}

VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckVPCAccessConnectorDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccVPCAccessConnector_vpcAccessConnectorThroughput(context),
},
{
ResourceName: "google_vpc_access_connector.connector",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccVPCAccessConnector_vpcAccessConnectorMachineAndInstancesChanged(context),
},
{
ResourceName: "google_vpc_access_connector.connector",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccVPCAccessConnector_vpcAccessConnectorThroughput(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_vpc_access_connector" "connector" {
Expand All @@ -89,30 +57,3 @@ resource "google_compute_network" "custom_test" {
}
`, context)
}

func testAccVPCAccessConnector_vpcAccessConnectorMachineAndInstancesChanged(context map[string]interface{}) string {
return Nprintf(`
resource "google_vpc_access_connector" "connector" {
name = "tf-test-vpc-con%{random_suffix}"
subnet {
name = google_compute_subnetwork.custom_test.name
}
machine_type = "e2-micro"
min_instances = 3
max_instances = 5
region = "us-central1"
}
resource "google_compute_subnetwork" "custom_test" {
name = "tf-test-vpc-con%{random_suffix}"
ip_cidr_range = "10.2.0.0/28"
region = "us-central1"
network = google_compute_network.custom_test.id
}
resource "google_compute_network" "custom_test" {
name = "tf-test-vpc-con%{random_suffix}"
auto_create_subnetworks = false
}
`, context)
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ provider "google" {
}

resource "google_vpc_access_connector" "connector" {
name = "vpc-con"
ip_cidr_range = "10.8.0.0/28"
network = "default"
region = "us-central1"
max_throughput = 300
min_throughput = 200
name = "vpc-con"
ip_cidr_range = "10.8.0.0/28"
network = "default"
region = "us-central1"
}

0 comments on commit 7c8cf18

Please sign in to comment.