mirror of
https://github.com/optim-enterprises-bv/terraform-talos.git
synced 2025-10-31 18:28:32 +00:00
ovh tricks
This commit is contained in:
@@ -18,10 +18,8 @@ module "controlplane" {
|
||||
instance_tags = concat(var.tags, ["infra"])
|
||||
instance_secgroups = [local.network_secgroup[each.key].common, local.network_secgroup[each.key].controlplane]
|
||||
instance_params = merge(var.kubernetes, {
|
||||
lbv4 = local.lbv4
|
||||
# routes: ${indent(10,routes)}
|
||||
# routes = "\n${join("\n", formatlist("- network: %s", flatten([for zone in local.regions : local.network_subnets[zone] if zone != each.key])))}"
|
||||
|
||||
lbv4 = local.lbv4
|
||||
routes = "\n${join("\n", formatlist(" - network: %s", flatten([for zone in local.regions : local.network_subnets[zone]])))}"
|
||||
region = each.key
|
||||
auth = local.openstack_auth_url
|
||||
project_id = local.project_id
|
||||
|
||||
@@ -22,7 +22,7 @@ module "web" {
|
||||
ipv4_local_network = local.network[each.key].cidr
|
||||
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)
|
||||
# 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]
|
||||
|
||||
@@ -14,7 +14,7 @@ module "worker" {
|
||||
ipv4_local_network = local.network[each.key].cidr
|
||||
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)
|
||||
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]
|
||||
|
||||
@@ -80,7 +80,7 @@ resource "local_file" "worker" {
|
||||
merge(var.instance_params, {
|
||||
name = "${var.instance_name}-${lower(var.region)}-${count.index + 1}"
|
||||
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
|
||||
})
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ output "network" {
|
||||
value = { for zone, network in local.network_id : zone => {
|
||||
name = var.network_name
|
||||
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
|
||||
mtu = network.mtu
|
||||
} }
|
||||
@@ -33,6 +33,7 @@ output "network_public" {
|
||||
cidr = subnet.cidr
|
||||
cidr_v6 = openstack_networking_subnet_v2.private_v6[zone].cidr
|
||||
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
|
||||
} }
|
||||
}
|
||||
@@ -45,6 +46,7 @@ output "network_private" {
|
||||
cidr = subnet.cidr
|
||||
cidr_v6 = openstack_networking_subnet_v2.private_v6[zone].cidr
|
||||
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
|
||||
} }
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ machine:
|
||||
- ${ipv4_local}/24
|
||||
vip:
|
||||
ip: ${ipv4_local_vip}
|
||||
routes: ${routes}
|
||||
- interface: dummy0
|
||||
addresses:
|
||||
- 169.254.2.53/32
|
||||
|
||||
@@ -19,6 +19,10 @@ machine:
|
||||
network:
|
||||
hostname: "${name}"
|
||||
interfaces:
|
||||
- interface: ${iface}
|
||||
dhcp: true
|
||||
routes:
|
||||
${routes}
|
||||
- interface: dummy0
|
||||
addresses:
|
||||
- 169.254.2.53/32
|
||||
|
||||
@@ -19,7 +19,7 @@ locals {
|
||||
network = data.terraform_remote_state.prepare.outputs.network
|
||||
network_public = data.terraform_remote_state.prepare.outputs.network_public
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user