Skip to content

Commit

Permalink
fixed default for max_throughput (#4823) (#3294)
Browse files Browse the repository at this point in the history
* fixed default for max_throughput

* updated a test

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jun 2, 2021
1 parent fbb7844 commit 492da84
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .changelog/4823.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
vpcaccess: fixed permadiff when `max_throughput` is not set on `google_vpc_access_connector`
```
3 changes: 1 addition & 2 deletions google-beta/resource_dataproc_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions google-beta/resource_vpc_access_connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
61 changes: 61 additions & 0 deletions google-beta/resource_vpc_access_connector_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
2 changes: 1 addition & 1 deletion website/docs/r/vpc_access_connector.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 492da84

Please sign in to comment.