Repository: pulumi/pulumi-terraform-bridge
Pull request #405 (2021-10-28 22:47:31)

Fix broken link to AWS resources
The links under "Adapting a New Terraform Provider" section were broken. It looked like the directory under pulumi-aws repository was moved to another path. This change fix those links.


Patch:
diff --git a/README.md b/README.md
index ae2985e0..7c81c8b9 100644
--- a/README.md
+++ b/README.md
@@ -74,9 +74,9 @@ to types and concepts that the bridge will use to generate well-typed programmat
 
 The AWS provider provides a standard blueprint to follow for this.  There are three major elements:
 
-* [`cmd/pulumi-tfgen-aws/`](https://github.com/pulumi/pulumi-aws/tree/master/cmd/pulumi-tfgen-aws)
-* [`cmd/pulumi-resource-aws/`](https://github.com/pulumi/pulumi-aws/tree/master/cmd/pulumi-resource-aws)
-* [`resources.go`](https://github.com/pulumi/pulumi-aws/blob/master/resources.go)
+* [`cmd/pulumi-tfgen-aws/`](https://github.com/pulumi/pulumi-aws/tree/master/provider/cmd/pulumi-tfgen-aws)
+* [`cmd/pulumi-resource-aws/`](https://github.com/pulumi/pulumi-aws/tree/master/provider/cmd/pulumi-resource-aws)
+* [`resources.go`](https://github.com/pulumi/pulumi-aws/blob/master/provider/resources.go)
 
 The [`Makefile`](https://github.com/pulumi/pulumi-aws/blob/master/Makefile) compiles these programs, and notably, uses
 the resulting `pulumi-tfgen-aws` binary to generate code for many different languages.  The resulting generated code is
diff --git a/pkg/tfbridge/schema.go b/pkg/tfbridge/schema.go
index 1c58b9e1..7b553c1c 100644
--- a/pkg/tfbridge/schema.go
+++ b/pkg/tfbridge/schema.go
@@ -955,12 +955,12 @@ func CoerceTerraformString(schType shim.ValueType, ps *SchemaInfo, stringValue s
 	// breaking overrides where we have a string and a TransformJSONDocument (see pulumi/pulumi#4592)
 	if ps != nil && ps.Type != "" {
 		switch strings.ToLower(ps.Type.String()) {
-		case "boolean":
+		case "bool", "boolean":
 			if stringValue == "" {
 				return nil, nil
 			}
 			return convertTfStringToBool(stringValue)
-		case "int":
+		case "int", "integer":
 			return convertTfStringToInt(stringValue)
 		case "float":
 			return convertTfStringToFloat(stringValue)


Test patch:
diff --git a/pkg/tfbridge/schema_test.go b/pkg/tfbridge/schema_test.go
index 0cd0f953..396ee23d 100644
--- a/pkg/tfbridge/schema_test.go
+++ b/pkg/tfbridge/schema_test.go
@@ -937,21 +937,36 @@ func TestOverridingTFSchema(t *testing.T) {
 		shimv1.NewProvider(testTFProvider),
 		map[string]interface{}{
 			"pulumi_override_tf_string_to_boolean":    MyString("true"),
+			"pulumi_override_tf_string_to_bool":       MyString("true"),
 			"pulumi_empty_tf_override":                MyString("true"),
+			"pulumi_override_tf_string_to_int":        MyString("1"),
+			"pulumi_override_tf_string_to_integer":    MyString("1"),
 			"tf_empty_string_to_pulumi_bool_override": MyString(""),
 		},
 		shimv1.NewSchemaMap(map[string]*schemav1.Schema{
 			"pulumi_override_tf_string_to_boolean":    {Type: schemav1.TypeString},
+			"pulumi_override_tf_string_to_bool":       {Type: schemav1.TypeString},
 			"pulumi_empty_tf_override":                {Type: schemav1.TypeString},
+			"pulumi_override_tf_string_to_int":        {Type: schemav1.TypeString},
+			"pulumi_override_tf_string_to_integer":    {Type: schemav1.TypeString},
 			"tf_empty_string_to_pulumi_bool_override": {Type: schemav1.TypeString},
 		}),
 		map[string]*SchemaInfo{
 			"pulumi_override_tf_string_to_boolean": {
 				Type: "boolean",
 			},
+			"pulumi_override_tf_string_to_bool": {
+				Type: "bool",
+			},
 			"pulumi_empty_tf_override": {
 				Type: "",
 			},
+			"pulumi_override_tf_string_to_int": {
+				Type: "int",
+			},
+			"pulumi_override_tf_string_to_integer": {
+				Type: "integer",
+			},
 			"tf_empty_string_to_pulumi_bool_override": {
 				Type:           "boolean",
 				MarkAsOptional: boolPointer(true),
@@ -963,7 +978,10 @@ func TestOverridingTFSchema(t *testing.T) {
 	)
 	assert.Equal(t, resource.NewPropertyMapFromMap(map[string]interface{}{
 		"pulumiOverrideTfStringToBoolean":   true,
+		"pulumiOverrideTfStringToBool":      true,
 		"pulumiEmptyTfOverride":             "true",
+		"pulumiOverrideTfStringToInt":       1,
+		"pulumiOverrideTfStringToInteger":   1,
 		"tfEmptyStringToPulumiBoolOverride": nil,
 	}), result)
 }