Conditionally set attribute within a content block for modules #1683
Unanswered
benscholler-ciq
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Sorry for the late reply... For some reason our team didn't receive any Github notifications for questions here in the past few months.. Terramate do support this use case with the
The Does this work for you? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Terramate community and team! I'm running into an issue with module sources when using
source
andversion
attributes with a module block. Is it possible to conditionally set attributes within a module in a content block? I'm thinking it would be nice to have some sort of dynamic creation of individual attributes.As a background, I'd like to keep the source and version for my registry module in sync everywhere between my stacks. In Terramate, I might do this to get close:
Let's say I'm testing something and want to reference a custom branch and deploy it to a development environment. When doing this, I could have a custom branch I need to reference. When using a reference to a custom branch in github, Terraform gets annoyed when specifying the version attribute, as it doesn't match version constraint standards. An empty string or null won't work for Terraform in this case:
If setting null on the version in this case, Terraform will yell at you:
It would be nice to have dynamic/conditional attribute creation in this case. Something like:
To get around this, I could do some pre-pass funcationality to unset an attribute from a map for module attributes, but that seems overly complicated. Maybe there's another way I'm missing to handle this sort of behavior? Thanks for any help!
Beta Was this translation helpful? Give feedback.
All reactions