From 584811b829260bd75abf92c71ad2465161ff6f30 Mon Sep 17 00:00:00 2001 From: Alisdair McDiarmid Date: Mon, 6 Mar 2023 14:35:06 -0500 Subject: [PATCH] initwd: Add fake range for fake root module This isn't currently used anywhere downstream, but it easily could be in the future, so populating the range with some zero-ish data is more robust. --- internal/initwd/from_module.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/initwd/from_module.go b/internal/initwd/from_module.go index 806e505e61..32337ab254 100644 --- a/internal/initwd/from_module.go +++ b/internal/initwd/from_module.go @@ -10,6 +10,7 @@ import ( "sort" "strings" + "github.com/hashicorp/hcl/v2" "github.com/hashicorp/terraform/internal/addrs" "github.com/hashicorp/terraform/internal/configs" "github.com/hashicorp/terraform/internal/configs/configload" @@ -23,6 +24,7 @@ import ( ) const initFromModuleRootCallName = "root" +const initFromModuleRootFilename = "
" const initFromModuleRootKeyPrefix = initFromModuleRootCallName + "." // DirFromModule populates the given directory (which must exist and be @@ -136,6 +138,11 @@ func DirFromModule(ctx context.Context, loader *configload.Loader, rootDir, modu initFromModuleRootCallName: { Name: initFromModuleRootCallName, SourceAddr: sourceAddr, + DeclRange: hcl.Range{ + Filename: initFromModuleRootFilename, + Start: hcl.InitialPos, + End: hcl.InitialPos, + }, }, }, ProviderRequirements: &configs.RequiredProviders{},