Skip to content
This repository was archived by the owner on Jun 29, 2022. It is now read-only.

Commit 33a1227

Browse files
author
Imran Pochi
committed
baremetal: remove locals clc_map
This commit updates the code which was present due to limitations in Terraform <= 0.12, Since Lokomotive now supports 0.13 version and the type of `clc_snippets` is updated from map(string) to map(list(string)), the code is no longer required. Signed-off-by: Imran Pochi <imran@kinvolk.io>
1 parent 8d9a6aa commit 33a1227

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

assets/terraform-modules/bare-metal/flatcar-linux/kubernetes/profiles.tf

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ data "ct_config" "controller-ignitions" {
104104
})
105105
pretty_print = false
106106

107-
# Must use direct lookup. Cannot use lookup(map, key) since it only works for flat maps
108-
snippets = local.clc_map[var.controller_names[count.index]]
107+
snippets = lookup(var.clc_snippets, var.controller_names[count.index], [])
109108
}
110109

111110
// Kubernetes Worker profiles
@@ -131,21 +130,6 @@ data "ct_config" "worker-ignitions" {
131130
})
132131
pretty_print = false
133132

134-
# Must use direct lookup. Cannot use lookup(map, key) since it only works for flat maps
135-
snippets = local.clc_map[var.worker_names[count.index]]
133+
snippets = lookup(var.clc_snippets, var.worker_names[count.index], [])
136134
}
137135

138-
locals {
139-
# TODO: Probably it is not needed anymore with terraform 0.12
140-
# Hack to workaround https://github.com/hashicorp/terraform/issues/17251
141-
# Default Flatcar Container Linux config snippets map every node names to list("\n") so
142-
# all lookups succeed
143-
total_length = length(var.controller_names) + length(var.worker_names)
144-
clc_defaults = zipmap(
145-
concat(var.controller_names, var.worker_names),
146-
chunklist([for i in range(local.total_length) : "\n"], 1),
147-
)
148-
149-
# Union of the default and user specific snippets, later overrides prior.
150-
clc_map = merge(local.clc_defaults, var.clc_snippets)
151-
}

ci/baremetal/clc-snippet.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
storage:
2+
files:
3+
- path: /opt/clc_snippet_hello
4+
filesystem: root
5+
contents:
6+
inline: Hello, world!
7+
mode: 0644
8+
user:
9+
id: 500
10+
group:
11+
id: 500

pkg/assets/generated_assets.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)