I am creating a module that wraps aws_s3_bucket and some more modules to make the creation of bucket with required configuration easy.
My issue is that there are nested blocks used in aws_s3_bucket resource and I want my module users to pass that information from outside. For instance “lifecycle_rule” nested block which is complex and consists of another level of nested blocks inside it like “expiration” - I want module users to completely define their own set of lifecycle rules.
I could have used dynamic blocks with for_each if the nested block was not containing further nested blocks but in this case, I can’t do that really. Or else I have to replicate the whole structural schema of “lifecycle_rule” (recursively) into my module’s variable type and also will have to expand each level in schema manually - which doesn’t only mean a lot of code but also means that I will have to keep on updating as soon as provider add news fields in the resource definition.
What would be the best way to solve this issue?
Please let me know if I am not making sense or if you’d like more information.