Skip to content

Commit 4bcf982

Browse files
committed
note about locals{}: (dis)similar to variable "x" {}
1 parent dc30e62 commit 4bcf982

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

override.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ func mergeLocalsBlock(primaries []*primaryState, override *hclwrite.Block, overr
291291
if pblock.Type() != "locals" {
292292
continue
293293
}
294+
// NOTE: We don't insert new attrs into an empty body.
295+
// If that ever changes, empty inline blocks (e.g.
296+
// `locals {}`) would need the same AppendNewline fix
297+
// as mergeBlock to avoid same line usage that breaks
298+
// HCL.
294299
if _, exists := pblock.Body().Attributes()[name]; exists {
295300
pblock.Body().SetAttributeRaw(name, attr.Expr().BuildTokens(nil))
296301
primary.modified = true

0 commit comments

Comments
 (0)