aanderse / teraflops

a terraform ops tool which is sure to be a flop
MIT License
44 stars 2 forks source link

`Error: Cloud backend initialization required: please run "tofu init"` when using `cloud` block without `-f $PWD` #15

Open KiaraGrouwstra opened 3 months ago

KiaraGrouwstra commented 3 months ago

i looked a bit further into issue i was facing around #11. specifically, if one were to add a simple cloud block, teraflops generate_arguments_json's handling of the -f flag starts to interfere, resulting in error:

Error: Cloud backend initialization required: please run "tofu init"

Reason: Cloud backend configuration block has changed.

Changes to the cloud backend configuration block require reinitialization, to discover any changes to the available workspaces.

To re-initialize, run: tofu init

OpenTofu has not yet made changes to your existing configuration or state.

note that no actual cloud account is required here, as this repro requires one to go no further than trying the teraflops's plan. running teraflops init in this case however will not in fact address the error, essentially getting you stuck in a loop.

if one were to specify -f $PWD however, the check considers it not ., and commands like teraflops plan go through as intended.

edit: if needed TF_LOG=debug can give some extra info on what happens on their end in these two cases.

aanderse commented 1 month ago

unfortunately i haven't spent much time on opentofu yet and for my use cases i am still on terraform so i haven't run into these issues

i will try to create a tofu based deploy so i can play around with this