hashicorp / hcl

HCL is the HashiCorp configuration language.
Mozilla Public License 2.0
5.24k stars 591 forks source link

Empty block syntactic sugar #288

Open hadard opened 5 years ago

hadard commented 5 years ago

Hi,

I've noticed that often configuration files contain empty blocks, for example:

variable "prod_access_key" {}
variable "prod_secret_key" {}
variable "test_account_id" {}
variable "test_access_key" {}
variable "test_secret_key" {}
variable "bucket_name" {}

taken from: https://github.com/terraform-providers/terraform-provider-aws/blob/24e937a299c9115be47052404a97d6c9d5a4ccfa/examples/s3-cross-account-access/variables.tf.

Have you considered in HCL2 allowing shorter form without explicit mention the empty block? For example:

variable "prod_access_key"
variable "prod_secret_key"
variable "test_account_id"
variable "test_access_key"
variable "test_secret_key"
variable "bucket_name" 

Thanks! Hadar

aidan-mundy commented 2 years ago

This would be a neat feature. Maybe using a different single character to end inline blocks would help with parsing the syntax? (a semicolon for example)