in tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_tracing.go [46:81]
func (r *AwsAPIGatewayStageTracingRule) Check(runner tflint.Runner) error {
return runner.WalkResources(r.resourceType, func(resource *configs.Resource) error {
body, _, diags := resource.Config.PartialContent(&hcl.BodySchema{
Attributes: []hcl.AttributeSchema{
{
Name: r.attributeName,
Required: true,
},
},
})
if diags.HasErrors() {
runner.EmitIssue(
r,
fmt.Sprintf("\"%s\" is not present.", r.attributeName),
body.MissingItemRange,
)
return nil
}
attribute := body.Attributes[r.attributeName]
var xrayTracingEnabled string
err := runner.EvaluateExpr(attribute.Expr, &xrayTracingEnabled, nil)
return runner.EnsureNoError(err, func() error {
if xrayTracingEnabled != "true" {
runner.EmitIssueOnExpr(
r,
fmt.Sprintf("\"%s\" should be set to true.", r.attributeName),
attribute.Expr,
)
}
return nil
})
})
}