diff --git a/pkg/tfbridge/typechecker/typechecker.go b/pkg/tfbridge/typechecker/typechecker.go index c84cbb7a7..2f8b47d78 100644 --- a/pkg/tfbridge/typechecker/typechecker.go +++ b/pkg/tfbridge/typechecker/typechecker.go @@ -161,7 +161,16 @@ func (v *TypeChecker) validatePropertyValue( switch typeSpec.Type { case "boolean": - if !propertyValue.IsBool() { + // Check for strings that are values "true" or "false". + //TODO: Remove the boolString condition when https://github.com/pulumi/pulumi-terraform-bridge/issues/2520 + // is resolved. This is a workaround for the config encoding not honoring type overrides. + var boolString bool + if propertyValue.IsString() { + if propertyValue.StringValue() == "true" || propertyValue.StringValue() == "false" { + boolString = true + } + } + if !propertyValue.IsBool() && !boolString { return []Failure{newTypeFailure(propertyPath, typeSpec.Type, propertyValue)} } return nil diff --git a/pkg/tfbridge/typechecker/typechecker_test.go b/pkg/tfbridge/typechecker/typechecker_test.go index a8007a3ad..e2bfbff0f 100644 --- a/pkg/tfbridge/typechecker/typechecker_test.go +++ b/pkg/tfbridge/typechecker/typechecker_test.go @@ -1631,6 +1631,14 @@ func TestValidateConfigType(t *testing.T) { })), }), }, + { + //TODO: Remove this test when https://github.com/pulumi/pulumi-terraform-bridge/issues/2520 is resolved. + // This tests a workaround path to keep the type checker from tripping on missing functionality in the + // config encoding and will fail once that is fixed. + name: "allows_bool_strings", + inputName: "skipMetadataApiCheck", + input: resource.PropertyValue{V: "true"}, + }, } for _, tc := range testCases { tc := tc @@ -1661,6 +1669,11 @@ func TestValidateConfigType(t *testing.T) { }, }, }, + "skipMetadataApiCheck": { + TypeSpec: pschema.TypeSpec{ + Type: "boolean", + }, + }, }, }, }