1
0
Fork 0
llvm-premerge-checks/terraform/main.tf

49 lines
1.4 KiB
Terraform
Raw Permalink Normal View History

2022-11-23 12:21:10 +01:00
#todo automatically rebuild buildkite images
resource "google_project_service" "cloudbuild_api" {
service = "cloudbuild.googleapis.com"
}
resource "google_storage_bucket" "terraform_state" {
2022-12-16 14:40:21 +01:00
name = "terraform-state-${var.project-id}"
2022-11-23 12:21:10 +01:00
location = "EU"
}
resource "google_compute_network" "vpc_network" {
name = "vpc-network"
auto_create_subnetworks = false
}
resource "google_compute_subnetwork" "vpc_subnetwork" {
name = "subnetwork"
ip_cidr_range = var.subnetwork-main-cidr
region = var.region
network = google_compute_network.vpc_network.id
secondary_ip_range {
range_name = "pods"
ip_cidr_range = var.subnetwork-pods-cidr
}
secondary_ip_range {
range_name = "services"
ip_cidr_range = var.subnetwork-services-cidr
}
}
resource "google_compute_router" "router" {
name = "router"
region = google_compute_subnetwork.vpc_subnetwork.region
network = google_compute_network.vpc_network.id
bgp {
2022-12-16 14:40:21 +01:00
asn = 64514 #todo recheck
2022-11-23 12:21:10 +01:00
}
}
resource "google_compute_router_nat" "nat" {
name = "router-nat"
router = google_compute_router.router.name
region = google_compute_router.router.region
nat_ip_allocate_option = "AUTO_ONLY"
source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
}