interfaces

package
v0.11.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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",
}
View Source
var CustomerManagedKeyTypeString = `` /* 204-byte string literal not displayed */
View Source
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",
}
View Source
var DiagnosticTypeString = `` /* 723-byte string literal not displayed */
View Source
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,
}
View Source
var LocationTypeString = `string`
View Source
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,
}
View Source
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).

View Source
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",
}
View Source
var ManagedIdentitiesTypeString = `object({
	system_assigned            = optional(bool, false)
	user_assigned_resource_ids = optional(set(string), [])
})`
View Source
var PrivateEndpointTypeString = `` /* 1408-byte string literal not displayed */
View Source
var PrivateEndpointWithSubresourceNameTypeString = `` /* 1438-byte string literal not displayed */
View Source
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",
}
View Source
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",
}
View Source
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",
}
View Source
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).

View Source
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",
}
View Source
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

func CheckWithReturnValue[TR any](c Checker, check func() (TR, bool, error)) (ret TR, rc Checker)

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

func (c Checker) Check(check func() (bool, error)) Checker

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 (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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL