Only parse all-lowercase patterns as potential TF properties #1969
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.
This pull request asserts that according to Terraform best practices we should not parse backticked values containing uppercase letters as potential schema properties.
While it is a convention to use
snake_case
for TF properties, it is a strong one. The AWS provider requires it, and other providers follow this convention strictly as well.The reason I would like to bring this change is because it allows us to detect documentation sections that are not actually nested property types, but rather lists of possible values, as described in #1507 in pulumi-mongodbatlas. Rather than add an ever-elusive regex for "Possible values include" et al, we can rely with reasonable confidence on the fact that TF properties are in general lowercase. See sample comparison diffs below.
A comparison diff for mongodbatlas shows multiple improvements. There are a few regressions but the main one is for a resource whose upstream doc is so unconventional that our representation of it is already flawed. Overall, we gain a lot more information than we're losing - the cost is that in a couple of places we get a nonsensical appendage of a real TF description. This should be fixed with docs overrides or by opening an upstream PR.
A comparison diff for AWS shows even more improvements, with only
V2modelsBotVersionLocaleSpecification
having a single regression, because the upstream docs are erroneously using camelCase.A comparison diff for GCP shows only improvements.
A comparison diff for Azure shows only improvements.
Note I refactored the tests slightly because I wanted to be able to run individual tests and leave hints as to what they were testing.
Fixes #1507.