Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CustomerManagedKey = AvmInterface{ VarCheck: varcheck.NewVarCheck(customerManagedKeyType, cty.NullVal(cty.DynamicPseudoType), true), RuleName: "customer_managed_key", VarTypeString: CustomerManagedKeyTypeString, RuleEnabled: true, RuleLink: "https://azure.github.io/Azure-Verified-Modules/specs/shared/interfaces/#customer-managed-keys", }
var CustomerManagedKeyTypeString = `` /* 204-byte string literal not displayed */
var DiagnosticSettings = AvmInterface{ VarCheck: varcheck.NewVarCheck(diagnosticType, cty.EmptyObjectVal, false), RuleName: "diagnostic_settings", VarTypeString: DiagnosticTypeString, RuleEnabled: true, RuleLink: "https://azure.github.io/Azure-Verified-Modules/specs/shared/interfaces/#diagnostic-settings", }
var DiagnosticTypeString = `` /* 723-byte string literal not displayed */
var Location = AvmInterface{ VarCheck: varcheck.NewVarCheck(locationType, cty.UnknownVal(cty.String), false), RuleName: "location", VarTypeString: LocationTypeString, RuleEnabled: true, RuleLink: "https://azure.github.io/Azure-Verified-Modules/specs/shared/#id-rmnfr2---category-inputs---parametervariable-naming", RuleSeverity: tflint.ERROR, }
var LocationTypeString = `string`
var Lock = AvmInterface{ VarCheck: varcheck.NewVarCheck(lockType, cty.NullVal(cty.DynamicPseudoType), true), RuleName: "lock", VarTypeString: LockTypeString, RuleEnabled: true, RuleLink: "https://azure.github.io/Azure-Verified-Modules/specs/shared/interfaces/#resource-locks", RuleSeverity: tflint.ERROR, }
var LockTypeString = `object({
kind = string
name = optional(string, null)
})`
LockTypeString is the type constraint string for lock interface. When updating the type constraint string, make sure to also update the two private endpoint interfaces (the one with subresource and the one without).
var ManagedIdentities = AvmInterface{ VarCheck: varcheck.NewVarCheck(StringToTypeConstraintWithDefaults(ManagedIdentitiesTypeString), cty.EmptyObjectVal, false), RuleName: "managed_identities", VarTypeString: ManagedIdentitiesTypeString, RuleEnabled: true, RuleLink: "https://azure.github.io/Azure-Verified-Modules/specs/shared/interfaces/#managed-identities", }
var ManagedIdentitiesTypeString = `object({
system_assigned = optional(bool, false)
user_assigned_resource_ids = optional(set(string), [])
})`
var PrivateEndpointTypeString = `` /* 1408-byte string literal not displayed */
var PrivateEndpointWithSubresourceNameTypeString = `` /* 1438-byte string literal not displayed */
var PrivateEndpoints = AvmInterface{ VarCheck: varcheck.NewVarCheck(StringToTypeConstraintWithDefaults(PrivateEndpointTypeString), cty.EmptyObjectVal, false), RuleName: "private_endpoints", VarTypeString: PrivateEndpointTypeString, RuleEnabled: true, RuleLink: "https://azure.github.io/Azure-Verified-Modules/specs/shared/interfaces/#private-endpoints", }
var PrivateEndpointsWithSubresourceName = AvmInterface{ VarCheck: varcheck.NewVarCheck(StringToTypeConstraintWithDefaults(PrivateEndpointWithSubresourceNameTypeString), cty.EmptyObjectVal, false), RuleName: "private_endpoints", VarTypeString: PrivateEndpointWithSubresourceNameTypeString, RuleEnabled: true, RuleLink: "https://azure.github.io/Azure-Verified-Modules/specs/shared/interfaces/#private-endpoints", }
var RoleAssignments = AvmInterface{ VarCheck: varcheck.NewVarCheck(roleAssignmentsType, cty.EmptyObjectVal, false), RuleName: "role_assignments", VarTypeString: RoleAssignmentsTypeString, RuleEnabled: true, RuleLink: "https://azure.github.io/Azure-Verified-Modules/specs/shared/interfaces/#role-assignments", }
var RoleAssignmentsTypeString = `` /* 504-byte string literal not displayed */
RoleAssignmentsTypeString is the type constraint string for role assignments. When updating the type constraint string, make sure to also update the two private endpoint interfaces (the one with subresource and the one without).
var Rules = []tflint.Rule{ NewVarCheckRuleFromAvmInterface(CustomerManagedKey), NewVarCheckRuleFromAvmInterface(DiagnosticSettings), NewVarCheckRuleFromAvmInterface(Location), NewVarCheckRuleFromAvmInterface(Lock), NewVarCheckRuleFromAvmInterface(ManagedIdentities), NewVarCheckRuleFromAvmInterface(RoleAssignments), NewVarCheckRuleFromAvmInterface(Tags), func() tflint.Rule { return common.NewEitherCheckRule("private_endpoints", true, tflint.ERROR, NewVarCheckRuleFromAvmInterface(PrivateEndpoints), NewVarCheckRuleFromAvmInterface(PrivateEndpointsWithSubresourceName)) }(), }
var Tags = AvmInterface{ VarCheck: varcheck.NewVarCheck(tagsType, cty.NullVal(cty.DynamicPseudoType), true), RuleName: "tags", VarTypeString: TagsTypeString, RuleEnabled: true, RuleLink: "https://azure.github.io/Azure-Verified-Modules/specs/shared/interfaces/#tags", }
var TagsTypeString = `map(string)`
TagsTypeString is the type constraint string for tags. When updating the type constraint string, make sure to also update the two private endpoint interfaces (the one with subresource and the one without).
Functions ¶
func StringToTypeConstraintWithDefaults ¶
func StringToTypeConstraintWithDefaults(c string) varcheck.TypeConstraintWithDefaults
StringToTypeConstraintWithDefaults converts a string to a TypeConstraintWithDefaults. The function will panic if the string is not valid.
Types ¶
type AvmInterface ¶
type AvmInterface struct { varcheck.VarCheck RuleName string // RuleName of the interface, also the name of the variable to check. VarTypeString string // The variable type value as a sting. RuleEnabled bool // Whether the rule is enabled by default. RuleLink string // RuleLink to the interface specification. RuleSeverity tflint.Severity // Severity of the interface. }
AvmInterface represents the definition of an AVM interface, with additional information for use in TFLint.
type Checker ¶ added in v0.3.1
type Checker struct {
// contains filtered or unexported fields
}
Checker is a struct that is used to chain checks together.
func CheckWithReturnValue ¶ added in v0.3.1
CheckWithReturnValue is a generic function that runs a check func() that, as well as returning a bool & error, also returns a value. The main function will then return the value and a new Checker with the continueCheck and err.
func NewChecker ¶ added in v0.3.1
func NewChecker() Checker
NewChecker is the constructor for the Checker type.
func (Checker) Check ¶ added in v0.3.1
Check is a executes a supplied function that returns a bool and an error. The bool is a continueCheck value that is used to determine if the check should continue. The error is the error that is returned from the check.
This function returns a new Checker, so it can be chained with other checks in a fluent style.
type InterfaceVarCheckRule ¶ added in v0.3.1
type InterfaceVarCheckRule struct { tflint.DefaultRule AvmInterface // This is the interface we are checking for. }
InterfaceVarCheckRule is the struct that represents a rule that check for the correct usage of an interface.
func NewVarCheckRuleFromAvmInterface ¶ added in v0.3.1
func NewVarCheckRuleFromAvmInterface(ifce AvmInterface) *InterfaceVarCheckRule
NewVarCheckRuleFromAvmInterface returns a new rule with the given variable.
func (*InterfaceVarCheckRule) Check ¶ added in v0.3.1
func (vcr *InterfaceVarCheckRule) Check(r tflint.Runner) error
Check checks whether the module satisfies the interface. It will search for a variable with the same name as the interface. It will check the type, default value and nullable attributes.
func (*InterfaceVarCheckRule) Enabled ¶ added in v0.3.1
func (vcr *InterfaceVarCheckRule) Enabled() bool
Enabled returns whether the rule is enabled.
func (*InterfaceVarCheckRule) Link ¶ added in v0.3.1
func (vcr *InterfaceVarCheckRule) Link() string
Link returns the link to the rule documentation.
func (*InterfaceVarCheckRule) Name ¶ added in v0.3.1
func (vcr *InterfaceVarCheckRule) Name() string
Name returns the rule name.
func (*InterfaceVarCheckRule) Severity ¶ added in v0.3.1
func (vcr *InterfaceVarCheckRule) Severity() tflint.Severity
Severity returns the severity of the rule.