@@ -23,12 +23,13 @@ resource "matchbox_profile" "flatcar-install" {
2323 ])
2424
2525 container_linux_config = templatefile (" ${ path . module } /cl/install.yaml.tmpl" , {
26- os_channel = var.os_channel
27- os_version = var.os_version
28- ignition_endpoint = format (" %s/ignition" , var. matchbox_http_endpoint )
29- install_disk = var.install_disk
30- container_linux_oem = var.container_linux_oem
31- ssh_keys = jsonencode (var. ssh_keys )
26+ os_channel = var.os_channel
27+ os_version = var.os_version
28+ ignition_endpoint = format (" %s/ignition" , var. matchbox_http_endpoint )
29+ install_disk = var.install_disk
30+ container_linux_oem = var.container_linux_oem
31+ ssh_keys = jsonencode (var. ssh_keys )
32+ install_to_smallest_disk = var.install_to_smallest_disk
3233 # only cached-container-linux profile adds -b baseurl
3334 baseurl_flag = " "
3435 })
@@ -60,12 +61,13 @@ resource "matchbox_profile" "cached-flatcar-linux-install" {
6061 ])
6162
6263 container_linux_config = templatefile (" ${ path . module } /cl/install.yaml.tmpl" , {
63- os_channel = var.os_channel
64- os_version = var.os_version
65- ignition_endpoint = format (" %s/ignition" , var. matchbox_http_endpoint )
66- install_disk = var.install_disk
67- container_linux_oem = var.container_linux_oem
68- ssh_keys = jsonencode (var. ssh_keys )
64+ os_channel = var.os_channel
65+ os_version = var.os_version
66+ ignition_endpoint = format (" %s/ignition" , var. matchbox_http_endpoint )
67+ install_disk = var.install_disk
68+ container_linux_oem = var.container_linux_oem
69+ ssh_keys = jsonencode (var. ssh_keys )
70+ install_to_smallest_disk = var.install_to_smallest_disk
6971 # profile uses -b baseurl to install from matchbox cache
7072 baseurl_flag = " -b ${ var . matchbox_http_endpoint } /assets/flatcar"
7173 })
@@ -102,8 +104,7 @@ data "ct_config" "controller-ignitions" {
102104 })
103105 pretty_print = false
104106
105- # Must use direct lookup. Cannot use lookup(map, key) since it only works for flat maps
106- snippets = local. clc_map [var . controller_names [count . index ]]
107+ snippets = lookup (var. clc_snippets , var. controller_names [count . index ], [])
107108}
108109
109110// Kubernetes Worker profiles
@@ -129,21 +130,6 @@ data "ct_config" "worker-ignitions" {
129130 })
130131 pretty_print = false
131132
132- # Must use direct lookup. Cannot use lookup(map, key) since it only works for flat maps
133- snippets = local. clc_map [var . worker_names [count . index ]]
133+ snippets = lookup (var. clc_snippets , var. worker_names [count . index ], [])
134134}
135135
136- locals {
137- # TODO: Probably it is not needed anymore with terraform 0.12
138- # Hack to workaround https://github.com/hashicorp/terraform/issues/17251
139- # Default Flatcar Container Linux config snippets map every node names to list("\n") so
140- # all lookups succeed
141- total_length = length (var. controller_names ) + length (var. worker_names )
142- clc_defaults = zipmap (
143- concat (var. controller_names , var. worker_names ),
144- chunklist ([for i in range (local. total_length ) : " \n " ], 1 ),
145- )
146-
147- # Union of the default and user specific snippets, later overrides prior.
148- clc_map = merge (local. clc_defaults , var. clc_snippets )
149- }
0 commit comments