update terraform-config-inspect (#20852)

This commit is contained in:
Kristin Laemmert 2019-03-28 07:54:01 -04:00 committed by GitHub
parent 86164c0bb4
commit 931851ca82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 4 deletions

2
go.mod
View File

@ -65,7 +65,7 @@ require (
github.com/hashicorp/logutils v1.0.0
github.com/hashicorp/memberlist v0.1.0 // indirect
github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb // indirect
github.com/hashicorp/terraform-config-inspect v0.0.0-20190208230122-b0707673339c
github.com/hashicorp/terraform-config-inspect v0.0.0-20190327195015-8022a2663a70
github.com/hashicorp/vault v0.10.4
github.com/jonboulle/clockwork v0.1.0 // indirect
github.com/joyent/triton-go v0.0.0-20180313100802-d8f9c0314926

2
go.sum
View File

@ -214,6 +214,8 @@ github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb h1:ZbgmOQt8DOg796fi
github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE=
github.com/hashicorp/terraform-config-inspect v0.0.0-20190208230122-b0707673339c h1:nCnsfi66NloVlmquh5dLox5yBwQk5CV5s2roWvbstnE=
github.com/hashicorp/terraform-config-inspect v0.0.0-20190208230122-b0707673339c/go.mod h1:ItvqtvbC3K23FFET62ZwnkwtpbKZm8t8eMcWjmVVjD8=
github.com/hashicorp/terraform-config-inspect v0.0.0-20190327195015-8022a2663a70 h1:oZm5nE11yhzsTRz/YrUyDMSvixePqjoZihwn8ipuOYI=
github.com/hashicorp/terraform-config-inspect v0.0.0-20190327195015-8022a2663a70/go.mod h1:ItvqtvbC3K23FFET62ZwnkwtpbKZm8t8eMcWjmVVjD8=
github.com/hashicorp/vault v0.10.4 h1:4x0lHxui/ZRp/B3E0Auv1QNBJpzETqHR2kQD3mHSBJU=
github.com/hashicorp/vault v0.10.4/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M=

View File

@ -284,6 +284,12 @@ func loadModule(dir string) (*Module, Diagnostics) {
Pos: sourcePosHCL(block.DefRange),
}
// check if this is overriding an existing module
var origSource string
if origMod, exists := mod.ModuleCalls[name]; exists {
origSource = origMod.Source
}
mod.ModuleCalls[name] = mc
if attr, defined := content.Attributes["source"]; defined {
@ -293,6 +299,10 @@ func loadModule(dir string) (*Module, Diagnostics) {
mc.Source = source
}
if mc.Source == "" {
mc.Source = origSource
}
if attr, defined := content.Attributes["version"]; defined {
var version string
valDiags := gohcl.DecodeExpression(attr.Expr, nil, &version)

View File

@ -237,8 +237,11 @@ func loadModuleLegacyHCL(dir string) (*Module, Diagnostics) {
Version: block.Version,
Pos: sourcePosLegacyHCL(item.Pos(), filename),
}
if _, exists := mod.ModuleCalls[name]; exists {
return nil, diagnosticsErrorf("duplicate module block for %q", name)
// it's possible this module call is from an override file
if origMod, exists := mod.ModuleCalls[name]; exists {
if mc.Source == "" {
mc.Source = origMod.Source
}
}
mod.ModuleCalls[name] = mc
}

2
vendor/modules.txt vendored
View File

@ -328,7 +328,7 @@ github.com/hashicorp/hil/scanner
github.com/hashicorp/logutils
# github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb
github.com/hashicorp/serf/coordinate
# github.com/hashicorp/terraform-config-inspect v0.0.0-20190208230122-b0707673339c
# github.com/hashicorp/terraform-config-inspect v0.0.0-20190327195015-8022a2663a70
github.com/hashicorp/terraform-config-inspect/tfconfig
# github.com/hashicorp/vault v0.10.4
github.com/hashicorp/vault/helper/pgpkeys