terraform-google-modules / terraform-google-network

Sets up a new VPC network on Google Cloud
https://registry.terraform.io/modules/terraform-google-modules/network/google
Apache License 2.0
411 stars 1.23k forks source link

feat: add min_throughput to vpc-serverless-connector-beta #567

Open soringumeni1 opened 1 month ago

soringumeni1 commented 1 month ago

Expose the min_throughput argument of the google_vpc_access_connector.

google-cla[bot] commented 1 month ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

imrannayer commented 1 week ago

@soringumeni1 thx for the PR. Can u plz resolve conflict?

soringumeni1 commented 1 week ago

Hi @imrannayer . Many thanks for looking into this. I have resolved the conflict and updated the PR. Let me know if you need anything else

imrannayer commented 1 week ago

/gcbrun

imrannayer commented 1 week ago

@soringumeni1 integration test failing.

TestSubmoduleServerlessConnector 2024-08-30T15:45:53Z terraform.go:271: Running tests TF configs in /workspace/examples/submodule_vpc_serverless_connector with version 1.9.5
2024/08/30 15:45:53 RUN_STAGE env var set to apply
2024/08/30 15:45:53 Skipping stage init
2024/08/30 15:45:53 RUN_STAGE env var set to apply
2024/08/30 15:45:53 Skipping stage plan
2024/08/30 15:45:53 RUN_STAGE env var set to apply
2024/08/30 15:45:53 Running stage apply
TestSubmoduleServerlessConnector 2024-08-30T15:45:53Z retry.go:91: terraform [apply -input=false -auto-approve -no-color -lock=false]
TestSubmoduleServerlessConnector 2024-08-30T15:45:53Z command.go:100: Running command terraform with args [apply -input=false -auto-approve -no-color -lock=false]
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: Terraform used the selected providers to generate the following execution
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: plan. Resource actions are indicated with the following symbols:
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   + create
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: Terraform planned the following actions, but then encountered a problem:
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   # google_project_service.vpcaccess-api will be created
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   + resource "google_project_service" "vpcaccess-api" {
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + disable_on_destroy = true
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + id                 = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + project            = "ci-network-6b44"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + service            = "vpcaccess.googleapis.com"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:     }
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   # module.test-vpc-module.module.subnets.google_compute_subnetwork.subnetwork["us-central1/serverless-subnet"] will be created
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   + resource "google_compute_subnetwork" "subnetwork" {
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + creation_timestamp         = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + external_ipv6_prefix       = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + fingerprint                = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + gateway_address            = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + id                         = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + internal_ipv6_prefix       = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + ip_cidr_range              = "10.10.10.0/28"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + ipv6_cidr_range            = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + name                       = "serverless-subnet"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + network                    = "my-serverless-network"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + private_ip_google_access   = false
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + private_ipv6_google_access = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + project                    = "ci-network-6b44"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + purpose                    = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + region                     = "us-central1"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + self_link                  = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + stack_type                 = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + secondary_ip_range (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:     }
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   # module.test-vpc-module.module.vpc.google_compute_network.network will be created
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   + resource "google_compute_network" "network" {
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + auto_create_subnetworks                   = false
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + delete_default_routes_on_create           = false
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + enable_ula_internal_ipv6                  = false
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + gateway_ipv4                              = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + id                                        = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + internal_ipv6_range                       = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + mtu                                       = 1460
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + name                                      = "my-serverless-network"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + network_firewall_policy_enforcement_order = "AFTER_CLASSIC_FIREWALL"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + numeric_id                                = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + project                                   = "ci-network-6b44"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + routing_mode                              = "GLOBAL"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:       + self_link                                 = (known after apply)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:         # (1 unchanged attribute hidden)
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:     }
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: Plan: 3 to add, 0 to change, 0 to destroy.
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: Changes to Outputs:
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   + project_id = "ci-network-6b44"
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: Error: Unsupported attribute
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   on ../../modules/vpc-serverless-connector-beta/main.tf line 37, in resource "google_vpc_access_connector" "connector_beta":
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:   37:   min_throughput = each.value.min_throughput
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:     ├────────────────
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185:     │ each.value is object with 10 attributes
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: 
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z command.go:185: This object does not have an attribute named "min_throughput".
TestSubmoduleServerlessConnector 2024-08-30T15:46:06Z retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; 
Error: Unsupported attribute

  on ../../modules/vpc-serverless-connector-beta/main.tf line 37, in resource "google_vpc_access_connector" "connector_beta":
  37:   min_throughput = each.value.min_throughput
    ├────────────────
    │ each.value is object with 10 attributes

This object does not have an attribute named "min_throughput".}
soringumeni1 commented 1 week ago

Hi Imran, I don't know what provider version you might be using for the tests, but google_vpc_access_connector has an argument for min_throughput. [min_throughput](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/vpc_access_connector#min_throughput) - (Optional) Minimum throughput of the connector in Mbps. Default and min is 200. Refers to the expected throughput when using an e2-micro machine type. Value must be a multiple of 100 from 200 through 900. Must be lower than the value specified by max_throughput. If both min_throughput and min_instances are provided, min_instances takes precedence over min_throughput. The use of min_throughput is discouraged in favor of min_instances. This is the URL to the documentation: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/vpc_access_connector.

Please let me know if you need anything else.

imrannayer commented 1 week ago

@soringumeni1

TestSubmoduleServerlessConnector 2024-08-30T15:45:53Z command.go:185:     "registry.terraform.io/hashicorp/google": "6.0.1",
TestSubmoduleServerlessConnector 2024-08-30T15:45:53Z command.go:185:     "registry.terraform.io/hashicorp/google-beta": "6.0.1",
imrannayer commented 1 week ago

@soringumeni1 it is not a provider issue. Seems like when u dont pass value for min throughput code is not able to handle it