From 8aa59d76d9b54331ebca4f271e1128e695fc119a Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Wed, 2 Jun 2021 18:57:30 +0000 Subject: [PATCH] fixed default for max_throughput (#4823) * fixed default for max_throughput * updated a test Signed-off-by: Modular Magician --- .changelog/4823.txt | 3 + google-beta/resource_dataproc_cluster_test.go | 3 +- google-beta/resource_vpc_access_connector.go | 4 +- .../resource_vpc_access_connector_test.go | 61 +++++++++++++++++++ .../docs/r/vpc_access_connector.html.markdown | 2 +- 5 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 .changelog/4823.txt create mode 100644 google-beta/resource_vpc_access_connector_test.go diff --git a/.changelog/4823.txt b/.changelog/4823.txt new file mode 100644 index 0000000000..b36504610c --- /dev/null +++ b/.changelog/4823.txt @@ -0,0 +1,3 @@ +```release-note:bug +vpcaccess: fixed permadiff when `max_throughput` is not set on `google_vpc_access_connector` +``` diff --git a/google-beta/resource_dataproc_cluster_test.go b/google-beta/resource_dataproc_cluster_test.go index ab4878c979..e2592b3a32 100644 --- a/google-beta/resource_dataproc_cluster_test.go +++ b/google-beta/resource_dataproc_cluster_test.go @@ -13,9 +13,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" - "google.golang.org/api/googleapi" - dataproc "google.golang.org/api/dataproc/v1beta2" + "google.golang.org/api/googleapi" ) func TestDataprocExtractInitTimeout(t *testing.T) { diff --git a/google-beta/resource_vpc_access_connector.go b/google-beta/resource_vpc_access_connector.go index 8e6c885630..90d385f0f4 100644 --- a/google-beta/resource_vpc_access_connector.go +++ b/google-beta/resource_vpc_access_connector.go @@ -73,8 +73,8 @@ func resourceVPCAccessConnector() *schema.Resource { Optional: true, ForceNew: true, ValidateFunc: validation.IntBetween(200, 1000), - Description: `Maximum throughput of the connector in Mbps, must be greater than 'min_throughput'. Default is 1000.`, - Default: 1000, + Description: `Maximum throughput of the connector in Mbps, must be greater than 'min_throughput'. Default is 300.`, + Default: 300, }, "min_instances": { Type: schema.TypeInt, diff --git a/google-beta/resource_vpc_access_connector_test.go b/google-beta/resource_vpc_access_connector_test.go new file mode 100644 index 0000000000..fc705cfaa8 --- /dev/null +++ b/google-beta/resource_vpc_access_connector_test.go @@ -0,0 +1,61 @@ +package google + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccVPCAccessConnector_vpcAccessConnectorThroughput(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": randString(t, 10), + } + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProvidersOiCS, + CheckDestroy: testAccCheckVPCAccessConnectorDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccVPCAccessConnector_vpcAccessConnectorThroughput(context), + }, + { + ResourceName: "google_vpc_access_connector.connector", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func testAccVPCAccessConnector_vpcAccessConnectorThroughput(context map[string]interface{}) string { + return Nprintf(` +resource "google_vpc_access_connector" "connector" { + provider = google-beta + name = "tf-test-vpc-con%{random_suffix}" + subnet { + name = google_compute_subnetwork.custom_test.name + } + machine_type = "e2-standard-4" + min_instances = 2 + max_instances = 3 + region = "us-central1" +} + +resource "google_compute_subnetwork" "custom_test" { + provider = google-beta + 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" { + provider = google-beta + name = "tf-test-vpc-con%{random_suffix}" + auto_create_subnetworks = false +} +`, context) +} diff --git a/website/docs/r/vpc_access_connector.html.markdown b/website/docs/r/vpc_access_connector.html.markdown index 37294ba6ca..fc17047e2f 100644 --- a/website/docs/r/vpc_access_connector.html.markdown +++ b/website/docs/r/vpc_access_connector.html.markdown @@ -118,7 +118,7 @@ The following arguments are supported: * `max_throughput` - (Optional) - Maximum throughput of the connector in Mbps, must be greater than `min_throughput`. Default is 1000. + Maximum throughput of the connector in Mbps, must be greater than `min_throughput`. Default is 300. * `subnet` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html))