Skip to content

Commit

Permalink
Switch internal Terraform rules to the bundled plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
wata727 committed Aug 28, 2022
1 parent 3fbef3f commit c5e6c91
Show file tree
Hide file tree
Showing 52 changed files with 162 additions and 8,890 deletions.
24 changes: 24 additions & 0 deletions cmd/bundled_plugin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cmd

import (
"fmt"

"github.com/terraform-linters/tflint-plugin-sdk/plugin"
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
"github.com/terraform-linters/tflint-ruleset-terraform/project"
"github.com/terraform-linters/tflint-ruleset-terraform/rules"
"github.com/terraform-linters/tflint-ruleset-terraform/terraform"
)

func (cli *CLI) actAsBundledPlugin() int {
plugin.Serve(&plugin.ServeOpts{
RuleSet: &terraform.RuleSet{
BuiltinRuleSet: tflint.BuiltinRuleSet{
Name: "terraform",
Version: fmt.Sprintf("%s-bundled", project.Version),
},
PresetRules: rules.PresetRules,
},
})
return ExitCodeOK
}
2 changes: 2 additions & 0 deletions cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func (cli *CLI) Run(args []string) int {
return cli.init(opts)
case opts.Langserver:
return cli.startLanguageServer(opts.Config, opts.toConfig())
case opts.ActAsBundledPlugin:
return cli.actAsBundledPlugin()
default:
return cli.inspect(opts, dir, filterFiles)
}
Expand Down
Loading

0 comments on commit c5e6c91

Please sign in to comment.