hashicorp / hashicorp/hcl

Support plus operator for string concatenation

Open
#292 5 comments 1 reaction 0 assignees View on GitHub
enhancement syntax/native v2
Dominant language
Go
Stars
5.8k
Forks
659
Avg merge
20h 36m
Merged PRs (30d)
6

Description

Inspired by code in https://github.com/VladRassokhin/intellij-hcl/issues/212

```hcl2
resource "aws_kms_alias" "main" {
name = "alias/${var.alias}"
}
```

```hcl2
resource "aws_kms_alias" "main" {
name = "alias/" + var.alias
}
```

Should be equivalent, though `terraform validate` shows an error
`Unsuitable value for left operand: a number is required.`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the two HCL examples and the reported `terraform validate` error, then trace how expression operators are parsed and evaluated in this repository. The work is done when string concatenation with `+` behaves equivalently to interpolation and the relevant validation behavior is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.