hcl icon indicating copy to clipboard operation
hcl copied to clipboard

Empty block syntactic sugar

Open hadard opened this issue 6 years ago • 1 comments

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

hadard avatar Mar 06 '19 09:03 hadard

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)

aidan-mundy avatar Nov 04 '21 00:11 aidan-mundy