Skip to content

Commit e730103

Browse files
committed
backends: Convert null values to empty objects before coercion
1 parent 7f29df9 commit e730103

File tree

1 file changed

+7
-0
lines changed
  • internal/backend/backendbase

1 file changed

+7
-0
lines changed

internal/backend/backendbase/base.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ func (b Base) ConfigSchema() *configschema.Block {
5757
func (b Base) PrepareConfig(configVal cty.Value) (cty.Value, tfdiags.Diagnostics) {
5858
var diags tfdiags.Diagnostics
5959

60+
if configVal.IsNull() {
61+
// We expect the backend configuration to be an object, so if it's
62+
// null for some reason (e.g. because of an interrupt), we'll turn
63+
// it into an empty object so that we can still coerce it
64+
configVal = cty.EmptyObjectVal
65+
}
66+
6067
schema := b.Schema
6168

6269
v, err := schema.CoerceValue(configVal)

0 commit comments

Comments
 (0)