Workaround Terraform v1.1 file provisioner regression

* Terraform v1.1 changed the behavior of provisioners and
`remote-exec` in a way that breaks support for expansions
in commands (including file provisioner, where `destination`
is part of an `scp` command)
* Terraform will likely revert the change eventually, but I
suspect it will take a while
* Instead, we can stop relying on Terraform's expansion
behavior. `/home/core` is a suitable choice for `$HOME` on
both Flatcar Linux and Fedora CoreOS (harldink `/var/home/core`)

Rel: https://github.com/hashicorp/terraform/issues/30243
This commit is contained in:
Dalton Hubble 2021-12-28 11:42:11 -08:00
parent ce7b2fa21f
commit 6ed048eb65
11 changed files with 27 additions and 26 deletions

View File

@ -5,6 +5,7 @@ Notable changes between versions.
## Latest ## Latest
* Kubernetes [v1.23.1](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.23.md#v1231) * Kubernetes [v1.23.1](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.23.md#v1231)
* Workaround Terraform v1.1 regression in `file` provisioner ([#1093](https://github.com/poseidon/typhoon/pull/1093))
### Flatcar Linux ### Flatcar Linux

View File

@ -24,7 +24,7 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {

View File

@ -24,7 +24,7 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {

View File

@ -25,7 +25,7 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {

View File

@ -25,7 +25,7 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {

View File

@ -28,17 +28,17 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = module.bootstrap.kubeconfig-kubelet content = module.bootstrap.kubeconfig-kubelet
destination = "$HOME/kubeconfig" destination = "/home/core/kubeconfig"
} }
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig",
"sudo touch /etc/kubernetes", "sudo touch /etc/kubernetes",
"sudo /opt/bootstrap/layout", "sudo /opt/bootstrap/layout",
] ]
@ -65,12 +65,12 @@ resource "null_resource" "copy-worker-secrets" {
provisioner "file" { provisioner "file" {
content = module.bootstrap.kubeconfig-kubelet content = module.bootstrap.kubeconfig-kubelet
destination = "$HOME/kubeconfig" destination = "/home/core/kubeconfig"
} }
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig",
"sudo touch /etc/kubernetes", "sudo touch /etc/kubernetes",
] ]
} }

View File

@ -29,17 +29,17 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = module.bootstrap.kubeconfig-kubelet content = module.bootstrap.kubeconfig-kubelet
destination = "$HOME/kubeconfig" destination = "/home/core/kubeconfig"
} }
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig",
"sudo /opt/bootstrap/layout", "sudo /opt/bootstrap/layout",
] ]
} }
@ -66,12 +66,12 @@ resource "null_resource" "copy-worker-secrets" {
provisioner "file" { provisioner "file" {
content = module.bootstrap.kubeconfig-kubelet content = module.bootstrap.kubeconfig-kubelet
destination = "$HOME/kubeconfig" destination = "/home/core/kubeconfig"
} }
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig",
] ]
} }
} }

View File

@ -25,17 +25,17 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = module.bootstrap.kubeconfig-kubelet content = module.bootstrap.kubeconfig-kubelet
destination = "$HOME/kubeconfig" destination = "/home/core/kubeconfig"
} }
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig",
"sudo touch /etc/kubernetes", "sudo touch /etc/kubernetes",
"sudo /opt/bootstrap/layout", "sudo /opt/bootstrap/layout",
] ]
@ -55,12 +55,12 @@ resource "null_resource" "copy-worker-secrets" {
provisioner "file" { provisioner "file" {
content = module.bootstrap.kubeconfig-kubelet content = module.bootstrap.kubeconfig-kubelet
destination = "$HOME/kubeconfig" destination = "/home/core/kubeconfig"
} }
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig",
"sudo touch /etc/kubernetes", "sudo touch /etc/kubernetes",
] ]
} }

View File

@ -25,17 +25,17 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = module.bootstrap.kubeconfig-kubelet content = module.bootstrap.kubeconfig-kubelet
destination = "$HOME/kubeconfig" destination = "/home/core/kubeconfig"
} }
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig",
"sudo /opt/bootstrap/layout", "sudo /opt/bootstrap/layout",
] ]
} }
@ -54,12 +54,12 @@ resource "null_resource" "copy-worker-secrets" {
provisioner "file" { provisioner "file" {
content = module.bootstrap.kubeconfig-kubelet content = module.bootstrap.kubeconfig-kubelet
destination = "$HOME/kubeconfig" destination = "/home/core/kubeconfig"
} }
provisioner "remote-exec" { provisioner "remote-exec" {
inline = [ inline = [
"sudo mv $HOME/kubeconfig /etc/kubernetes/kubeconfig", "sudo mv /home/core/kubeconfig /etc/kubernetes/kubeconfig",
] ]
} }
} }

View File

@ -24,7 +24,7 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {

View File

@ -24,7 +24,7 @@ resource "null_resource" "copy-controller-secrets" {
provisioner "file" { provisioner "file" {
content = join("\n", local.assets_bundle) content = join("\n", local.assets_bundle)
destination = "$HOME/assets" destination = "/home/core/assets"
} }
provisioner "remote-exec" { provisioner "remote-exec" {