I am reading this topic https://stackoverflow.com/a/62480424 and I am curious about this:
I would not use terraform-aws-modules.
I would use aws provider resources like ...
I wonder why it is one or the other ? Can we use both ? If yes then when it is better to use one or the other ?
Hi @przemolb,
I don’t have any particular opinion about that particular set of modules – they are commonly-used within the community and seem to be working for lots of people, at least – but this question seems like a specific example of the tradeoff described in When to write a module, and so perhaps it’d help to consider whether you think the advice there applies to the particular modules you are considering, and perhaps decide not to use a module that seems to be redundant under that criteria.
In the end though, it really depends on the specific situation and on your own preferences. It’s not possible to give general advice on this that isn’t largely personal opinion, as is the case for the answer you linked to on Stack Overflow.
Hi @apparentlymart ,
thanks for your reply.
My question is not about that particular set of modules - sorry, I should have been more clear. I was more curious when to use one or the other approach (as a “consumer”). Let’s say at the moment that I am not going to write any modules - I just want to use existing code to spin up new cloud infrastructure.
So it is more design-like question ?
Just wanted people to share their experience about their choice: when to use modules and when providers.
As you mention I don’t see it as an “either/or” questions but as “both”.
We use a number of third party modules, make various internal ones and use resources directly, all possibly within the same Terraform root module.
We find that using high quality external modules simplifies our maintenance efforts and that as long as there is no overlap we can add separate resource blocks into our code (i.e. you can’t add code to manage something which is already managed within the module).