hashicorp / hashicorp/hcl

Avoiding Duplicate

Open
#274 2 comments 1 reaction 0 assignees View on GitHub
v1
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

Am Currently aware of the following

- https://github.com/hashicorp/hcl/issues/81
- https://github.com/hashicorp/hcl/issues/188
- https://github.com/hashicorp/hcl/issues/42

I have a configuration file that is over `900` lines and realised its all duplication.

### Instead of writing

```hcl
provider "A" {
var1 = "X"
var2 = "Y"
}

provider "B" {
var1 = "X"
var2 = "Y"
}

provider "C" {
var1 = "X"
var2 = "Y"
var3 = "Z"
}

extra "D" {
var1 = "X"
var2 = "Y"
}
```
### It would be nice to be able to write it as follows

```hcl
provider "A" , "B", "C" ; extra "D" {
var1 = "X"
var2 = "Y"
}
provider "C" "var3" = "Z"
```

### Another possibility would be the ability to set variables using `$`

```hcl
$tmp {
var1 = "X"
var2 = "Y"
}

provider "A" = $tmp
provider "B" = $tmp
provider "C" {
$tmp
var3 = "Z"
}
extra "D" = $tmp
```

### Rational
Configuration sometimes contain duplicate values, Been able to concatenate values or set variables makes `HCL` a much more powerful configuration language.

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the related HCL issues linked in the description before deciding on scope. Compare the proposed grouped blocks and `$` variables with the existing HCL syntax and define which duplication-reduction behavior should be supported; done means the chosen syntax and semantics are specified and implemented consistently.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.