Skip to content
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

Run tfautomv against a plan file #78

Open
gzur opened this issue Feb 15, 2024 · 3 comments
Open

Run tfautomv against a plan file #78

gzur opened this issue Feb 15, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@gzur
Copy link

gzur commented Feb 15, 2024

Hi,

Is it possible to run tfautomv against an existing plan file?

I.e. something like:

$ terraform plan -out tfplan
[...]
$ tfautomv -plan tfplan

And if not, is it feasible to implement?

@busser
Copy link
Owner

busser commented Feb 15, 2024

Hey @gzur 👋

This currently isn't possible but can definitely be implemented. Currently, tfautomv runs a plan -out tfplan command and then parses the plan file. I don't see why the user couldn't provide a plan file directly.

I'm curious: what is your usecase for running the plan command separately?

@busser busser added enhancement New feature or request good first issue Good for newcomers labels Feb 15, 2024
@gzur
Copy link
Author

gzur commented Feb 15, 2024

I was running tfautomv against an environment (containing about 260 resources), and it had hung for about 20 minutes when I started thinking about this and created this issue.

I was able plan normally against the environment, so I wondered whether I could supply the plan file myself.

What ended up happening though, was that I Ctrl-C'd tfautomv, upgraded to v0.6.0 and ran it against with the new-fangled -sS options and it flew through, returning 115 valid move commands (I was refactoring 🤠).

I have no idea whether the issue had anything to do with tfautomv or the underlying provider, (or whether -sS saved the day ¯_(ツ)_/¯ )

But having said this, I can imagine a local plan file might be nice if you are trying to fine-tune --ignore clauses.

@busser
Copy link
Owner

busser commented Feb 15, 2024

Interesting! Thanks for providing your use case 😊

Indeed the -sS flags are a great time saver. I agree that computing the plan again and again when iterating on rules is a waste of time, although in my experience it's not a big one.

I'm not against allowing users to provide plan files to tfautomv. I wonder what that would look like when running tfautomv on multiple directories at once (another v0.6 feature). To work in "multi-directory" mode, tfautomv needs to know the path to each directory.

Maybe something like this:

tfautomv dir1/tfplan dir2/tfplan dir3/tfplan

tfautomv would then assume that the directories are dir1, dir2, and dir3? I'm not certain that that assumption would always be convenient for users.

I'd be curious to know what other use cases there are where users would want to provide plan files instead of having tfautomv run the plan command. Perhaps then the correct UX would be more obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants