func()

in rules/terraform_required_providers_declaration.go [45:67]


func (r *TerraformRequiredProvidersDeclarationRule) CheckFile(runner tflint.Runner, file *hcl.File) error {
	var err error
	body, ok := file.Body.(*hclsyntax.Body)
	if !ok {
		logger.Debug("skip terraform_required_providers_declaration check since it's not hcl file")
		return nil
	}
	filename := body.Range().Filename
	if isOverrideTfFile(filename) {
		logger.Debug("skip terraform_required_version_declaration check since it's override file")
		return nil
	}
	blocks := body.Blocks
	for _, block := range blocks {
		switch block.Type {
		case "terraform":
			if subErr := r.checkBlock(runner, block); subErr != nil {
				err = multierror.Append(err, subErr)
			}
		}
	}
	return err
}