Skip to content
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 2 commits into from
Jul 23, 2020
Merged

Conversation

pd
Copy link
Contributor

@pd pd commented Jul 20, 2020

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.

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.
helper/runner.go Show resolved Hide resolved
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.
@wata727
Copy link
Member

wata727 commented Jul 21, 2020

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.

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.

👍

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.
@wata727 wata727 merged commit 5ac6ff4 into terraform-linters:master Jul 23, 2020
@wata727
Copy link
Member

wata727 commented Jul 23, 2020

👍

@pd pd deleted the walkmodulecalls branch July 23, 2020 13:50
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
pd added a commit to pd/tflint-ruleset-template that referenced this pull request Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants