Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0c07814
fix nested compute read
VenelinMartinov Jul 12, 2024
841998f
fix tests = ()
VenelinMartinov Jul 12, 2024
a2b4bf5
remove debug logging
VenelinMartinov Jul 12, 2024
baa894f
integraration tests
VenelinMartinov Jul 15, 2024
efe595d
fix object check in input extraction
VenelinMartinov Jul 15, 2024
96a2f0b
add further todos related to wrong object check
VenelinMartinov Jul 15, 2024
48fd41b
Revert "add further todos related to wrong object check"
VenelinMartinov Jul 16, 2024
41499a0
revert logging change
VenelinMartinov Jul 16, 2024
637504a
lint
VenelinMartinov Jul 16, 2024
7e5b053
update test
VenelinMartinov Jul 16, 2024
ff29def
upgrade providertest package
VenelinMartinov Jul 16, 2024
bf92dfd
go mod tidy
VenelinMartinov Jul 16, 2024
ec38a62
Merge branch 'master' into vvm/fix_nested_computed_read1
VenelinMartinov Jul 16, 2024
4399511
remove note about CastToTypeObject
VenelinMartinov Jul 16, 2024
f0a277b
add note to CastToTypeObject
VenelinMartinov Jul 16, 2024
0260a54
remove unused pulumi schema override
VenelinMartinov Jul 17, 2024
886d4f2
Merge branch 'master' into vvm/fix_nested_computed_read1
VenelinMartinov Jul 17, 2024
4d31021
make tidy
VenelinMartinov Jul 17, 2024
f9ce200
Merge branch 'master' into vvm/fix_nested_computed_read1
VenelinMartinov Jul 22, 2024
76191b9
remove unused schema options
VenelinMartinov Jul 22, 2024
32f9e37
Merge branch 'vvm/remove_unused_schema_options' into vvm/fix_nested_c…
VenelinMartinov Jul 22, 2024
39251cf
pf extract inputs from outputs tests
VenelinMartinov Jul 22, 2024
b5ce289
map tests
VenelinMartinov Jul 22, 2024
e40f6a0
more tests
VenelinMartinov Jul 22, 2024
4a59ef9
rename tests, add block tests
VenelinMartinov Jul 23, 2024
ec3ae31
Merge branch 'vvm/pf_extract_inputs_from_outputs' into vvm/fix_nested…
VenelinMartinov Jul 23, 2024
1b672b5
fix pf tests
VenelinMartinov Jul 23, 2024
7fac4a1
add more todos
VenelinMartinov Jul 23, 2024
f07cf0c
fix todos
VenelinMartinov Jul 23, 2024
8f9d753
Merge branch 'vvm/pf_extract_inputs_from_outputs' into vvm/fix_nested…
VenelinMartinov Jul 23, 2024
4427b72
Merge branch 'master' into vvm/pf_extract_inputs_from_outputs
VenelinMartinov Jul 23, 2024
849961e
Merge branch 'vvm/pf_extract_inputs_from_outputs' into vvm/fix_nested…
VenelinMartinov Jul 23, 2024
08fc395
fix sdkv2 tests
VenelinMartinov Jul 23, 2024
89906ef
remove note
VenelinMartinov Jul 23, 2024
13521d8
Merge branch 'master' into vvm/fix_nested_computed_read1
VenelinMartinov Jul 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dynamic/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,8 @@ github.com/pulumi/esc v0.9.1 h1:HH5eEv8sgyxSpY5a8yePyqFXzA8cvBvapfH8457+mIs=
github.com/pulumi/esc v0.9.1/go.mod h1:oEJ6bOsjYlQUpjf70GiX+CXn3VBmpwFDxUTlmtUN84c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.13 h1:9CAaoviOTuCVHDI15h3znXa5JsKYtXLYHIIdxOCzo3Y=
github.com/pulumi/providertest v0.0.13/go.mod h1:REAoaN+hGOtdWJGirfWYqcSjCejlbGfzyVTUuemJTuE=
github.com/pulumi/providertest v0.0.14 h1:5QlAPAAs82jkQraHsJvq1xgVfC7xtW8sFJwv2pHgxQ8=
github.com/pulumi/providertest v0.0.14/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.11.0 h1:Jw9gBvyfmfOMq/EkYDm9+zGPxsDAA8jfeMpHmtZ+1oA=
github.com/pulumi/pulumi-java/pkg v0.11.0/go.mod h1:sXAk25P47AQVQL6ilAbFmRNgZykC7og/+87ihnqzFTc=
github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.8 h1:mav2tSitA9BPJPLLahKgepHyYsMzwaTm4cvp0dcTMYw=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/mitchellh/reflectwalk v1.0.2
github.com/pkg/errors v0.9.1
github.com/pulumi/inflector v0.1.1
github.com/pulumi/providertest v0.0.13
github.com/pulumi/providertest v0.0.14
github.com/pulumi/pulumi-java/pkg v0.11.0
github.com/pulumi/pulumi-terraform-bridge/x/muxer v0.0.8
github.com/pulumi/pulumi-yaml v1.9.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1902,8 +1902,8 @@ github.com/pulumi/esc v0.9.1 h1:HH5eEv8sgyxSpY5a8yePyqFXzA8cvBvapfH8457+mIs=
github.com/pulumi/esc v0.9.1/go.mod h1:oEJ6bOsjYlQUpjf70GiX+CXn3VBmpwFDxUTlmtUN84c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.13 h1:9CAaoviOTuCVHDI15h3znXa5JsKYtXLYHIIdxOCzo3Y=
github.com/pulumi/providertest v0.0.13/go.mod h1:REAoaN+hGOtdWJGirfWYqcSjCejlbGfzyVTUuemJTuE=
github.com/pulumi/providertest v0.0.14 h1:5QlAPAAs82jkQraHsJvq1xgVfC7xtW8sFJwv2pHgxQ8=
github.com/pulumi/providertest v0.0.14/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.11.0 h1:Jw9gBvyfmfOMq/EkYDm9+zGPxsDAA8jfeMpHmtZ+1oA=
github.com/pulumi/pulumi-java/pkg v0.11.0/go.mod h1:sXAk25P47AQVQL6ilAbFmRNgZykC7og/+87ihnqzFTc=
github.com/pulumi/pulumi-yaml v1.9.1 h1:JPeI80M23SPactxgnCFS1casZlSr7ZhAXwSx4H55QQ4=
Expand Down
4 changes: 2 additions & 2 deletions pf/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1901,8 +1901,8 @@ github.com/pulumi/esc v0.9.1 h1:HH5eEv8sgyxSpY5a8yePyqFXzA8cvBvapfH8457+mIs=
github.com/pulumi/esc v0.9.1/go.mod h1:oEJ6bOsjYlQUpjf70GiX+CXn3VBmpwFDxUTlmtUN84c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.13 h1:9CAaoviOTuCVHDI15h3znXa5JsKYtXLYHIIdxOCzo3Y=
github.com/pulumi/providertest v0.0.13/go.mod h1:REAoaN+hGOtdWJGirfWYqcSjCejlbGfzyVTUuemJTuE=
github.com/pulumi/providertest v0.0.14 h1:5QlAPAAs82jkQraHsJvq1xgVfC7xtW8sFJwv2pHgxQ8=
github.com/pulumi/providertest v0.0.14/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.11.0 h1:Jw9gBvyfmfOMq/EkYDm9+zGPxsDAA8jfeMpHmtZ+1oA=
github.com/pulumi/pulumi-java/pkg v0.11.0/go.mod h1:sXAk25P47AQVQL6ilAbFmRNgZykC7og/+87ihnqzFTc=
github.com/pulumi/pulumi-yaml v1.9.1 h1:JPeI80M23SPactxgnCFS1casZlSr7ZhAXwSx4H55QQ4=
Expand Down
20 changes: 6 additions & 14 deletions pf/tests/extract_inputs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,6 @@ func TestExtractInputsFromOutputsPF(t *testing.T) {
}}},
}),
},
// TODO[pulumi/pulumi-terraform-bridge#2180]: This should not yield values for computed properties
{
name: "list nested block computed not extracted",
props: resource.NewPropertyMapFromMap(map[string]interface{}{
Expand All @@ -727,12 +726,9 @@ func TestExtractInputsFromOutputsPF(t *testing.T) {
V: []resource.PropertyValue{},
},
resource.PropertyKey("block_field"): resource.PropertyValue{V: []resource.PropertyValue{{
V: resource.PropertyMap{
resource.PropertyKey("__defaults"): resource.PropertyValue{
V: []resource.PropertyValue{},
},
resource.PropertyKey("nested_field"): resource.PropertyValue{V: "nested_value"}, // wrong
},
V: resource.PropertyMap{resource.PropertyKey("__defaults"): resource.PropertyValue{
V: []resource.PropertyValue{},
}},
}}},
}),
},
Expand Down Expand Up @@ -801,7 +797,6 @@ func TestExtractInputsFromOutputsPF(t *testing.T) {
}}},
}),
},
// TODO[pulumi/pulumi-terraform-bridge#2180]: This should not yield values for computed properties
{
name: "set nested block computed not extracted",
props: resource.NewPropertyMapFromMap(map[string]interface{}{
Expand All @@ -825,12 +820,9 @@ func TestExtractInputsFromOutputsPF(t *testing.T) {
V: []resource.PropertyValue{},
},
resource.PropertyKey("block_field"): resource.PropertyValue{V: []resource.PropertyValue{{
V: resource.PropertyMap{
resource.PropertyKey("__defaults"): resource.PropertyValue{
V: []resource.PropertyValue{},
},
resource.PropertyKey("nested_field"): resource.PropertyValue{V: "nested_value"}, //wrong
},
V: resource.PropertyMap{resource.PropertyKey("__defaults"): resource.PropertyValue{
V: []resource.PropertyValue{},
}},
}}},
}),
},
Expand Down
2 changes: 1 addition & 1 deletion pf/tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hashicorp/terraform-provider-tls/shim v0.0.0-00010101000000-000000000000
github.com/hexops/autogold/v2 v2.2.1
github.com/pulumi/providertest v0.0.13
github.com/pulumi/providertest v0.0.14
github.com/pulumi/pulumi-terraform-bridge/pf v0.0.0
github.com/pulumi/pulumi-terraform-bridge/v3 v3.87.0
github.com/stretchr/testify v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions pf/tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1928,8 +1928,8 @@ github.com/pulumi/esc v0.9.1 h1:HH5eEv8sgyxSpY5a8yePyqFXzA8cvBvapfH8457+mIs=
github.com/pulumi/esc v0.9.1/go.mod h1:oEJ6bOsjYlQUpjf70GiX+CXn3VBmpwFDxUTlmtUN84c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.13 h1:9CAaoviOTuCVHDI15h3znXa5JsKYtXLYHIIdxOCzo3Y=
github.com/pulumi/providertest v0.0.13/go.mod h1:REAoaN+hGOtdWJGirfWYqcSjCejlbGfzyVTUuemJTuE=
github.com/pulumi/providertest v0.0.14 h1:5QlAPAAs82jkQraHsJvq1xgVfC7xtW8sFJwv2pHgxQ8=
github.com/pulumi/providertest v0.0.14/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.11.0 h1:Jw9gBvyfmfOMq/EkYDm9+zGPxsDAA8jfeMpHmtZ+1oA=
github.com/pulumi/pulumi-java/pkg v0.11.0/go.mod h1:sXAk25P47AQVQL6ilAbFmRNgZykC7og/+87ihnqzFTc=
github.com/pulumi/pulumi-yaml v1.9.1 h1:JPeI80M23SPactxgnCFS1casZlSr7ZhAXwSx4H55QQ4=
Expand Down
2 changes: 1 addition & 1 deletion pkg/tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
github.com/hexops/autogold/v2 v2.2.1
github.com/hexops/valast v1.4.4
github.com/pulumi/providertest v0.0.13
github.com/pulumi/providertest v0.0.14
github.com/pulumi/pulumi-terraform-bridge/v3 v3.80.0
github.com/stretchr/testify v1.9.0
gotest.tools v2.2.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions pkg/tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1912,8 +1912,8 @@ github.com/pulumi/esc v0.9.1 h1:HH5eEv8sgyxSpY5a8yePyqFXzA8cvBvapfH8457+mIs=
github.com/pulumi/esc v0.9.1/go.mod h1:oEJ6bOsjYlQUpjf70GiX+CXn3VBmpwFDxUTlmtUN84c=
github.com/pulumi/inflector v0.1.1 h1:dvlxlWtXwOJTUUtcYDvwnl6Mpg33prhK+7mzeF+SobA=
github.com/pulumi/inflector v0.1.1/go.mod h1:HUFCjcPTz96YtTuUlwG3i3EZG4WlniBvR9bd+iJxCUY=
github.com/pulumi/providertest v0.0.13 h1:9CAaoviOTuCVHDI15h3znXa5JsKYtXLYHIIdxOCzo3Y=
github.com/pulumi/providertest v0.0.13/go.mod h1:REAoaN+hGOtdWJGirfWYqcSjCejlbGfzyVTUuemJTuE=
github.com/pulumi/providertest v0.0.14 h1:5QlAPAAs82jkQraHsJvq1xgVfC7xtW8sFJwv2pHgxQ8=
github.com/pulumi/providertest v0.0.14/go.mod h1:GcsqEGgSngwaNOD+kICJPIUQlnA911fGBU8HDlJvVL0=
github.com/pulumi/pulumi-java/pkg v0.11.0 h1:Jw9gBvyfmfOMq/EkYDm9+zGPxsDAA8jfeMpHmtZ+1oA=
github.com/pulumi/pulumi-java/pkg v0.11.0/go.mod h1:sXAk25P47AQVQL6ilAbFmRNgZykC7og/+87ihnqzFTc=
github.com/pulumi/pulumi-yaml v1.9.1 h1:JPeI80M23SPactxgnCFS1casZlSr7ZhAXwSx4H55QQ4=
Expand Down
78 changes: 78 additions & 0 deletions pkg/tests/schema_pulumi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1396,3 +1396,81 @@ Resources:
})
}
}

