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

Commit

Permalink
packet: use templatefile function rather than template_file resource
Browse files Browse the repository at this point in the history
Part of #196

Signed-off-by: Mateusz Gozdek <mateusz@kinvolk.io>
  • Loading branch information
invidian committed Mar 19, 2020
1 parent 515e9de commit 79fbaf6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,36 +62,21 @@ resource "packet_device" "controllers" {
}

data "ct_config" "controller-install-ignitions" {
count = var.controller_count
content = data.template_file.controller-install[count.index].rendered
}

data "template_file" "controller-install" {
count = var.controller_count
template = file("${path.module}/cl/controller-install.yaml.tmpl")

vars = {
count = var.controller_count
content = templatefile("${path.module}/cl/controller-install.yaml.tmpl", {
os_channel = var.os_channel
os_version = var.os_version
os_arch = var.os_arch
flatcar_linux_oem = "packet"
ssh_keys = jsonencode(var.ssh_keys)
postinstall_ignition = data.ct_config.controller-ignitions[count.index].rendered
}
})
}

data "ct_config" "controller-ignitions" {
count = var.controller_count
platform = "packet"
content = data.template_file.controller-configs[count.index].rendered
snippets = var.controller_clc_snippets
}

data "template_file" "controller-configs" {
count = var.controller_count
template = file("${path.module}/cl/controller.yaml.tmpl")

vars = {
content = templatefile("${path.module}/cl/controller.yaml.tmpl", {
os_arch = var.os_arch
# Cannot use cyclic dependencies on controllers or their DNS records
etcd_name = "etcd${count.index}"
Expand All @@ -110,7 +95,8 @@ data "template_file" "controller-configs" {
# on quay prevent us from downloading ACI correctly.
# So it's workaround to download arm64 images until quay images could be fixed.
image_arch_url_prefix = var.os_arch == "arm64" ? "docker://" : ""
}
})
snippets = var.controller_clc_snippets
}

data "template_file" "etcds" {
Expand Down
4 changes: 2 additions & 2 deletions pkg/assets/generated_assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 79fbaf6

Please sign in to comment.