Skip to content

Commit

Permalink
Remove rawNames from *conversionContext.applyDefaults
Browse files Browse the repository at this point in the history
This is a pure refactor and doesn't have behavioral effects.
  • Loading branch information
iwahbe committed Apr 10, 2024
1 parent 741998d commit 81f7879
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/tfbridge/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ func (ctx *conversionContext) makeObjectTerraformInputs(
}

// Now enumerate and propagate defaults if the corresponding values are still missing.
if err := ctx.applyDefaults(result, olds, news, tfs, ps, false); err != nil {
if err := ctx.applyDefaults(result, olds, news, tfs, ps); err != nil {
return nil, err
}

Expand Down Expand Up @@ -710,7 +710,6 @@ func (ctx *conversionContext) applyDefaults(
olds, news resource.PropertyMap,
tfs shim.SchemaMap,
ps map[string]*SchemaInfo,
rawNames bool,
) error {

if !ctx.ApplyDefaults {
Expand Down Expand Up @@ -756,7 +755,7 @@ func (ctx *conversionContext) applyDefaults(
var source string

// If we already have a default value from a previous version of this resource, use that instead.
key, tfi, psi := getInfoFromTerraformName(name, tfs, ps, rawNames)
key, tfi, psi := getInfoFromTerraformName(name, tfs, ps, false)

if old, hasold := olds[key]; hasold && useOldDefault(key) {
v, err := ctx.makeTerraformInput(name, resource.PropertyValue{},
Expand Down Expand Up @@ -908,8 +907,9 @@ func (ctx *conversionContext) applyDefaults(
return true
}

// Next, if we already have a default value from a previous version of this resource, use that instead.
key, tfi, psi := getInfoFromTerraformName(name, tfs, ps, rawNames)
// Next, if we already have a default value from a previous version of this
// resource, use that instead.
key, tfi, psi := getInfoFromTerraformName(name, tfs, ps, false)

if old, hasold := olds[key]; hasold && useOldDefault(key) {
v, err := ctx.makeTerraformInput(name, resource.PropertyValue{}, old, tfi, psi)
Expand Down

0 comments on commit 81f7879

Please sign in to comment.