func TestFullyComputedNestedAttribute(t *testing.T) {
resMap := map[string]*schema.Resource{
"prov_test": {
Schema: map[string]*schema.Schema{
"attached_disks": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Optional: true,
Type: schema.TypeString,
},
"key256": {
Computed: true,
Type: schema.TypeString,
},
},
},
},
"top_level_computed": {
Type: schema.TypeString,
Computed: true,
},
},
},
}

importer := func(val any) func(context.Context, *schema.ResourceData, interface{}) ([]*schema.ResourceData, error) {
return func(ctx context.Context, rd *schema.ResourceData, i interface{}) ([]*schema.ResourceData, error) {
elMap := map[string]any{
"name": "disk1",
"key256": val,
}
err := rd.Set("attached_disks", []map[string]any{elMap})
require.NoError(t, err)

err = rd.Set("top_level_computed", "computed_val")
require.NoError(t, err)

return []*schema.ResourceData{rd}, nil
}
}
bridgedProvider := pulcheck.BridgedProvider(t, "prov", resMap)

program := `
name: test
runtime: yaml
`
for _, tc := range []struct {
name string
importVal any
}{
{
"non-nil",
"val1",
},
{
"nil",
nil,
},
} {
t.Run(tc.name, func(t *testing.T) {
resMap["prov_test"].Importer = &schema.ResourceImporter{
StateContext: importer(tc.importVal),
}

pt := pulcheck.PulCheck(t, bridgedProvider, program)

res := pt.Import("prov:index/test:Test", "res1", "id1", "")

t.Logf(res.Stdout)

require.NotContains(t, res.Stdout, "One or more imported inputs failed to validate")
})
}
}
7 changes: 2 additions & 5 deletions pkg/tfbridge/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (

shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/schema"
shimutil "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/util"
)

// This file deals with translating between the Pulumi representations of a resource's configuration and state and the
Expand Down Expand Up @@ -497,8 +496,6 @@ func (ctx *conversionContext) makeTerraformInput(

var tfflds shim.SchemaMap

// We cannot use [shimutil.CastToTypeObject] because we have machinery that constructs invalid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is exactly the root cause, I find it unfortunate to remove this comment. elemSchemas produces

(&schema.Schema{Elem: e}).Shim()

This is not a valid schema as it does not have Type() defined. This is an artificial schema that you will not find coming from the actual provider, it's a recursion artifact.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But CastToTypeObject is wrong in the first place for SDKv2 - it checks for .Resource under a Map type which is illegal in SDKV2.

I don't understand why we'd want to use it here anyway - tfs.Elem().(shim.Resource) is the correct way to check for an object type

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to block on this change but the Elem() representation is continuously confusing. I don't think "object type" is defined enough for me.

How about #2187 to try to clarify some of the issues here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding was that tfs.Elem().(shim.Resource) was insufficient to identify an object type: tfs.Type() == TypeList && tfs.Elem().(shim.Resource) implied a List[Object] where tfs.Type() == TypeMap && tfs.Elem().(shim.Resource) implied an Object type.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When recurring over a List[Object] type which is indeed tfs.Type() == TypeList && tfs.Elem().(shim.Resource) the code will call elemSchemas to compute a shim.Schema for the Object, which will result in a shim.Schema value that's not recognized by CastToTypeObject. One can argue that it should, in fact, be recognized, and then we could bring that back here and work this out that way. That's a bit more changes though.

// resource objects, such as [elemSchemas].
if tfs != nil {
if r, ok := tfs.Elem().(shim.Resource); ok {
tfflds = r.Schema()
Expand Down Expand Up @@ -1719,9 +1716,9 @@ func extractSchemaInputs(
return resource.NewArrayProperty(v)
case state.IsObject():
obj := state.ObjectValue()
if tfflds, ok := shimutil.CastToTypeObject(tfs); ok {
if tfflds, ok := tfs.Elem().(shim.Resource); ok {
return resource.NewProperty(
extractSchemaInputsObject(obj, tfflds, ps.Fields),
extractSchemaInputsObject(obj, tfflds.Schema(), ps.Fields),
)
}

Expand Down
67 changes: 47 additions & 20 deletions pkg/tfbridge/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2179,6 +2179,46 @@ func TestRefreshExtractInputsFromOutputsMaxItemsOne(t *testing.T) {
assert.NoError(t, err)
}

func TestRefreshExtractInputsFromOutputsListOfObjects(t *testing.T) {
t.Parallel()

ruleSetProps := resource.PropertyMap{
"attachedDisks": resource.NewArrayProperty([]resource.PropertyValue{
resource.NewObjectProperty(resource.PropertyMap{
"name": resource.NewStringProperty("name1"),
"key256": resource.NewNullProperty(),
}),
}),
}

ruleSetSchema := func() shim.SchemaMap {
blockList := func(elem schema.SchemaMap) shim.Schema {
s := schema.Schema{
Type: shim.TypeList,
Optional: true,
Elem: (&schema.Resource{
Schema: elem,
}).Shim(),
}
return s.Shim()
}

return schema.SchemaMap{
"attachedDisks": blockList(schema.SchemaMap{
"name": (&schema.Schema{Type: shim.TypeString, Optional: true}).Shim(),
"key256": (&schema.Schema{Type: shim.TypeString, Computed: true}).Shim(),
}),
}
}

out, err := ExtractInputsFromOutputs(nil, ruleSetProps, ruleSetSchema(), nil, false)
assert.NoError(t, err)
t.Logf("out: %v", out)
attachedDiskVal := out["attachedDisks"].ArrayValue()[0].ObjectValue()
_, ok := attachedDiskVal["key256"]
assert.False(t, ok)
}

func TestFailureReasonForMissingRequiredFields(t *testing.T) {
// Define two required inputs
tfProvider := makeTestTFProviderV1(
Expand Down Expand Up @@ -2742,7 +2782,6 @@ func TestExtractSchemaInputsNestedMaxItemsOne(t *testing.T) {
"listObjects": resource.NewProperty([]resource.PropertyValue{
resource.NewProperty(resource.PropertyMap{
"__defaults": resource.NewProperty([]resource.PropertyValue{}),
"field1": resource.NewProperty(false),
"listScalar": resource.NewProperty(1.0),
}),
}),
Expand Down Expand Up @@ -3665,7 +3704,6 @@ func TestExtractInputsFromOutputsSdkv2(t *testing.T) {
// },
// expected: autogold.Expect(),
// },
// TODO[pulumi/pulumi-terraform-bridge#2180]: This is wrong as an input should not be produced for computed values.
{
name: "list block with computed element not extracted",
props: resource.NewPropertyMapFromMap(map[string]interface{}{
Expand All @@ -3687,20 +3725,16 @@ func TestExtractInputsFromOutputsSdkv2(t *testing.T) {
V: []resource.PropertyValue{},
},
resource.PropertyKey("foo"): resource.PropertyValue{V: []resource.PropertyValue{{
V: resource.PropertyMap{
resource.PropertyKey("__defaults"): resource.PropertyValue{
V: []resource.PropertyValue{},
},
resource.PropertyKey("bar"): resource.PropertyValue{V: "baz"},
},
V: resource.PropertyMap{resource.PropertyKey("__defaults"): resource.PropertyValue{
V: []resource.PropertyValue{},
}},
}}},
}),
},
// TODO[pulumi/pulumi-terraform-bridge#2180]: This is wrong as an input should not be produced for computed values.
{
name: "list block max items one with computed element not extracted",
props: resource.NewPropertyMapFromMap(map[string]interface{}{
"foo": []interface{}{map[string]string{"bar": "baz"}},
"foo": map[string]string{"bar": "baz"},
}),
schemaMap: map[string]*schemav2.Schema{
"foo": {
Expand All @@ -3714,16 +3748,9 @@ func TestExtractInputsFromOutputsSdkv2(t *testing.T) {
},
},
},
expected: autogold.Expect(resource.PropertyMap{
resource.PropertyKey("__defaults"): resource.PropertyValue{
V: []resource.PropertyValue{},
},
resource.PropertyKey("foo"): resource.PropertyValue{V: []resource.PropertyValue{{
V: resource.PropertyMap{resource.PropertyKey("bar"): resource.PropertyValue{
V: "baz",
}},
}}},
}),
expected: autogold.Expect(resource.PropertyMap{resource.PropertyKey("__defaults"): resource.PropertyValue{
V: []resource.PropertyValue{},
}}),
},
}

Expand Down
1 change: 0 additions & 1 deletion pkg/tfshim/util/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func IsOfTypeMap(tfs shim.Schema) bool {

// CastToTypeObject performs a checked cast from shim.Schema to a TF object (a collection
// of fields).
//
// See [shim.Schema.Elem()] comment for all the details of the encoding.
func CastToTypeObject(tfs shim.Schema) (shim.SchemaMap, bool) {
if tfs == nil {
Expand Down