reduced number of words in names and remove cluster name in node names
This commit is contained in:
parent
5cf6f9eef4
commit
385bd788be
@ -1,5 +1,6 @@
|
|||||||
resource "random_pet" "agents" {
|
resource "random_pet" "agents" {
|
||||||
for_each = local.agent_nodepools
|
for_each = local.agent_nodepools
|
||||||
|
length = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
module "agents" {
|
module "agents" {
|
||||||
@ -7,7 +8,7 @@ module "agents" {
|
|||||||
|
|
||||||
for_each = local.agent_nodepools
|
for_each = local.agent_nodepools
|
||||||
|
|
||||||
name = "${each.key}-${random_pet.cluster.id}-${random_pet.agents[each.key].id}"
|
name = "${each.value.nodepool_name}-${random_pet.agents[each.key].id}"
|
||||||
ssh_keys = [hcloud_ssh_key.k3s.id]
|
ssh_keys = [hcloud_ssh_key.k3s.id]
|
||||||
public_key = var.public_key
|
public_key = var.public_key
|
||||||
private_key = var.private_key
|
private_key = var.private_key
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
resource "random_pet" "control_planes" {
|
resource "random_pet" "control_planes" {
|
||||||
count = var.control_plane_count
|
count = var.control_plane_count
|
||||||
|
length = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
module "control_planes" {
|
module "control_planes" {
|
||||||
source = "./modules/host"
|
source = "./modules/host"
|
||||||
|
|
||||||
count = var.control_plane_count
|
count = var.control_plane_count
|
||||||
name = "control-plane-${random_pet.cluster.id}-${random_pet.control_planes[count.index].id}"
|
name = "control-plane-${random_pet.control_planes[count.index].id}"
|
||||||
|
|
||||||
ssh_keys = [hcloud_ssh_key.k3s.id]
|
ssh_keys = [hcloud_ssh_key.k3s.id]
|
||||||
public_key = var.public_key
|
public_key = var.public_key
|
||||||
|
@ -173,6 +173,7 @@ locals {
|
|||||||
for nodepool_name, nodepool_obj in var.agent_nodepools : {
|
for nodepool_name, nodepool_obj in var.agent_nodepools : {
|
||||||
for index in range(nodepool_obj.count) :
|
for index in range(nodepool_obj.count) :
|
||||||
format("%s-%s", nodepool_name, index) => {
|
format("%s-%s", nodepool_name, index) => {
|
||||||
|
nodepool_name : nodepool_name,
|
||||||
server_type : nodepool_obj.server_type,
|
server_type : nodepool_obj.server_type,
|
||||||
subnet : nodepool_obj.subnet,
|
subnet : nodepool_obj.subnet,
|
||||||
index : index
|
index : index
|
||||||
|
1
main.tf
1
main.tf
@ -1,4 +1,5 @@
|
|||||||
resource "random_pet" "cluster" {
|
resource "random_pet" "cluster" {
|
||||||
|
length = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "random_password" "k3s_token" {
|
resource "random_password" "k3s_token" {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
output "cluster_pet_name" {
|
output "cluster_pet_name" {
|
||||||
value = random_pet.cluster
|
value = random_pet.cluster.id
|
||||||
description = "Shared suffix for all resources belonging to this cluster."
|
description = "Shared suffix for all resources belonging to this cluster."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user