How do you declare an input variable?
BeginnerConceptVariables, Locals, Outputs and Types
Answer
A variable block with an optional type, default, description, validation, sensitive and nullable. Without a default the variable is required.
variable "instance_type" {
type = string
description = "EC2 instance size"
default = "t3.micro"
}
More on Variables, Locals, Outputs and Types
In what order does Terraform load variable values?BeginnerHow do you define an output and what is it for?BeginnerWhat is the difference between locals and variables?BeginnerWhat are the primitive types in Terraform?BeginnerHow do list, set and map differ?IntermediateWhat are `object` and `tuple` types?Intermediate