Skip to content

Commit

Permalink
extend cookiecutter terraform config for compute init script
Browse files Browse the repository at this point in the history
  • Loading branch information
bertiethorpe committed Jan 6, 2025
1 parent 9a07ff4 commit 510cfd0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ module "compute" {
k3s_token = var.k3s_token
control_address = [for n in openstack_compute_instance_v2.control["control"].network: n.fixed_ip_v4 if n.access_network][0]
security_group_ids = [for o in data.openstack_networking_secgroup_v2.nonlogin: o.id]

compute_init_enable = var.compute_init_enable
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ resource "openstack_compute_instance_v2" "compute" {
}

metadata = {
environment_root = var.environment_root
k3s_token = var.k3s_token
control_address = var.control_address
environment_root = var.environment_root
k3s_token = var.k3s_token
control_address = var.control_address
enable_compute = contains(var.compute_init_enable, "compute")
enable_resolv_conf = contains(var.compute_init_enable, "resolv_conf")
enable_etc_hosts = contains(var.compute_init_enable, "etc_hosts")
enable_nfs = contains(var.compute_init_enable, "nfs")
enable_manila = contains(var.compute_init_enable, "manila")
enable_basic_users = contains(var.compute_init_enable, "basic_users")
enable_eessi = contains(var.compute_init_enable, "eessi")
}

user_data = <<-EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,9 @@ variable "control_address" {
description = "Name/address of control node"
type = string
}

variable "compute_init_enable" {
type = list(string)
description = "Groups to activate for ansible-init compute rebuilds"
default = []
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ variable "compute" {
image_id: Overrides variable cluster_image_id
vnic_type: Overrides variable vnic_type
vnic_profile: Overrides variable vnic_profile
compute_init_enable: Toggles ansible-init rebuild
EOF
}

Expand Down Expand Up @@ -136,3 +137,9 @@ variable "k3s_token" {
description = "K3s cluster authentication token, set automatically by Ansible"
type = string
}

variable "compute_init_enable" {
type = list(string)
description = "Groups to activate for ansible-init compute rebuilds"
default = []
}

0 comments on commit 510cfd0

Please sign in to comment.