|
| 1 | +/** |
| 2 | + * Copyright 2021 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +provider "google" { |
| 18 | + version = "~> 3.62" |
| 19 | +} |
| 20 | + |
| 21 | +provider "google-beta" { |
| 22 | + version = "~> 3.62" |
| 23 | +} |
| 24 | + |
| 25 | +module "test-vpc-module" { |
| 26 | + source = "terraform-google-modules/network/google" |
| 27 | + version = "~> 3.2.0" |
| 28 | + project_id = var.project_id # Replace this with your project ID in quotes |
| 29 | + network_name = "my-serverless-network" |
| 30 | + mtu = 1460 |
| 31 | + |
| 32 | + subnets = [ |
| 33 | + { |
| 34 | + subnet_name = "serverless-subnet" |
| 35 | + subnet_ip = "10.10.10.0/28" |
| 36 | + subnet_region = "us-central1" |
| 37 | + } |
| 38 | + ] |
| 39 | +} |
| 40 | + |
| 41 | +module "serverless-connector" { |
| 42 | + source = "../../modules/vpc-serverless-connector-beta" |
| 43 | + project_id = var.project_id |
| 44 | + vpc_connectors = [{ |
| 45 | + name = "central-serverless" |
| 46 | + region = "us-central1" |
| 47 | + subnet_name = module.test-vpc-module.subnets["us-central1/serverless-subnet"].name |
| 48 | + # host_project_id = var.host_project_id # Leverage host_project_id if using a shared VPC |
| 49 | + machine_type = "e2-standard-4" |
| 50 | + min_instances = 2 |
| 51 | + max_instances = 7 |
| 52 | + } |
| 53 | + # Uncomment below to leverage ip_cidr_range |
| 54 | + # , { |
| 55 | + # name = "central-serverless2" |
| 56 | + # region = "us-central1" |
| 57 | + # network = module.test-vpc-module.network_name |
| 58 | + # ip_cidr_range = "10.10.11.0/28" |
| 59 | + # subnet_name = null |
| 60 | + # machine_type = "e2-standard-4" |
| 61 | + # min_instances = 2 |
| 62 | + # max_instances = 7 } |
| 63 | + ] |
| 64 | +} |
0 commit comments