-
Notifications
You must be signed in to change notification settings - Fork 266
Moving state after cluster creation breaks manifest generation #1135
Comments
We are using the hashicorp/terraform#7613 We could try to experiment dropping |
Just looked into this again and all the issues read like it's not-a-big-deal but I have no idea how this is suppose to work. It looks to me like in combination with template_dir it's impossible to get around this issue and it can only be fixed upstream. |
Running into the same here. For the short term, I was able to hack around it by replacing the These changes are aws specific, but should work for other modules as well. (not long term, in my opinion) diff --git a/modules/bootkube/assets.tf b/modules/bootkube/assets.tf
index eb5dc3f..b9f8d67 100644
--- a/modules/bootkube/assets.tf
+++ b/modules/bootkube/assets.tf
@@ -15,7 +15,7 @@ data "null_data_source" "etcd" {
resource "template_dir" "experimental" {
count = "${var.experimental_enabled ? 1 : 0}"
- source_dir = "${path.module}/resources/experimental/manifests"
+ source_dir = "modules/bootkube/resources/experimental/manifests"
destination_dir = "./generated/experimental"
vars {
@@ -27,7 +27,7 @@ resource "template_dir" "experimental" {
resource "template_dir" "bootstrap-experimental" {
count = "${var.experimental_enabled ? 1 : 0}"
- source_dir = "${path.module}/resources/experimental/bootstrap-manifests"
+ source_dir = "modules/bootkube/resources/experimental/bootstrap-manifests"
destination_dir = "./generated/bootstrap-experimental"
vars {
@@ -39,7 +39,7 @@ resource "template_dir" "bootstrap-experimental" {
resource "template_dir" "etcd-experimental" {
count = "${var.experimental_enabled ? 1 : 0}"
- source_dir = "${path.module}/resources/experimental/etcd"
+ source_dir = "modules/bootkube/resources/experimental/etcd"
destination_dir = "./generated/etcd"
vars {
@@ -50,7 +50,7 @@ resource "template_dir" "etcd-experimental" {
# Self-hosted manifests (resources/generated/manifests/)
resource "template_dir" "bootkube" {
- source_dir = "${path.module}/resources/manifests"
+ source_dir = "modules/bootkube/resources/manifests"
destination_dir = "./generated/manifests"
vars {
@@ -110,7 +110,7 @@ resource "template_dir" "bootkube" {
# Self-hosted bootstrapping manifests (resources/generated/manifests-bootstrap/)
resource "template_dir" "bootkube-bootstrap" {
- source_dir = "${path.module}/resources/bootstrap-manifests"
+ source_dir = "modules/bootkube/resources/bootstrap-manifests"
destination_dir = "./generated/bootstrap-manifests"
vars {
@@ -157,7 +157,7 @@ resource "local_file" "etcd_client_key" {
# kubeconfig (resources/generated/auth/kubeconfig)
data "template_file" "kubeconfig" {
- template = "${file("${path.module}/resources/kubeconfig")}"
+ template = "${file("modules/bootkube/resources/kubeconfig")}"
vars {
ca_cert = "${base64encode(var.ca_cert == "" ? join(" ", tls_self_signed_cert.kube-ca.*.cert_pem) : var.ca_cert)}"
@@ -174,7 +174,7 @@ resource "local_file" "kubeconfig" {
# bootkube.sh (resources/generated/bootkube.sh)
data "template_file" "bootkube-sh" {
- template = "${file("${path.module}/resources/bootkube.sh")}"
+ template = "${file("modules/bootkube/resources/bootkube.sh")}"
vars {
bootkube_image = "${var.container_images["bootkube"]}"
@@ -188,5 +188,5 @@ resource "local_file" "bootkube-sh" {
# bootkube.service (available as output variable)
data "template_file" "bootkube_service" {
- template = "${file("${path.module}/resources/bootkube.service")}"
+ template = "${file("modules/bootkube/resources/bootkube.service")}"
}
diff --git a/modules/tectonic/assets.tf b/modules/tectonic/assets.tf
index 30b21e6..b459ea4 100644
--- a/modules/tectonic/assets.tf
+++ b/modules/tectonic/assets.tf
@@ -5,7 +5,7 @@ resource "random_id" "cluster_id" {
# Kubernetes Manifests (resources/generated/manifests/)
resource "template_dir" "tectonic" {
- source_dir = "${path.module}/resources/manifests"
+ source_dir = "modules/tectonic/resources/manifests"
destination_dir = "./generated/tectonic"
vars { |
I've tried that but it breaks sometime. Not sure where exactly tbh, I think it was creating a new cluster which didn't work (while updated worked). Have you tried both? |
We might need to tackle this issue while fixing #1363 |
@discordianfish both worked for me initially. I'll do some more testing in the next few days to be sure. |
I don't know how this can work, given that the Makefile changes into the build/ directory. What might work is using |
I do believe this is an upstream issue in the |
Yes this probably requires upstream changes. I worked around this by using a linux container in which I mount the state to a fixed, absolute location. |
Since we're working on the next generation of the installer and there is a sufficient workaround won't be fixing this in this repo. See our blog for any additional details: |
Looks like moving the state directory (build/cluster) causes an error on the next plan/apply:
This is because template_dir.bootkube's source_dir is a fully qualified path:
I don't think there is a reason to keep the fully qualified path in the state. If it had only the relative path in there things would be more portable. This is especially important in disaster recovery etc where you might not have everything 1:1 in place and these things would cause additional TTR.
The text was updated successfully, but these errors were encountered: