core: Fix DiffTransformer node addresses
In this codepath we're still using the old "internal" ResourceAddress parser to parse resource addresses from the diff, but the string being parsed does not include a module path and so the result is interpreted as a resource in the root module. We need to rewrite this to be in the correct module path as part of converting to the new address representation, in order to get a correct absolute address.
This commit is contained in:
parent
4472cffb35
commit
f475b3b931
|
@ -42,7 +42,14 @@ func (t *DiffTransformer) Transform(g *Graph) error {
|
|||
panic(fmt.Sprintf(
|
||||
"Error parsing internal name, this is a bug: %q", name))
|
||||
}
|
||||
|
||||
// legacyAddr is relative even though the legacy ResourceAddress is
|
||||
// usually absolute, so we need to do some trickery here to get
|
||||
// a new-style absolute address in the right module.
|
||||
// FIXME: Clean this up once the "Diff" types are updated to use
|
||||
// our new address types.
|
||||
addr := legacyAddr.AbsResourceInstanceAddr()
|
||||
addr = addr.Resource.Absolute(normalizeModulePath(m.Path))
|
||||
|
||||
// If we're destroying, add the destroy node
|
||||
if inst.Destroy || inst.GetDestroyDeposed() {
|
||||
|
|
Loading…
Reference in New Issue