Closed Dyllaann closed 5 years ago
Hi.
You know what, I have not actually used Jinjaform with a local state file, and totally missed this use case.
I think for all state operations (apply, import, state mv/rm, destroy) this will happen:
terraform.tfstate
(if it exists) into the .jinjaform
workspace.jinjaform
workspace using .jinjaform/terraform.tfstate
which does get updated when there are state changesterraform.tfstate
from outside of the workspace is never updatedIn short, I don't think local state works at all in Jinjaform right now!
As a hack, updating your .jinjaformrc
file to add this last line might work:
GIT_CHECK_BRANCH master
GIT_CHECK_CLEAN
GIT_CHECK_REMOTE
WORKSPACE_CREATE
TERRAFORM_RUN
RUN cp "${JINJAFORM_WORKSPACE}/terraform.tfstate" "${JINJAFORM_WORKSPACE}/../terraform.tfstate"
Please back up your state file before playing around with this!
Good point! Didn't even think about the apply not working then, as of the same reason.
I added the hack to my .jinjaformrc
and will play around a bit.
Will report how it behaves!
Works fine!
Hi!
Found another problem. I have to move some resources because of provider changes. Using:
jinjaform state mv azurerm_azuread_service_principal.servicePrincipal azuread_service_principal.servicePrincipal
, I only see the reflected changes on theterraform.tfstate
that ends up in.jinjaform/
.Which means, because I have to change three resources, the previous move gets lost as the next move will overwrite the state that is in
.jinjaform/
resulting in no moving at all in the end.I hope I explained it enough, if not; please let me know :)