infrablocks / ruby_terraform

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

RFC - DRY Command Building #49

Closed sa73917 closed 3 years ago

sa73917 commented 3 years ago

This one's definitely not in a state for merging (rspec is happy with it - but there's no doco and there's still a few areas I'd like to change) - just figured before I spend too much more time on it I'd see if you're likely to see it as a path forward or not?

Basically it

Let me know if you think its worth continuing with (happy to move the global options and Terraform 0.15 parameter stuff into a separate PR as well to keep things smaller)

tobyclemson commented 3 years ago

Hi Stephen,

Again, thanks a lot for this.

It has been a long time desire of mine to make these ruby command wrappers more declarative and this PR takes a step in that direction. My ideal situation is that I can describe as data the command being wrapped and everything is largely generated off that description so the work you've done with subcommands, options and arguments is really useful. It may even be possible to do this by parsing command usage although that might be a step too far :)

I'll try and do a review of this now. Since it is a large PR though, it may take some time to get it merged. If you'd like to get the terraform 0.14 and 0.15 support merged in and released, it may be better to do that in a separate PR and then keep this focussed on DRYing up the command implementation.

I have a feeling a number of the enhancements you've made may be better placed in lino itself, either as extensions of the existing builders there or as a separate layer within that library at a higher level of abstraction. I also wrote lino and it's part of the InfraBlocks organisation so that's certainly something we can get released quite quickly if that path makes sense. As you'll see from the organisation there are a number of other command wrappers there that would benefit from this treatment.

Thanks again for your contributions, Toby

sa73917 commented 3 years ago

Building a proper version for PR review :)