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.
pull/32781/head
Alisdair McDiarmid 3 years ago
parent d9eae48a75
commit 584811b829

@ -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 = "<main configuration>"
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{},

Loading…
Cancel
Save