Terraform variables syntax improvement suggestion

I find the current variable syntax really clumsy and backward. It’s readability and maintainability is bad. Just dozen variables create so much boilerlate code that it does not fit into one screen. So I am suggesting that you could make variable syntax more concise by making variable declaration syntax inline.

So instead of varbose (boilerplace)

variable "aws_region" {
  description = "AWS region"
  type        = string
  default     = "us-west-2"

it could be just:

string "aws_region" "us-west-2" # AWS region

This would make the variables much more readable, specially if they are in separate file
The “description” key is redundant as your syntax already has a specific documentation syntaxt with ‘#’ keyword. Which is very intuitive as so many other syxtaxes have the same.

This would not even need any change to underlaying code as you could make this an alias and just translate the short form to the long form in pre-processing. This would make this change backward compatible and allow still keep using the old long form.

So that the variable types would be keywords and alias for applying template:

variable "$variable_name" { 
  type = $variable_type 
  value = $variable_value 
  description = $variable_description 

to text $variable_type "$variable_name" # $variable_description

P.S. If you syntax validation requires it you could add empty parenthesis to the line or semicolor to indicate block termination.

P.P.S. Or simply add support for standard .properties files with “key=value#description” format.