Skip to content

Commit 6f8592e

Browse files
dbanckDanielMSchmidt
authored andcommitted
Make dynamic reference error message more precise
1 parent ee8f7ab commit 6f8592e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/terraform/context_init_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ module "example" {
235235
return tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
236236
Severity: hcl.DiagError,
237237
Summary: `Invalid module source`,
238-
Detail: `The module source can only reference input variables and local values.`,
238+
Detail: `The module source can only reference constant input variables and local values.`,
239239
Subject: &hcl.Range{
240240
Filename: filepath.Join(m.SourceDir, "main.tf"),
241241
Start: hcl.Pos{Line: 4, Column: 31, Byte: 95},
@@ -317,7 +317,7 @@ module "example" {
317317
return tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
318318
Severity: hcl.DiagError,
319319
Summary: "Invalid module source",
320-
Detail: "The module source can only reference input variables and local values.",
320+
Detail: "The module source can only reference constant input variables and local values.",
321321
Subject: &hcl.Range{
322322
Filename: filepath.Join(m.SourceDir, "main.tf"),
323323
Start: hcl.Pos{Line: 5, Column: 33, Byte: 91},
@@ -402,7 +402,7 @@ output "id" {
402402
return tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
403403
Severity: hcl.DiagError,
404404
Summary: "Invalid module source",
405-
Detail: "The module source can only reference input variables and local values.",
405+
Detail: "The module source can only reference constant input variables and local values.",
406406
Subject: &hcl.Range{
407407
Filename: filepath.Join(m.SourceDir, "main.tf"),
408408
Start: hcl.Pos{Line: 7, Column: 33, Byte: 107},

internal/terraform/node_module_install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func evalSource(sourceExpr hcl.Expression, hasVersion bool, ctx EvalContext) (ad
173173
diags = diags.Append(&hcl.Diagnostic{
174174
Severity: hcl.DiagError,
175175
Summary: "Invalid module source",
176-
Detail: "The module source can only reference input variables and local values.",
176+
Detail: "The module source can only reference constant input variables and local values.",
177177
Subject: ref.SourceRange.ToHCL().Ptr(),
178178
})
179179
return nil, "", diags
@@ -310,7 +310,7 @@ func evalVersionConstraint(versionExpr hcl.Expression, ctx EvalContext) (configs
310310
diags = diags.Append(&hcl.Diagnostic{
311311
Severity: hcl.DiagError,
312312
Summary: "Invalid module version",
313-
Detail: "The module version can only reference input variables and local values.",
313+
Detail: "The module version can only reference constant input variables and local values.",
314314
Subject: ref.SourceRange.ToHCL().Ptr(),
315315
})
316316
return ret, diags

0 commit comments

Comments
 (0)