mirror of https://github.com/rancher/dartboard.git
Minor AWS module fixes (#19)
This commit is contained in:
parent
8984e241ef
commit
515b3ef1d0
|
|
@ -1,13 +1,14 @@
|
|||
locals {
|
||||
downstream_clusters = [
|
||||
downstream_clusters = flatten([
|
||||
for i, template in var.downstream_cluster_templates : [
|
||||
for j in range(template.cluster_count) : merge(template,{name_prefix = "${template.name_prefix}${i}-${j}"})
|
||||
]]
|
||||
for j in range(template.cluster_count) : merge(template, { name = "${template.name_prefix}${i}-${j}" })
|
||||
] if template.cluster_count > 0 ])
|
||||
all_clusters = flatten(concat([var.upstream_cluster],
|
||||
local.downstream_clusters,
|
||||
var.deploy_tester_cluster ? [var.tester_cluster] : []
|
||||
))
|
||||
|
||||
k3s_clusters = [for cluster in local.all_clusters : cluster if strcontains(cluster.distro_version, "k3s")]
|
||||
rke2_clusters = [for cluster in local.all_clusters : cluster if strcontains(cluster.distro_version, "rke2")]
|
||||
|
||||
k3s_clusters = [for i, cluster in local.all_clusters : merge(cluster, {name = "${cluster.name_prefix}-${i}"}) if strcontains(cluster.distro_version, "k3s")]
|
||||
rke2_clusters = [for i, cluster in local.all_clusters : merge(cluster, {name = "${cluster.name_prefix}-${i}"}) if strcontains(cluster.distro_version, "rke2")]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ module "k3s_cluster" {
|
|||
count = length(local.k3s_clusters)
|
||||
source = "../../modules/aws_k3s"
|
||||
project_name = var.project_name
|
||||
name = local.k3s_clusters[count.index].name_prefix
|
||||
name = local.k3s_clusters[count.index].name
|
||||
server_count = local.k3s_clusters[count.index].server_count
|
||||
agent_count = local.k3s_clusters[count.index].agent_count
|
||||
agent_labels = local.k3s_clusters[count.index].reserve_node_for_monitoring ? [
|
||||
|
|
@ -29,7 +29,7 @@ module "k3s_cluster" {
|
|||
] : []
|
||||
distro_version = local.k3s_clusters[count.index].distro_version
|
||||
|
||||
sans = ["${local.k3s_clusters[count.index].name_prefix}.local.gd"]
|
||||
sans = ["${local.k3s_clusters[count.index].name}.local.gd"]
|
||||
local_kubernetes_api_port = var.first_kubernetes_api_port + count.index
|
||||
tunnel_app_http_port = var.first_app_http_port + count.index
|
||||
tunnel_app_https_port = var.first_app_https_port + count.index
|
||||
|
|
@ -49,7 +49,7 @@ module "rke2_cluster" {
|
|||
count = length(local.rke2_clusters)
|
||||
source = "../../modules/aws_rke2"
|
||||
project_name = var.project_name
|
||||
name = local.rke2_clusters[count.index].name_prefix
|
||||
name = local.rke2_clusters[count.index].name
|
||||
server_count = local.rke2_clusters[count.index].server_count
|
||||
agent_count = local.rke2_clusters[count.index].agent_count
|
||||
agent_labels = local.rke2_clusters[count.index].reserve_node_for_monitoring ? [
|
||||
|
|
@ -60,7 +60,7 @@ module "rke2_cluster" {
|
|||
] : []
|
||||
distro_version = local.rke2_clusters[count.index].distro_version
|
||||
|
||||
sans = ["${local.rke2_clusters[count.index].name_prefix}.local.gd"]
|
||||
sans = ["${local.rke2_clusters[count.index].name}.local.gd"]
|
||||
local_kubernetes_api_port = var.first_kubernetes_api_port + length(local.k3s_clusters) + count.index
|
||||
tunnel_app_http_port = var.first_app_http_port + length(local.k3s_clusters) + count.index
|
||||
tunnel_app_https_port = var.first_app_https_port + length(local.k3s_clusters) + count.index
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
locals {
|
||||
k3s_outputs = { for i, cluster in local.k3s_clusters : cluster.name_prefix => {
|
||||
k3s_outputs = { for i, cluster in local.k3s_clusters : cluster.name => {
|
||||
kubeconfig = module.k3s_cluster[i].kubeconfig
|
||||
context = module.k3s_cluster[i].context
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ locals {
|
|||
https_port = 443
|
||||
}
|
||||
tunnel = { // resolvable from the host running OpenTofu
|
||||
name = "${cluster.name_prefix}.local.gd"
|
||||
name = "${cluster.name}.local.gd"
|
||||
http_port = module.k3s_cluster[i].tunnel_app_http_port
|
||||
https_port = module.k3s_cluster[i].tunnel_app_https_port
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ locals {
|
|||
https_port = 443
|
||||
}
|
||||
tunnel = { // resolvable from the host running OpenTofu
|
||||
name = "${cluster.name_prefix}.local.gd"
|
||||
name = "${cluster.name}.local.gd"
|
||||
http_port = module.rke2_cluster[i].tunnel_app_http_port
|
||||
https_port = module.rke2_cluster[i].tunnel_app_https_port
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ terraform {
|
|||
required_providers {
|
||||
aws = {
|
||||
source = "hashicorp/aws"
|
||||
version = "4.31.0"
|
||||
version = "5.74.0"
|
||||
}
|
||||
tls = {
|
||||
source = "hashicorp/tls"
|
||||
|
|
|
|||
|
|
@ -51,3 +51,4 @@ variable "bastion_host_instance_type" {
|
|||
description = "EC2 instance type"
|
||||
default = "t4g.small"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue