|
|
|
|
@ -10,6 +10,7 @@ import (
|
|
|
|
|
"github.com/zclconf/go-cty/cty"
|
|
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/internal/addrs"
|
|
|
|
|
"github.com/hashicorp/terraform/internal/lang/marks"
|
|
|
|
|
"github.com/hashicorp/terraform/internal/plans"
|
|
|
|
|
"github.com/hashicorp/terraform/internal/providers"
|
|
|
|
|
"github.com/hashicorp/terraform/internal/tfdiags"
|
|
|
|
|
@ -162,11 +163,6 @@ func (d *Deferred) GetDeferredChanges() []*plans.DeferredResourceInstanceChange
|
|
|
|
|
changes = append(changes, changeElem.Value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for _, configMapElem := range d.ephemeralResourceInstancesDeferred.Elems {
|
|
|
|
|
for _, changeElem := range configMapElem.Value.Elems {
|
|
|
|
|
changes = append(changes, changeElem.Value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for _, configMapElem := range d.partialExpandedResourcesDeferred.Elems {
|
|
|
|
|
for _, changeElem := range configMapElem.Value.Elems {
|
|
|
|
|
changes = append(changes, changeElem.Value)
|
|
|
|
|
@ -177,11 +173,6 @@ func (d *Deferred) GetDeferredChanges() []*plans.DeferredResourceInstanceChange
|
|
|
|
|
changes = append(changes, changeElem.Value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for _, configMapElem := range d.partialExpandedEphemeralResourceDeferred.Elems {
|
|
|
|
|
for _, changeElem := range configMapElem.Value.Elems {
|
|
|
|
|
changes = append(changes, changeElem.Value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return changes
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -294,6 +285,11 @@ func (d *Deferred) GetDeferredResourceInstances(addr addrs.AbsResource) map[addr
|
|
|
|
|
instanceAddr := elem.Key
|
|
|
|
|
change := elem.Value
|
|
|
|
|
|
|
|
|
|
if addr.Resource.Mode == addrs.EphemeralResourceMode {
|
|
|
|
|
// Deferred ephemeral resources always have an unknown value.
|
|
|
|
|
result[instanceAddr.Resource.Key] = cty.UnknownVal(cty.DynamicPseudoType).Mark(marks.Ephemeral)
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
// instances contains all the resources identified by the config address
|
|
|
|
|
// regardless of the instances of the module they might be in. We need
|
|
|
|
|
// to filter out the instances that are not part of the module we are
|
|
|
|
|
@ -506,15 +502,7 @@ func (d *Deferred) ReportDataSourceExpansionDeferred(addr addrs.PartialExpandedR
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *Deferred) ReportEphemeralResourceExpansionDeferred(addr addrs.PartialExpandedResource, change *plans.ResourceInstanceChange) {
|
|
|
|
|
if change == nil {
|
|
|
|
|
// This indicates a bug in Terraform, we shouldn't ever be setting a
|
|
|
|
|
// null change. Note, if we don't make this check here, then we'll
|
|
|
|
|
// just crash later anyway. This way the stack trace points to the
|
|
|
|
|
// source of the problem.
|
|
|
|
|
panic("change must not be nil")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *Deferred) ReportEphemeralResourceExpansionDeferred(addr addrs.PartialExpandedResource) {
|
|
|
|
|
d.mu.Lock()
|
|
|
|
|
defer d.mu.Unlock()
|
|
|
|
|
|
|
|
|
|
@ -537,7 +525,7 @@ func (d *Deferred) ReportEphemeralResourceExpansionDeferred(addr addrs.PartialEx
|
|
|
|
|
}
|
|
|
|
|
configMap.Put(addr, &plans.DeferredResourceInstanceChange{
|
|
|
|
|
DeferredReason: providers.DeferredReasonInstanceCountUnknown,
|
|
|
|
|
Change: change,
|
|
|
|
|
Change: nil, // since we don't serialize this we can get away with no change, we store the addr, that should be enough
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|