-
-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditionally setting attributes #380
Comments
Why? This seems like you are trying to re-wrap this module so you'd have to handle that differently |
@bryantbiggs In my case I'm using a for_each loop to create albs alongside other associated infrastructure such as cloudfront, waf, and route 53 for similar services. v8.7.0 worked well like this:
I was able to get around this in v9.x by doing a higher level map merge, but I think it makes the code a bit messier and it seems (maybe just to me) that
|
this feels like an x-y type problem so I'm not sure how much guidance I can provide given the narrow context. but in general, 99.9% of the time we've received issues like this - the answer has always been - "you should adjust how you are doing that" |
I was able to more or less get around it for what I’m doing, although it’s not pretty. It does seem to me like a valid part of HCL that’s not being properly handled by this module though given this in the docs “null is most useful in conditional expressions, so you can dynamically omit an argument if a condition isn't met.” |
This issue has been automatically marked as stale because it has been open 30 days |
Any solution for this? |
This issue has been automatically marked as stale because it has been open 30 days |
This issue was automatically closed because of stale in 10 days |
Is your request related to a problem? Please describe.
The
try()
function is used extensively throughout this module to evaluate if a key is set. However I find myself in many cases wanting to conditionally set these keys. When setting a key tonull
, it does not result in an error, so the for_each ends up trying to create a block it shouldn't, resulting in an error.Here's an example:
Results in errors like:
Describe the solution you'd like.
Maybe these blocks should look something like this to allow for null values?
Describe alternatives you've considered.
I haven't been able to think of other ways to handle this gracefully.
The text was updated successfully, but these errors were encountered: