Skip to content

MinItems with dynamic blocks#22221

Merged
jbardin merged 3 commits intomasterfrom
jbardin/min-items
Jul 29, 2019
Merged

MinItems with dynamic blocks#22221
jbardin merged 3 commits intomasterfrom
jbardin/min-items

Conversation

@jbardin
Copy link
Copy Markdown
Member

@jbardin jbardin commented Jul 26, 2019

MinItems > 1 can't be validated directly from the configuration is using dynamic blocks.
We need to skip the validation in a few places to let these through.

  • Skip the check in CoerceValue if there are any unknowns, which may indicate a dynamic block
  • Reduce the check to 0 or 1 for the decoder spec, since a dynamic block will only have 1 config value.
  • Skip the check in the schema validation if there are any unknowns. We will eventually get to validate the entire config once the blocks have been expanded and are known during the final plan.

Fixes #22195

@jbardin jbardin requested a review from a team July 26, 2019 22:09
jbardin added 2 commits July 27, 2019 11:50
If a block was defined via "dynamic", there will be only one block value
until the expansion is known. Since we can't detect dynamic blocks at
this point, don't verify MinItems while there are unknown values in the
config.

The decoder spec can also only check for existence of a block, so limit
the check to 0 or 1.
If there are unknowns, the block may have come from a dynamic
declaration, and we can't validate MinItems. Once the blocks are
expanded, we will get the full config for validation without any unknown
values.
@jbardin jbardin force-pushed the jbardin/min-items branch from 2d9ba52 to 4bed030 Compare July 27, 2019 18:50
@jbardin jbardin merged commit 5878527 into master Jul 29, 2019
@jbardin jbardin deleted the jbardin/min-items branch August 7, 2019 19:37
jhoos pushed a commit to jhoos/terraform that referenced this pull request Aug 9, 2019
Having multiple dynamic blocks for the same block, where only one of them will actually resolve to a real block, doesn't pass validation because Terraform sees both blocks and thinks MaxItems is violated.  This changes things (similar to how hashicorp#22221 did for MinItems) so that the validation is relaxed until later on when the dynamic blocks are resolved.
@ghost
Copy link
Copy Markdown

ghost commented Aug 29, 2019

I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Aug 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Insufficient ip_address blocks for aws_route53_resolver_endpoint

2 participants