mirror of
https://github.com/optim-enterprises-bv/terraform-talos.git
synced 2025-11-01 10:48:36 +00:00
ovh tricks
This commit is contained in:
@@ -19,9 +19,7 @@ module "controlplane" {
|
|||||||
instance_secgroups = [local.network_secgroup[each.key].common, local.network_secgroup[each.key].controlplane]
|
instance_secgroups = [local.network_secgroup[each.key].common, local.network_secgroup[each.key].controlplane]
|
||||||
instance_params = merge(var.kubernetes, {
|
instance_params = merge(var.kubernetes, {
|
||||||
lbv4 = local.lbv4
|
lbv4 = local.lbv4
|
||||||
# routes: ${indent(10,routes)}
|
routes = "\n${join("\n", formatlist(" - network: %s", flatten([for zone in local.regions : local.network_subnets[zone]])))}"
|
||||||
# routes = "\n${join("\n", formatlist("- network: %s", flatten([for zone in local.regions : local.network_subnets[zone] if zone != each.key])))}"
|
|
||||||
|
|
||||||
region = each.key
|
region = each.key
|
||||||
auth = local.openstack_auth_url
|
auth = local.openstack_auth_url
|
||||||
project_id = local.project_id
|
project_id = local.project_id
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ module "web" {
|
|||||||
ipv4_local_network = local.network[each.key].cidr
|
ipv4_local_network = local.network[each.key].cidr
|
||||||
ipv4_local_gw = local.network_public[each.key].gateway
|
ipv4_local_gw = local.network_public[each.key].gateway
|
||||||
lbv4 = module.controlplane[each.key].controlplane_lb != "" ? module.controlplane[each.key].controlplane_lb : one(local.lbv4s)
|
lbv4 = module.controlplane[each.key].controlplane_lb != "" ? module.controlplane[each.key].controlplane_lb : one(local.lbv4s)
|
||||||
# routes = "\n${join("\n", formatlist("- network: %s", flatten([for zone in local.regions : local.network_subnets[zone] if zone != each.key])))}"
|
routes = "${join("\n ", formatlist("- network: %s", flatten([for zone in local.regions : local.network_subnets[zone]])))}"
|
||||||
})
|
})
|
||||||
|
|
||||||
network_internal = local.network_public[each.key]
|
network_internal = local.network_public[each.key]
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module "worker" {
|
|||||||
ipv4_local_network = local.network[each.key].cidr
|
ipv4_local_network = local.network[each.key].cidr
|
||||||
ipv4_local_gw = local.network_private[each.key].gateway
|
ipv4_local_gw = local.network_private[each.key].gateway
|
||||||
lbv4 = module.controlplane[each.key].controlplane_lb != "" ? module.controlplane[each.key].controlplane_lb : one(local.lbv4s)
|
lbv4 = module.controlplane[each.key].controlplane_lb != "" ? module.controlplane[each.key].controlplane_lb : one(local.lbv4s)
|
||||||
routes = "\n${join("\n", formatlist("- network: %s", flatten([for zone in local.regions : local.network_subnets[zone] if zone != each.key])))}"
|
routes = "${join("\n ", formatlist("- network: %s", flatten([for zone in local.regions : local.network_subnets[zone]])))}"
|
||||||
})
|
})
|
||||||
|
|
||||||
network_internal = local.network_private[each.key]
|
network_internal = local.network_private[each.key]
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ resource "local_file" "worker" {
|
|||||||
merge(var.instance_params, {
|
merge(var.instance_params, {
|
||||||
name = "${var.instance_name}-${lower(var.region)}-${count.index + 1}"
|
name = "${var.instance_name}-${lower(var.region)}-${count.index + 1}"
|
||||||
labels = local.worker_labels
|
labels = local.worker_labels
|
||||||
iface = try(var.network_external.name, "") == "" ? "eth0" : "eth1"
|
iface = length(try(var.network_external, {})) == 0 ? "eth0" : "eth1"
|
||||||
nodeSubnets = var.network_internal.cidr
|
nodeSubnets = var.network_internal.cidr
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ output "network" {
|
|||||||
value = { for zone, network in local.network_id : zone => {
|
value = { for zone, network in local.network_id : zone => {
|
||||||
name = var.network_name
|
name = var.network_name
|
||||||
id = network.id
|
id = network.id
|
||||||
cidr = var.network_cidr
|
cidr = cidrsubnet(var.network_cidr, 6, (var.network_shift + index(var.regions, zone)))
|
||||||
cidr_v6 = local.network_cidr_v6
|
cidr_v6 = local.network_cidr_v6
|
||||||
mtu = network.mtu
|
mtu = network.mtu
|
||||||
} }
|
} }
|
||||||
@@ -33,6 +33,7 @@ output "network_public" {
|
|||||||
cidr = subnet.cidr
|
cidr = subnet.cidr
|
||||||
cidr_v6 = openstack_networking_subnet_v2.private_v6[zone].cidr
|
cidr_v6 = openstack_networking_subnet_v2.private_v6[zone].cidr
|
||||||
gateway = subnet.gateway_ip != "" ? subnet.gateway_ip : cidrhost(subnet.cidr, 1)
|
gateway = subnet.gateway_ip != "" ? subnet.gateway_ip : cidrhost(subnet.cidr, 1)
|
||||||
|
gateway_v6 = cidrhost(openstack_networking_subnet_v2.private_v6[zone].cidr, 1)
|
||||||
mtu = local.network_id[zone].mtu
|
mtu = local.network_id[zone].mtu
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
@@ -45,6 +46,7 @@ output "network_private" {
|
|||||||
cidr = subnet.cidr
|
cidr = subnet.cidr
|
||||||
cidr_v6 = openstack_networking_subnet_v2.private_v6[zone].cidr
|
cidr_v6 = openstack_networking_subnet_v2.private_v6[zone].cidr
|
||||||
gateway = subnet.gateway_ip != "" ? subnet.gateway_ip : cidrhost(subnet.cidr, 1)
|
gateway = subnet.gateway_ip != "" ? subnet.gateway_ip : cidrhost(subnet.cidr, 1)
|
||||||
|
gateway_v6 = cidrhost(openstack_networking_subnet_v2.private_v6[zone].cidr, 1)
|
||||||
mtu = local.network_id[zone].mtu
|
mtu = local.network_id[zone].mtu
|
||||||
} }
|
} }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ machine:
|
|||||||
- ${ipv4_local}/24
|
- ${ipv4_local}/24
|
||||||
vip:
|
vip:
|
||||||
ip: ${ipv4_local_vip}
|
ip: ${ipv4_local_vip}
|
||||||
|
routes: ${routes}
|
||||||
- interface: dummy0
|
- interface: dummy0
|
||||||
addresses:
|
addresses:
|
||||||
- 169.254.2.53/32
|
- 169.254.2.53/32
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ machine:
|
|||||||
network:
|
network:
|
||||||
hostname: "${name}"
|
hostname: "${name}"
|
||||||
interfaces:
|
interfaces:
|
||||||
|
- interface: ${iface}
|
||||||
|
dhcp: true
|
||||||
|
routes:
|
||||||
|
${routes}
|
||||||
- interface: dummy0
|
- interface: dummy0
|
||||||
addresses:
|
addresses:
|
||||||
- 169.254.2.53/32
|
- 169.254.2.53/32
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ locals {
|
|||||||
network = data.terraform_remote_state.prepare.outputs.network
|
network = data.terraform_remote_state.prepare.outputs.network
|
||||||
network_public = data.terraform_remote_state.prepare.outputs.network_public
|
network_public = data.terraform_remote_state.prepare.outputs.network_public
|
||||||
network_private = data.terraform_remote_state.prepare.outputs.network_private
|
network_private = data.terraform_remote_state.prepare.outputs.network_private
|
||||||
network_subnets = { for zone in local.regions : zone => [local.network_public[zone].cidr, local.network_private[zone].cidr] }
|
network_subnets = { for zone in local.regions : zone => [local.network[zone].cidr] }
|
||||||
|
|
||||||
network_secgroup = data.terraform_remote_state.prepare.outputs.network_secgroup
|
network_secgroup = data.terraform_remote_state.prepare.outputs.network_secgroup
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user