Open
Description
Context
Users may - and anecdotally often do - write configuration without considering the type of variables, for example:
variable "foo" {
}
Sometimes they go one step further but still not very far by defining the type as any
:
variable "foo" {
type = any
}
or they may let the type to be inferred from the default value, e.g.
variable "foo" {
default = []
}
In all these cases, they can introduce bugs due to type mismatches/conversions or at least make it much more difficult for collaborators and consumers of the module to understand the module as a whole.
Proposal
- Raise missing
type
constraint as a warning diagnostic, suggesting that types are better declared explicitly to communicate intentions - Raise
type = any
as informal diagnostic, suggesting more concrete type, to communicate intentions - Provide
quickfix
code action to generatetype
based ondefault
value