File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11data "google_project" "current" {}
22
3+ locals {
4+ dev_subnet = format (" %s-plural-dev" , var. cluster_name )
5+ prod_subnet = format (" %s-plural-prod" , var. cluster_name )
6+ }
7+
38module "network_dev" {
49 source = " terraform-google-modules/network/google"
510 version = " >= 7.5"
@@ -9,14 +14,14 @@ module "network_dev" {
914
1015 subnets = [
1116 {
12- subnet_name = format ( " %s-plural-dev " , var . cluster_name )
17+ subnet_name = local.dev_subnet
1318 subnet_ip = var.subnet_cidr
1419 subnet_region = var.region
1520 },
1621 ]
1722
1823 secondary_ranges = {
19- plural-dev-subnet = [
24+ (local . dev_subnet ) = [
2025 {
2126 range_name = var.ip_range_pods_name
2227 ip_cidr_range = var.pods_cidr
@@ -38,14 +43,14 @@ module "network_prod" {
3843
3944 subnets = [
4045 {
41- subnet_name = format ( " %s-plural-prod " , var . cluster_name )
46+ subnet_name = local.prod_subnet
4247 subnet_ip = var.subnet_cidr
4348 subnet_region = var.region
4449 },
4550 ]
4651
4752 secondary_ranges = {
48- plural-prod-subnet = [
53+ (local . prod_subnet ) = [
4954 {
5055 range_name = var.ip_range_pods_name
5156 ip_cidr_range = var.pods_cidr
Original file line number Diff line number Diff line change @@ -7,5 +7,6 @@ resource "plural_service_context" "mgmt" {
77 network = local.vpc.network
88 subnetwork = local.vpc.subnetwork
99 cidr = var.subnet_cidr
10+ project_id = local.project_id
1011 })
1112}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ resource "google_service_account" "externaldns" {
22 account_id = " ${ var . cluster } -externaldns"
33 display_name = substr (" GCP SA bound to K8S SA ${ local . project_id } [external-dns]" , 0 , 100 )
44 description = " GCP SA bound to K8S SA ${ local . project_id } [external-dns]"
5+ project = local. project_id
56 create_ignore_already_exists = true
67}
78
Original file line number Diff line number Diff line change @@ -2,11 +2,16 @@ data "plural_service_context" "network" {
22 name = " plrl/vpc/${ var . tier } "
33}
44
5+ data "plural_service_context" "mgmt" {
6+ name = " plrl/clusters/mgmt"
7+ }
8+
59data "google_client_config" "current" {}
610
711locals {
8- project_id = data. google_client_config . current . project
9- vpc = jsondecode (data. plural_service_context . network . configuration )
12+ mgmt = jsondecode (data. plural_service_context . mgmt . configuration )
13+ project_id = local. mgmt . project_id
14+ vpc = jsondecode (data. plural_service_context . network . configuration )
1015}
1116
1217module "gke" {
@@ -21,8 +26,8 @@ module "gke" {
2126 region = var. region
2227 network = local. vpc . network
2328 subnetwork = local. vpc . subnetwork
24- ip_range_pods = local. vpc . ip_range_pods_name
25- ip_range_services = local. vpc . ip_range_services_name
29+ ip_range_pods = local. vpc . ip_range_pods
30+ ip_range_services = local. vpc . ip_range_services
2631 create_service_account = true
2732 deletion_protection = false
2833 node_pools = var. node_pools
You can’t perform that action at this time.
0 commit comments