-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
During the compilation step the target directory is removed and recreated #418
Comments
Unfortunately I can't think of a way to avoid this. Kapitan must overwrite the compiled directory so that it can correctly diff. I'd advise you to keep terraform state somewhere else? |
I keep terraform state in the S3 bucket, so it's not a massive problem. However terraform creates the hidden directory I was hoping that Kapitan will leave alone any files which it does not manage 😕 |
Would it be feasible to implement something like the post compilation hook? For instance when Kapitan would finish compiling the particular target it would copy/move the compiled files to the specified location. |
Hey @narun4sk, we solve that problem by setting env variable example:
More info on https://www.terraform.io/docs/commands/environment-variables.html#tf_data_dir |
With the introduction of the Anyway, based on @gburiola suggestion, another workaround is running: .TF_DATA_DIR/target1$ terraform init ../../compiled/target1 This way, both ℹ️ Also there's no need to set |
hi @brunobertoldi I have yet another approach: I just merged into master #687 I have added the following input:
what I have in my terraform.sh is a small tiny copy:
together they help work around the issue waiting for hashicorp/terraform#27241 Join our #kapitan channel on the kubernetes slack if you want more details |
Thanks, @ademariag! |
I commit them, otherwise you would still get the same annoying behaviour. |
Describe the bug/feature
It seems that during the compilation step the target directory is removed and recreated.
This causes troubles if trying to adapt Kapitan to compile
terraform
targets, as all the metadata of the terraform is deleted and therefore after eachkapitan compile
terraform must be reinitialised. In general no other files may be stored in the target directory (say lambda function tarballs which terraform deploy on aws), as everything is wiped out.Is there a not too hacky workaround?
The text was updated successfully, but these errors were encountered: