Closed nitrocode closed 1 year ago
I don't think this is the appropriate way to solve this. If you want to go this route, what you have shown with wrapping your conditional, I would move the conditional check inside the map to avoid this mis-matched types on a conditional
Hmm how would you do that? :thinking:
instance_requirements = { for k,v in {
accelerator_count = {
max = var.accelerator_count
}
instance_generations = ["current"]
}: k => v if var.instance_type == null }
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
Motivation and Context
The issue is when we try to create logic to either use the
instance_type
or useinstance_requirements
The
null
cannot be changed to{}
or it will trigger an errorIf the
instance_type
is left asnull
then it will cause an issue when trying to do thelength(null)
which is why I am proposing thetry()
Breaking Changes
None
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull request