in rules/azurerm_arg_order.go [50:78]
func (r *AzurermArgOrderRule) CheckFile(runner tflint.Runner, file *hcl.File) error {
body, ok := file.Body.(*hclsyntax.Body)
if !ok {
logger.Debug("skip azurerm_arg_order since it's not hcl file")
return nil
}
blocks := body.Blocks
var err error
for _, block := range blocks {
var subErr error
typeWanted := linq.From([]string{"provider", "resource", "data"}).Contains(block.Type)
if !typeWanted {
continue
}
isAzProviderBlock := block.Type == "provider" && block.Labels[0] == "azurerm"
collection := generated.Resources
if block.Type == "data" {
collection = generated.DataSources
}
_, isAzBlock := collection[block.Labels[0]]
if typeWanted && (isAzProviderBlock || isAzBlock) {
subErr = r.visitAzBlock(runner, block)
}
if subErr != nil {
err = multierror.Append(err, subErr)
}
}
return err
}