github.com/terraform-linters/tflint@v0.51.2-0.20240520175844-3750771571b6/plugin/stub-generator/sources/customrulesettesting/custom/ruleset.go (about)

     1  package custom
     2  
     3  import (
     4  	"github.com/terraform-linters/tflint-plugin-sdk/hclext"
     5  	"github.com/terraform-linters/tflint-plugin-sdk/tflint"
     6  )
     7  
     8  type RuleSet struct {
     9  	tflint.BuiltinRuleSet
    10  	config *Config
    11  }
    12  
    13  func (r *RuleSet) ConfigSchema() *hclext.BodySchema {
    14  	r.config = &Config{}
    15  	return hclext.ImpliedBodySchema(r.config)
    16  }
    17  
    18  func (r *RuleSet) ApplyConfig(body *hclext.BodyContent) error {
    19  	diags := hclext.DecodeBody(body, nil, r.config)
    20  	if diags.HasErrors() {
    21  		return diags
    22  	}
    23  
    24  	return nil
    25  }
    26  
    27  func (r *RuleSet) NewRunner(runner tflint.Runner) (tflint.Runner, error) {
    28  	return NewRunner(runner, r.config)
    29  }