mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
terraform: Ensure ConnInfo is initialized
This commit is contained in:
parent
2b6d7dc0b9
commit
fec8e95a09
@ -467,6 +467,14 @@ func (c *Context) applyWalkFn() depgraph.WalkFunc {
|
|||||||
diff.init()
|
diff.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we do not have any connection info, initialize
|
||||||
|
if r.State.ConnInfo == nil {
|
||||||
|
r.State.ConnInfo = &ResourceConnectionInfo{}
|
||||||
|
}
|
||||||
|
if r.State.ConnInfo.Raw == nil {
|
||||||
|
r.State.ConnInfo.Raw = make(map[string]interface{})
|
||||||
|
}
|
||||||
|
|
||||||
// Remove any output values from the diff
|
// Remove any output values from the diff
|
||||||
for k, ad := range diff.Attributes {
|
for k, ad := range diff.Attributes {
|
||||||
if ad.Type == DiffAttrOutput {
|
if ad.Type == DiffAttrOutput {
|
||||||
|
@ -513,6 +513,10 @@ func TestContextApply_Provisioner_ConnInfo(t *testing.T) {
|
|||||||
pr := testProvisioner()
|
pr := testProvisioner()
|
||||||
|
|
||||||
p.ApplyFn = func(s *ResourceState, d *ResourceDiff) (*ResourceState, error) {
|
p.ApplyFn = func(s *ResourceState, d *ResourceDiff) (*ResourceState, error) {
|
||||||
|
if s.ConnInfo == nil || s.ConnInfo.Raw == nil {
|
||||||
|
t.Fatalf("ConnInfo not initialized")
|
||||||
|
}
|
||||||
|
|
||||||
result, _ := testApplyFn(s, d)
|
result, _ := testApplyFn(s, d)
|
||||||
result.ConnInfo = &ResourceConnectionInfo{
|
result.ConnInfo = &ResourceConnectionInfo{
|
||||||
Raw: map[string]interface{}{
|
Raw: map[string]interface{}{
|
||||||
|
Loading…
Reference in New Issue
Block a user