-
Notifications
You must be signed in to change notification settings - Fork 14
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
Implement WalkModuleCalls
#50
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This allows rulesets to add lints that enforce rules on module calls rather than only on resource declarations. I plan to use it, for instance, to constrain the different forms of addresses used for module sources. Version constraints may be a bit different over the wire: the type exposed by `go-version` can't necessarily be exactly reconstructed, as they've been normalized under the hood. The original value is still accessible through the usual `hcl.Body.PartialContent` or similar functions, if needed. In Terraform 0.12, I think the `Count` and `ForEach` struct members will never actually be set, but the corresponding Terraform types have them, so I've included them here. Maybe they'll Just Work once 0.13 is out of beta and support is added to tflint.
pd
commented
Jul 20, 2020
pd
added a commit
to pd/tflint
that referenced
this pull request
Jul 20, 2020
See the corresponding PR to the SDK: terraform-linters/tflint-plugin-sdk#50 Version constraints may be a bit different over the wire: the type exposed by go-version can't necessarily be exactly reconstructed, as they've been normalized under the hood. The original value is still accessible through the usual hcl.Body.PartialContent or similar functions, if needed. In Terraform 0.12, I think the Count and ForEach struct members will never actually be set, but the corresponding Terraform types have them, so I've included them here. Maybe they'll Just Work once 0.13 is out of beta and support is added to tflint.
I agreed to encode the version constraints as a string once and reconstruct it on the SDK side. I think it's the best option available at the moment.
👍 |
It's fairly minimal and of course doesn't enforce the vast majority of the rules that Terraform would while processing a module call block, but it hits the highlights.
👍 |
pd
added a commit
to pd/tflint
that referenced
this pull request
Jul 23, 2020
See the corresponding PR to the SDK: terraform-linters/tflint-plugin-sdk#50 Version constraints may be a bit different over the wire: the type exposed by go-version can't necessarily be exactly reconstructed, as they've been normalized under the hood. The original value is still accessible through the usual hcl.Body.PartialContent or similar functions, if needed. In Terraform 0.12, I think the Count and ForEach struct members will never actually be set, but the corresponding Terraform types have them, so I've included them here. Maybe they'll Just Work once 0.13 is out of beta and support is added to tflint.
pd
added a commit
to pd/tflint-ruleset-template
that referenced
this pull request
Jul 23, 2020
See the PR adding support for this to the SDK here: terraform-linters/tflint-plugin-sdk#50
pd
added a commit
to pd/tflint-ruleset-template
that referenced
this pull request
Jul 23, 2020
See the PR adding support for this to the SDK here: terraform-linters/tflint-plugin-sdk#50
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 allows rulesets to add lints that enforce rules on module calls
rather than only on resource declarations. I plan to use it, for
instance, to constrain the different forms of addresses used for
module sources.
Version constraints may be a bit different over the wire: the type exposed
by
go-version
can't necessarily be exactly reconstructed, as they'vebeen normalized under the hood. The original value is still accessible
through the usual
hcl.Body.PartialContent
or similar functions, ifneeded.
In Terraform 0.12, I think the
Count
andForEach
struct memberswill never actually be set, but the corresponding Terraform types have
them, so I've included them here. Maybe they'll Just Work once 0.13 is
out of beta and support is added to tflint.