This is an updated version of the previous [GCP terraform](https://github.com/fleetdm/fleet/tree/main/infrastructure/dogfood/terraform/gcp) with more options and updated usage of modules and Cloud Run (v1 -> v2) which means we were able to ditch the manged VPC connectors (extra cost) and go with the VPC direct access. I think now that I have cloud run jobs figured out we'll be able to add a proper migration addon or module.
31 lines
647 B
Terraform
31 lines
647 B
Terraform
# Example from your vpc.tf (ensure this part is correct)
|
|
|
|
|
|
locals {
|
|
network_name = "${var.prefix}-network"
|
|
subnet_name = "${var.prefix}-subnet"
|
|
}
|
|
|
|
|
|
module "vpc" {
|
|
source = "terraform-google-modules/network/google"
|
|
version = "11.0.0"
|
|
|
|
project_id = var.project_id
|
|
network_name = var.vpc_config.network_name
|
|
subnets = var.vpc_config.subnets
|
|
}
|
|
|
|
module "cloud_router" {
|
|
source = "terraform-google-modules/cloud-router/google"
|
|
version = "7.0"
|
|
name = "${var.prefix}-cloud-router"
|
|
project = var.project_id
|
|
network = module.vpc.network_name
|
|
region = var.region
|
|
|
|
nats = [{
|
|
name = "${var.prefix}-vpc-nat"
|
|
}]
|
|
}
|