infrablocks / ruby_terraform

A simple Ruby wrapper for invoking terraform commands.
MIT License
109 stars 33 forks source link

Feature request: plan.replace #88

Closed jasonmk closed 2 years ago

jasonmk commented 2 years ago

From TF 0.15.2 and onward, the replace option to plan/apply is preferred to using the taint-apply combo. It doesn't appear that ruby-terraform supports this option. How difficult would it be to add?

More details here: https://www.terraform.io/cli/commands/plan#replace-address

Thanks!

tobyclemson commented 2 years ago

Hey @jasonmk,

This shouldn't be too hard to add and we'd happily accept a PR. Alternatively, if you are happy to wait a little while, we'll try to get to it in the next week or so.

Thanks, Toby

tobyclemson commented 2 years ago

As a bit of a pointer as to where to add this in a PR, you would need to:

jasonmk commented 2 years ago

Taking a look. Will adding to plan make it work with apply directly as well or would it have to be added to each?

tobyclemson commented 2 years ago

Ah! Apologies, missed that you had said apply too.

You'll need to add to apply as well.

jasonmk commented 2 years ago

Took a stab at it. It's an option that you can specify multiple times. I don't really like using the word 'replaces' as the parameter, but it looks like maybe the pluralization is necessary for the command line builder (at least based on how targets is implemented). Let me know if there's a better way.

tobyclemson commented 2 years ago

Looks good to me. I think even though 'replaces' sounds a little strange, it's consistent with the other pluralised parameters so I think it makes sense to stick with that.

tobyclemson commented 2 years ago

1.5.0 includes this change.

Thanks for taking the time!

jasonmk commented 2 years ago

Thank you for pushing it out so fast!