fix: skip validating unknown version names #123
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Same problem as seen in #115.
This fixes a problem where having multiple template version names manually set using Terraform variables would always return a duplicate name error, as Terraform would mark the attribute, although it is required and already written in the config, as Unknown before calling our custom validator. This unknown value is only ever passed to the validator, never
Create
orUpdate
.Knowing this, we see the same problem exists for all attributes we read in our custom validator. The only remaining one is
active
, where we check at least one version is marked as active. In this case, we also need to skip validatingactive
if any of the booleans are unknown.We previously didn't have any tests that explicitly used Terraform variables, so this PR adds one, in case the behaviour of these variable set attributes is changed in the future.