Repository: pulumi/pulumi-cdk (ts)

Issue:
Manually mapped AWS resources should not reference metadata.json file
### What happened?

We lookup the `Ref` property name from the `aws-native-metadata.json` file. It is possible that a user manually maps a CCAPI resource to an AWS resource instead (or we map one that later becomes available in CCAPI). In these cases we should not lookup the `Ref` property name in the metadata because AWS resources do not have the same attributes as CCAPI.

### Example

See the example of `AWS::ApiGatewayV2::Integration` in this PR https://github.com/pulumi/pulumi-cdk/pull/261

### Output of `pulumi about`

n/a

### Additional context

_No response_

### Contributing

Vote on this issue by adding a 👍 reaction. 
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already). 


Pull request:
Do not use Ref metadata for AWS Provider resources
We use the `Ref` metadata to determine which attribute the `Ref` intrinsic should reference. This metadata is only valid for CCAPI resources though so we need to exclude any other resource type.

This PR checks the internal `__pulumiType` to determine if the resource is an `aws-native` resource. I chose to do it this way because we need to check the resource itself, we can't rely on any other information source. For example, the user could provide their own mapping function that maps some resources to `aws-native` and some resources to `aws`.

closes #262

Patch:
diff --git a/go.mod b/go.mod
index 36dedbd..bb1dd9b 100644
--- a/go.mod
+++ b/go.mod
@@ -9,14 +9,14 @@ require (
 	github.com/aws/aws-sdk-go-v2/service/sts v1.33.1
 	github.com/aws/smithy-go v1.22.1
 	github.com/gorilla/websocket v1.5.3
-	github.com/pulumi/pulumi/pkg/v3 v3.137.0
+	github.com/pulumi/pulumi/pkg/v3 v3.142.0
 	github.com/stretchr/testify v1.9.0
 )
 
 require (
 	cloud.google.com/go v0.112.1 // indirect
 	cloud.google.com/go/compute v1.25.0 // indirect
-	cloud.google.com/go/compute/metadata v0.2.3 // indirect
+	cloud.google.com/go/compute/metadata v0.5.0 // indirect
 	cloud.google.com/go/iam v1.1.6 // indirect
 	cloud.google.com/go/kms v1.15.7 // indirect
 	cloud.google.com/go/logging v1.9.0 // indirect
@@ -35,6 +35,7 @@ require (
 	github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
 	github.com/agext/levenshtein v1.2.3 // indirect
 	github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
+	github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
 	github.com/atotto/clipboard v0.1.4 // indirect
 	github.com/aws/aws-sdk-go v1.50.36 // indirect
 	github.com/aws/aws-sdk-go-v2 v1.32.5 // indirect
@@ -77,7 +78,7 @@ require (
 	github.com/gofrs/uuid v4.2.0+incompatible // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
 	github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
-	github.com/golang/glog v1.2.0 // indirect
+	github.com/golang/glog v1.2.2 // indirect
 	github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
 	github.com/golang/protobuf v1.5.4 // indirect
 	github.com/google/go-querystring v1.1.0 // indirect
@@ -97,7 +98,7 @@ require (
 	github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
 	github.com/hashicorp/go-sockaddr v1.0.6 // indirect
 	github.com/hashicorp/hcl v1.0.0 // indirect
-	github.com/hashicorp/hcl/v2 v2.17.0 // indirect
+	github.com/hashicorp/hcl/v2 v2.22.0 // indirect
 	github.com/hashicorp/vault/api v1.12.0 // indirect
 	github.com/inconshreveable/mousetrap v1.1.0 // indirect
 	github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@@ -133,7 +134,7 @@ require (
 	github.com/pmezard/go-difflib v1.0.0 // indirect
 	github.com/pulumi/appdash v0.0.0-20231130102222-75f619a67231 // indirect
 	github.com/pulumi/esc v0.10.0 // indirect
-	github.com/pulumi/pulumi/sdk/v3 v3.137.0 // indirect
+	github.com/pulumi/pulumi/sdk/v3 v3.142.0 // indirect
 	github.com/rivo/uniseg v0.4.4 // indirect
 	github.com/rogpeppe/go-internal v1.12.0 // indirect
 	github.com/ryanuber/go-glob v1.0.0 // indirect
@@ -162,25 +163,25 @@ require (
 	go.uber.org/atomic v1.9.0 // indirect
 	gocloud.dev v0.37.0 // indirect
 	gocloud.dev/secrets/hashivault v0.37.0 // indirect
-	golang.org/x/crypto v0.25.0 // indirect
+	golang.org/x/crypto v0.26.0 // indirect
 	golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect
 	golang.org/x/mod v0.18.0 // indirect
-	golang.org/x/net v0.27.0 // indirect
-	golang.org/x/oauth2 v0.18.0 // indirect
-	golang.org/x/sync v0.7.0 // indirect
-	golang.org/x/sys v0.22.0 // indirect
-	golang.org/x/term v0.22.0 // indirect
-	golang.org/x/text v0.16.0 // indirect
+	golang.org/x/net v0.28.0 // indirect
+	golang.org/x/oauth2 v0.22.0 // indirect
+	golang.org/x/sync v0.8.0 // indirect
+	golang.org/x/sys v0.24.0 // indirect
+	golang.org/x/term v0.23.0 // indirect
+	golang.org/x/text v0.17.0 // indirect
 	golang.org/x/time v0.5.0 // indirect
 	golang.org/x/tools v0.22.0 // indirect
 	golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
 	google.golang.org/api v0.169.0 // indirect
 	google.golang.org/appengine v1.6.8 // indirect
 	google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 // indirect
-	google.golang.org/genproto/googleapis/api v0.0.0-20240311173647-c811ad7063a7 // indirect
-	google.golang.org/genproto/googleapis/rpc v0.0.0-20240311173647-c811ad7063a7 // indirect
-	google.golang.org/grpc v1.63.2 // indirect
-	google.golang.org/protobuf v1.33.0 // indirect
+	google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
+	google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
+	google.golang.org/grpc v1.67.1 // indirect
+	google.golang.org/protobuf v1.35.1 // indirect
 	gopkg.in/warnings.v0 v0.1.2 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 	lukechampine.com/frand v1.4.2 // indirect
diff --git a/go.sum b/go.sum
index 13a8b37..9b06740 100644
--- a/go.sum
+++ b/go.sum
@@ -5,6 +5,8 @@ cloud.google.com/go/compute v1.25.0 h1:H1/4SqSUhjPFE7L5ddzHOfY2bCAvjwNRZPNl6Ni5o
 cloud.google.com/go/compute v1.25.0/go.mod h1:GR7F0ZPZH8EhChlMo9FkLd7eUTwEymjqQagxzilIxIE=
 cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
 cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
+cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY=
+cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY=
 cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc=
 cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI=
 cloud.google.com/go/kms v1.15.7 h1:7caV9K3yIxvlQPAcaFffhlT7d1qpxjB1wHBtjWa13SM=
@@ -47,6 +49,8 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFI
 github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
 github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
 github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
+github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
+github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
 github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
 github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
 github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
@@ -174,6 +178,8 @@ github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVI
 github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
 github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68=
 github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
+github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY=
+github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
 github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
 github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -252,6 +258,8 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
 github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
 github.com/hashicorp/hcl/v2 v2.17.0 h1:z1XvSUyXd1HP10U4lrLg5e0JMVz6CPaJvAgxM0KNZVY=
 github.com/hashicorp/hcl/v2 v2.17.0/go.mod h1:gJyW2PTShkJqQBKpAmPO3yxMxIuoXkOF2TpqXzrQyx4=
+github.com/hashicorp/hcl/v2 v2.22.0 h1:hkZ3nCtqeJsDhPRFz5EA9iwcG1hNWGePOTw6oyul12M=
+github.com/hashicorp/hcl/v2 v2.22.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA=
 github.com/hashicorp/vault/api v1.12.0 h1:meCpJSesvzQyao8FCOgk2fGdoADAnbDu2WPJN1lDLJ4=
 github.com/hashicorp/vault/api v1.12.0/go.mod h1:si+lJCYO7oGkIoNPAN8j3azBLTn9SjMGS+jFaHd1Cck=
 github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
@@ -348,8 +356,12 @@ github.com/pulumi/esc v0.10.0 h1:jzBKzkLVW0mePeanDRfqSQoCJ5yrkux0jIwAkUxpRKE=
 github.com/pulumi/esc v0.10.0/go.mod h1:2Bfa+FWj/xl8CKqRTWbWgDX0SOD4opdQgvYSURTGK2c=
 github.com/pulumi/pulumi/pkg/v3 v3.137.0 h1:/KPFQQaB5W0/GhVxSTGnEzv3ZW5uieGN5Q2q+Lsr+Zw=
 github.com/pulumi/pulumi/pkg/v3 v3.137.0/go.mod h1:ZQXJUTysDwq/mtilutRBKguH6DI+3b2WgNcOrs0whJ0=
+github.com/pulumi/pulumi/pkg/v3 v3.142.0 h1:UE8TFyXrlxvPrATpd3Kl3En34KrFIFWOxxNAodywPNU=
+github.com/pulumi/pulumi/pkg/v3 v3.142.0/go.mod h1:3k6WwRIT7veiDnk3Yo2NtqEYX+4dgLCrMIFvEOnjQqI=
 github.com/pulumi/pulumi/sdk/v3 v3.137.0 h1:bxhYpOY7Z4xt+VmezEpHuhjpOekkaMqOjzxFg/1OhCw=
 github.com/pulumi/pulumi/sdk/v3 v3.137.0/go.mod h1:PvKsX88co8XuwuPdzolMvew5lZV+4JmZfkeSjj7A6dI=
+github.com/pulumi/pulumi/sdk/v3 v3.142.0 h1:SmcVddGuvwAh3g3XUVQQ5gVRQUKH1yZ6iETpDNHIHlw=
+github.com/pulumi/pulumi/sdk/v3 v3.142.0/go.mod h1:PvKsX88co8XuwuPdzolMvew5lZV+4JmZfkeSjj7A6dI=
 github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
 github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
 github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
@@ -443,6 +455,8 @@ golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1m
 golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
 golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
 golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
+golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw=
+golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
 golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 h1:LoYXNGAShUG3m/ehNk4iFctuhGX/+R1ZpfJ4/ia80JM=
 golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
@@ -480,9 +494,13 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
 golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
 golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
 golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
+golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
+golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI=
 golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8=
+golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA=
+golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -494,6 +512,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
 golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
 golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
 golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
+golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
+golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
 golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -522,6 +542,8 @@ golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
 golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
+golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
@@ -533,6 +555,8 @@ golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
 golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
 golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
 golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
+golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
+golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -546,6 +570,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
 golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
 golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
 golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
+golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
+golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
 golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
 golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -583,8 +609,12 @@ google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 h1:ImUcDPHjTrAqNhl
 google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7/go.mod h1:/3XmxOjePkvmKrHuBy4zNFw7IzxJXtAgdpXi8Ll990U=
 google.golang.org/genproto/googleapis/api v0.0.0-20240311173647-c811ad7063a7 h1:oqta3O3AnlWbmIE3bFnWbu4bRxZjfbWCp0cKSuZh01E=
 google.golang.org/genproto/googleapis/api v0.0.0-20240311173647-c811ad7063a7/go.mod h1:VQW3tUculP/D4B+xVCo+VgSq8As6wA9ZjHl//pmk+6s=
+google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8=
+google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo=
 google.golang.org/genproto/googleapis/rpc v0.0.0-20240311173647-c811ad7063a7 h1:8EeVk1VKMD+GD/neyEHGmz7pFblqPjHoi+PGQIlLx2s=
 google.golang.org/genproto/googleapis/rpc v0.0.0-20240311173647-c811ad7063a7/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
 google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
 google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
 google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
@@ -592,6 +622,8 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
 google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
 google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
 google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
+google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
+google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
 google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
 google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
 google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -605,6 +637,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
 google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
 google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
+google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
+google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
diff --git a/package.json b/package.json
index e7cef65..8245e2a 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
     }
   },
   "resolutions": {
-    "@pulumi/pulumi": "3.136.0",
+    "@pulumi/pulumi": "3.142.0",
     "wrap-ansi": "7.0.0",
     "string-width": "4.1.0"
   },
@@ -31,7 +31,7 @@
     "@pulumi/aws-native": "^1.11.0",
     "@pulumi/docker": "^4.5.0",
     "@pulumi/docker-build": "^0.0.7",
-    "@pulumi/pulumi": "3.136.0",
+    "@pulumi/pulumi": "3.142.0",
     "@types/archiver": "^6.0.2",
     "@types/fs-extra": "^11.0.4",
     "@types/jest": "^29.5.2",
diff --git a/src/aws-resource-mappings.ts b/src/aws-resource-mappings.ts
index 35a10ee..c7f803b 100644
--- a/src/aws-resource-mappings.ts
+++ b/src/aws-resource-mappings.ts
@@ -13,7 +13,6 @@
 // limitations under the License.
 
 import * as pulumi from '@pulumi/pulumi';
-import { getAttributesFromResource } from './types';
 import * as aws from '@pulumi/aws';
 import { ResourceAttributeMappingArray, ResourceMapping, normalize } from './interop';
 
@@ -52,7 +51,7 @@ export function mapToAwsResource(
     switch (typeName) {
         // ApiGatewayV2
         case 'AWS::ApiGatewayV2::Integration': {
-            const resource = new aws.apigatewayv2.Integration(
+            return new aws.apigatewayv2.Integration(
                 logicalId,
                 {
                     ...props,
@@ -63,13 +62,6 @@ export function mapToAwsResource(
                 },
                 options,
             );
-            return {
-                resource,
-                attributes: {
-                    ...getAttributesFromResource(resource),
-                    id: resource.id,
-                },
-            };
         }
         case 'AWS::ApiGatewayV2::Stage':
             return new aws.apigatewayv2.Stage(
diff --git a/src/converters/intrinsics.ts b/src/converters/intrinsics.ts
index 68ddf87..f2ef073 100644
--- a/src/converters/intrinsics.ts
+++ b/src/converters/intrinsics.ts
@@ -394,6 +394,14 @@ function evaluateRef(ctx: IntrinsicContext, param: string): Result<any> {
             // Custom resources have a `physicalResourceId` that is used for Ref
             return ctx.succeed(map.resource.physicalResourceId);
         }
+
+        const pType = (<any>map.resource).__pulumiType;
+        if (!pType.startsWith('aws-native:')) {
+            // For non-aws-native resources (i.e. AWS Provider), fallback to using the id
+            // if this is incorrect users will have to provide a mapping with the correct id
+            const cr = <pulumi.CustomResource>map.resource; // assume we have a custom resource.
+            return ctx.succeed(cr.id);
+        }
         const resMeta = ctx.tryFindResource(map.resourceType);
 
         // If there is no metadata to suggest otherwise, assume that we can use the Pulumi id which typically will be
diff --git a/yarn.lock b/yarn.lock
index 23d89b3..80b260a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1050,9 +1050,9 @@
     "@pulumi/pulumi" "^3.136.0"
 
 "@pulumi/aws@^6.56.0":
-  version "6.60.0"
-  resolved "https://registry.yarnpkg.com/@pulumi/aws/-/aws-6.60.0.tgz#23944ecbd76b9847e6c018f76abc3e604471b27a"
-  integrity sha512-TUQngWDlRq41dyOhHwVdbLJuMqbxfS+BMJDznJUYb3ajr2KlSkMXFbO3d+jF7U9eTGP95+VfppRj2yQz/rSMrA==
+  version "6.61.0"
+  resolved "https://registry.yarnpkg.com/@pulumi/aws/-/aws-6.61.0.tgz#dd4f11d39a74e16c22507a581c1a92a98302e363"
+  integrity sha512-7ZqwEj6Zh3+bmB8OVCCin93qqlUeBGpp76YjiwghfMa3Q4hvpDsi1tEu7/+3QDPWxH/HRbp6AeHQ8UYw0HalTg==
   dependencies:
     "@pulumi/pulumi" "^3.136.0"
     builtin-modules "3.0.0"
@@ -1074,10 +1074,10 @@
     "@pulumi/pulumi" "^3.136.0"
     semver "^5.4.0"
 
-"@pulumi/pulumi@3.136.0", "@pulumi/pulumi@^3.136.0":
-  version "3.136.0"
-  resolved "https://registry.yarnpkg.com/@pulumi/pulumi/-/pulumi-3.136.0.tgz#52bf15335abadbd9a40b07a7ad7d745b7ba89650"
-  integrity sha512-8RWX7yoxxDXZxXhJyfKrKpetSuSJzIirW16vF4naKoqF0aUDYE+6gGUrFttEfikGxaEXie4YT1UFnwuCGbXhTw==
+"@pulumi/pulumi@3.142.0", "@pulumi/pulumi@^3.136.0":
+  version "3.142.0"
+  resolved "https://registry.yarnpkg.com/@pulumi/pulumi/-/pulumi-3.142.0.tgz#dd7bb330576f170365fa711f0b5f87394b964885"
+  integrity sha512-2RP4EDIDj4A980u/KThEUe5h5b0LcSaOqw9cA8Cxi3SiP+GC91zecJNbko4GOSR8kxsNd8EY327pVxt7fjTKhA==
   dependencies:
     "@grpc/grpc-js" "^1.10.1"
     "@logdna/tail-file" "^2.0.6"
@@ -1418,11 +1418,11 @@
     "@types/node" "*"
 
 "@types/node@*", "@types/node@>=13.7.0":
-  version "22.9.2"
-  resolved "https://registry.yarnpkg.com/@types/node/-/node-22.9.2.tgz#51e58f2bf29cc38f529dacbb0eafca890464138e"
-  integrity sha512-wwuxAVEbsRvDD9x7buvAl7DyQ7Oj+va/d/Veug7higYzp9MF0CINbfWTBgDFMpcVwcdUiYuNmX2KfnvY3N70mw==
+  version "22.10.0"
+  resolved "https://registry.yarnpkg.com/@types/node/-/node-22.10.0.tgz#89bfc9e82496b9c7edea3382583fa94f75896e81"
+  integrity sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==
   dependencies:
-    undici-types "~6.19.8"
+    undici-types "~6.20.0"
 
 "@types/node@^20.12.13":
   version "20.17.0"
@@ -5459,11 +5459,16 @@ uc.micro@^2.0.0, uc.micro@^2.1.0:
   resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee"
   integrity sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==
 
-undici-types@~6.19.2, undici-types@~6.19.8:
+undici-types@~6.19.2:
   version "6.19.8"
   resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
   integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==
 
+undici-types@~6.20.0:
+  version "6.20.0"
+  resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"
+  integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==
+
 unique-filename@^3.0.0:
   version "3.0.0"
   resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-3.0.0.tgz#48ba7a5a16849f5080d26c760c86cf5cf05770ea"


Test patch:
diff --git a/tests/converters/intrinsics.test.ts b/tests/converters/intrinsics.test.ts
index 6e71aac..e0b0be0 100644
--- a/tests/converters/intrinsics.test.ts
+++ b/tests/converters/intrinsics.test.ts
@@ -1,23 +1,25 @@
-import * as aws from '@pulumi/aws-native';
+import * as ccapi from '@pulumi/aws-native';
+import * as aws from '@pulumi/aws';
 import * as pulumi from '@pulumi/pulumi';
 import * as intrinsics from '../../src/converters/intrinsics';
 import {
     CloudFormationParameter,
     CloudFormationParameterLogicalId,
-    CloudFormationParameterWithId
+    CloudFormationParameterWithId,
 } from '../../src/cfn';
 import { Mapping } from '../../src/types';
 import { PulumiResource } from '../../src/pulumi-metadata';
+import { OutputRepr } from '../../src/output-map';
 
 describe('Fn::If', () => {
     test('picks true', async () => {
-        const tc = new TestContext({conditions: {'MyCondition': true}});
+        const tc = new TestContext({ conditions: { MyCondition: true } });
         const result = runIntrinsic(intrinsics.fnIf, tc, ['MyCondition', 'yes', 'no']);
         expect(result).toEqual(ok('yes'));
     });
 
     test('picks false', async () => {
-        const tc = new TestContext({conditions: {'MyCondition': false}});
+        const tc = new TestContext({ conditions: { MyCondition: false } });
         const result = runIntrinsic(intrinsics.fnIf, tc, ['MyCondition', 'yes', 'no']);
         expect(result).toEqual(ok('no'));
     });
@@ -29,7 +31,7 @@ describe('Fn::If', () => {
     });
 
     test('errors if condition evaluates to a non-boolean', async () => {
-        const tc = new TestContext({conditions: {'MyCondition': 'OOPS'}});
+        const tc = new TestContext({ conditions: { MyCondition: 'OOPS' } });
         const result = runIntrinsic(intrinsics.fnIf, tc, ['MyCondition', 'yes', 'no']);
         expect(result).toEqual(failed(`Expected a boolean, got string`));
     });
@@ -49,14 +51,14 @@ describe('Fn::Or', () => {
     });
 
     test('picks true from inner Condition', async () => {
-        const tc = new TestContext({conditions: {'MyCondition': true}});
-        const result = runIntrinsic(intrinsics.fnOr, tc, [false, {'Condition': 'MyCondition'}]);
+        const tc = new TestContext({ conditions: { MyCondition: true } });
+        const result = runIntrinsic(intrinsics.fnOr, tc, [false, { Condition: 'MyCondition' }]);
         expect(result).toEqual(ok(true));
     });
 
     test('picks false with inner Condition', async () => {
-        const tc = new TestContext({conditions: {'MyCondition': false}});
-        const result = runIntrinsic(intrinsics.fnOr, tc, [false, {'Condition': 'MyCondition'}]);
+        const tc = new TestContext({ conditions: { MyCondition: false } });
+        const result = runIntrinsic(intrinsics.fnOr, tc, [false, { Condition: 'MyCondition' }]);
         expect(result).toEqual(ok(false));
     });
 
@@ -68,10 +70,10 @@ describe('Fn::Or', () => {
 
     test('short-cirtcuits evaluation if true is found', async () => {
         const tc = new TestContext({});
-        const result = runIntrinsic(intrinsics.fnOr, tc, [true, {'Condition': 'DoesNotExist'}]);
+        const result = runIntrinsic(intrinsics.fnOr, tc, [true, { Condition: 'DoesNotExist' }]);
         expect(result).toEqual(ok(true));
     });
-})
+});
 
 describe('Fn::And', () => {
     test('picks true', async () => {
@@ -87,14 +89,14 @@ describe('Fn::And', () => {
     });
 
     test('picks true from inner Condition', async () => {
-        const tc = new TestContext({conditions: {'MyCondition': true}});
-        const result = runIntrinsic(intrinsics.fnAnd, tc, [true, {'Condition': 'MyCondition'}]);
+        const tc = new TestContext({ conditions: { MyCondition: true } });
+        const result = runIntrinsic(intrinsics.fnAnd, tc, [true, { Condition: 'MyCondition' }]);
         expect(result).toEqual(ok(true));
     });
 
     test('picks false with inner Condition', async () => {
-        const tc = new TestContext({conditions: {'MyCondition': false}});
-        const result = runIntrinsic(intrinsics.fnAnd, tc, [true, {'Condition': 'MyCondition'}]);
+        const tc = new TestContext({ conditions: { MyCondition: false } });
+        const result = runIntrinsic(intrinsics.fnAnd, tc, [true, { Condition: 'MyCondition' }]);
         expect(result).toEqual(ok(false));
     });
 
@@ -106,10 +108,10 @@ describe('Fn::And', () => {
 
     test('short-cirtcuits evaluation if false is found', async () => {
         const tc = new TestContext({});
-        const result = runIntrinsic(intrinsics.fnAnd, tc, [false, {'Condition': 'DoesNotExist'}]);
+        const result = runIntrinsic(intrinsics.fnAnd, tc, [false, { Condition: 'DoesNotExist' }]);
         expect(result).toEqual(ok(false));
     });
-})
+});
 
 describe('Fn::Not', () => {
     test('inverts false', async () => {
@@ -125,14 +127,14 @@ describe('Fn::Not', () => {
     });
 
     test('inverts a false Condition', async () => {
-        const tc = new TestContext({conditions: {'MyCondition': false}});
-        const result = runIntrinsic(intrinsics.fnNot, tc, [{'Condition': 'MyCondition'}]);
+        const tc = new TestContext({ conditions: { MyCondition: false } });
+        const result = runIntrinsic(intrinsics.fnNot, tc, [{ Condition: 'MyCondition' }]);
         expect(result).toEqual(ok(true));
     });
 
     test('inverts a true Condition', async () => {
-        const tc = new TestContext({conditions: {'MyCondition': true}});
-        const result = runIntrinsic(intrinsics.fnNot, tc, [{'Condition': 'MyCondition'}]);
+        const tc = new TestContext({ conditions: { MyCondition: true } });
+        const result = runIntrinsic(intrinsics.fnNot, tc, [{ Condition: 'MyCondition' }]);
         expect(result).toEqual(ok(false));
     });
 
@@ -141,7 +143,7 @@ describe('Fn::Not', () => {
         const result = runIntrinsic(intrinsics.fnNot, tc, ['ok']);
         expect(result).toEqual(failed(`Expected a boolean, got string`));
     });
-})
+});
 
 describe('Fn::Equals', () => {
     test('detects equal strings', async () => {
@@ -158,13 +160,13 @@ describe('Fn::Equals', () => {
 
     test('detects equal objects', async () => {
         const tc = new TestContext({});
-        const result = runIntrinsic(intrinsics.fnEquals, tc, [{x: 'a'}, {'x': 'a'}]);
+        const result = runIntrinsic(intrinsics.fnEquals, tc, [{ x: 'a' }, { x: 'a' }]);
         expect(result).toEqual(ok(true));
     });
 
     test('detects unequal objects', async () => {
         const tc = new TestContext({});
-        const result = runIntrinsic(intrinsics.fnEquals, tc, [{x: 'a'}, {'x': 'b'}]);
+        const result = runIntrinsic(intrinsics.fnEquals, tc, [{ x: 'a' }, { x: 'b' }]);
         expect(result).toEqual(ok(false));
     });
 
@@ -173,41 +175,47 @@ describe('Fn::Equals', () => {
         const result = runIntrinsic(intrinsics.fnEquals, tc, [1]);
         expect(result).toEqual(failed(`Fn::Equals expects exactly 2 params, got 1`));
     });
-})
+});
 
 describe('Ref', () => {
     test('resolves a parameter by its logical ID', async () => {
-        const tc = new TestContext({parameters: {
-            'MyParam': {id: 'MyParam', Type: 'String', Default: 'MyParamValue'}
-        }});
+        const tc = new TestContext({
+            parameters: {
+                MyParam: { id: 'MyParam', Type: 'String', Default: 'MyParamValue' },
+            },
+        });
         const result = runIntrinsic(intrinsics.ref, tc, ['MyParam']);
         expect(result).toEqual(ok('MyParamValue'));
     });
 
     test('respects "id" resource mapping provided by the user', async () => {
-        const tc = new TestContext({resources: {
-            'MyRes': {
-                resource: <any>{},
-                resourceType: 'AWS::S3::Bucket',
-                attributes: {
-                    'id': 'myID'
+        const tc = new TestContext({
+            resources: {
+                MyRes: {
+                    resource: <any>{},
+                    resourceType: 'AWS::S3::Bucket',
+                    attributes: {
+                        id: 'myID',
+                    },
                 },
             },
-        }});
+        });
         const result = runIntrinsic(intrinsics.ref, tc, ['MyRes']);
         expect(result).toEqual(ok('myID'));
     });
 
     test('resolves a CustomResource to its physical ID', async () => {
-        const tc = new TestContext({resources: {
-            'MyRes': {
-                resource: <any>{
-                    __pulumiType: (<any>aws.cloudformation.CustomResourceEmulator).__pulumiType,
-                    physicalResourceId: 'physicalID',
+        const tc = new TestContext({
+            resources: {
+                MyRes: {
+                    resource: <any>{
+                        __pulumiType: (<any>ccapi.cloudformation.CustomResourceEmulator).__pulumiType,
+                        physicalResourceId: 'physicalID',
+                    },
+                    resourceType: 'AWS::CloudFormation::CustomResource',
                 },
-                resourceType: 'AWS::CloudFormation::CustomResource',
             },
-        }});
+        });
         const result = runIntrinsic(intrinsics.ref, tc, ['MyRes']);
         expect(result).toEqual(ok('physicalID'));
     });
@@ -215,8 +223,10 @@ describe('Ref', () => {
     test('fails if Pulumi metadata indicates Ref is not supported', async () => {
         const tc = new TestContext({
             resources: {
-                'MyRes': {
-                    resource: <any>{},
+                MyRes: {
+                    resource: <any>{
+                        __pulumiType: (<any>ccapi.s3.Bucket).__pulumiType,
+                    },
                     resourceType: 'AWS::S3::Bucket',
                 },
             },
@@ -226,9 +236,9 @@ describe('Ref', () => {
                     outputs: {},
                     cfRef: {
                         notSupported: true,
-                    }
+                    },
                 },
-            }
+            },
         });
         const result = runIntrinsic(intrinsics.ref, tc, ['MyRes']);
         expect(result).toEqual(failed('Ref intrinsic is not supported for the AWS::S3::Bucket resource type'));
@@ -237,8 +247,11 @@ describe('Ref', () => {
     test('resolves to a property value indicated by Pulumi metadata', async () => {
         const tc = new TestContext({
             resources: {
-                'MyRes': {
-                    resource: <any>{stageName: 'my-stage'},
+                MyRes: {
+                    resource: <any>{
+                        stageName: 'my-stage',
+                        __pulumiType: (<any>ccapi.apigateway.Stage).__pulumiType,
+                    },
                     resourceType: 'AWS::ApiGateway::Stage',
                 },
             },
@@ -248,9 +261,34 @@ describe('Ref', () => {
                     outputs: {},
                     cfRef: {
                         property: 'StageName',
-                    }
+                    },
                 },
-            }
+            },
+        });
+        const result = runIntrinsic(intrinsics.ref, tc, ['MyRes']);
+        expect(result).toEqual(ok('my-stage'));
+    });
+
+    test('does not use Pulumi metadata for AWS provider resource', async () => {
+        const tc = new TestContext({
+            resources: {
+                MyRes: {
+                    resource: <any>{
+                        id: 'my-stage',
+                        __pulumiType: (<any>aws.apigateway.Stage).__pulumiType,
+                    },
+                    resourceType: 'AWS::ApiGateway::Stage',
+                },
+            },
+            pulumiMetadata: {
+                'AWS::ApiGateway::Stage': {
+                    inputs: {},
+                    outputs: {},
+                    cfRef: {
+                        property: 'StageName',
+                    },
+                },
+            },
         });
         const result = runIntrinsic(intrinsics.ref, tc, ['MyRes']);
         expect(result).toEqual(ok('my-stage'));
@@ -259,8 +297,12 @@ describe('Ref', () => {
     test('resolves to a join of several property values indicated by Pulumi metadata', async () => {
         const tc = new TestContext({
             resources: {
-                'MyRes': {
-                    resource: <any>{roleName: 'my-role', policyName: 'my-policy'},
+                MyRes: {
+                    resource: <any>{
+                        roleName: 'my-role',
+                        policyName: 'my-policy',
+                        __pulumiType: (<any>ccapi.iam.RolePolicy).__pulumiType,
+                    },
                     resourceType: 'AWS::IAM::RolePolicy',
                 },
             },
@@ -271,9 +313,9 @@ describe('Ref', () => {
                     cfRef: {
                         properties: ['PolicyName', 'RoleName'],
                         delimiter: '|',
-                    }
+                    },
                 },
-            }
+            },
         });
         const result = runIntrinsic(intrinsics.ref, tc, ['MyRes']);
         expect(result).toEqual(ok('my-policy|my-role'));
@@ -282,19 +324,21 @@ describe('Ref', () => {
     test('fails if called with an ID that does not resolve', async () => {
         const tc = new TestContext({});
         const result = runIntrinsic(intrinsics.ref, tc, ['MyParam']);
-        expect(result).toEqual(failed('Ref intrinsic unable to resolve MyParam: not a known logical resource or parameter reference'));
+        expect(result).toEqual(
+            failed('Ref intrinsic unable to resolve MyParam: not a known logical resource or parameter reference'),
+        );
     });
 
     test('evaluates inner expressions before resolving', async () => {
         const tc = new TestContext({
             parameters: {
-                'MyParam': {id: 'MyParam', Type: 'String', Default: 'MyParamValue'}
+                MyParam: { id: 'MyParam', Type: 'String', Default: 'MyParamValue' },
             },
             conditions: {
-                'MyCondition': true,
+                MyCondition: true,
             },
         });
-        const result = runIntrinsic(intrinsics.ref, tc, [{'Fn::If': ['MyCondition', 'MyParam', 'MyParam2']}]);
+        const result = runIntrinsic(intrinsics.ref, tc, [{ 'Fn::If': ['MyCondition', 'MyParam', 'MyParam2'] }]);
         expect(result).toEqual(ok('MyParamValue'));
     });
 
@@ -302,10 +346,10 @@ describe('Ref', () => {
         const stackNodeId = 'stackNodeId';
         const tc = new TestContext({
             parameters: {
-                'MyParam': {id: 'MyParam', Type: 'String', Default: 'MyParamValue'}
+                MyParam: { id: 'MyParam', Type: 'String', Default: 'MyParamValue' },
             },
             conditions: {
-                'MyCondition': true,
+                MyCondition: true,
             },
             accountId: '012345678901',
             region: 'us-west-2',
@@ -320,30 +364,29 @@ describe('Ref', () => {
         expect(runIntrinsic(intrinsics.ref, tc, ['AWS::URLSuffix'])).toEqual(ok('amazonaws.com.cn'));
         expect(runIntrinsic(intrinsics.ref, tc, ['AWS::NoValue'])).toEqual(ok(undefined));
 
-        expect(runIntrinsic(intrinsics.ref, tc, ['AWS::NotificationARNs']))
-            .toEqual(failed('AWS::NotificationARNs pseudo-parameter is not yet supported in pulumi-cdk'));
+        expect(runIntrinsic(intrinsics.ref, tc, ['AWS::NotificationARNs'])).toEqual(
+            failed('AWS::NotificationARNs pseudo-parameter is not yet supported in pulumi-cdk'),
+        );
 
         // These are approximations; testing the current behavior for completeness sake.
         expect(runIntrinsic(intrinsics.ref, tc, ['AWS::StackId'])).toEqual(ok(stackNodeId));
         expect(runIntrinsic(intrinsics.ref, tc, ['AWS::StackName'])).toEqual(ok(stackNodeId));
     });
-})
+});
 
 function runIntrinsic(fn: intrinsics.Intrinsic, tc: TestContext, args: intrinsics.Expression[]): TestResult<any> {
-    const result: TestResult<any> = <any>(fn.evaluate(tc, args));
+    const result: TestResult<any> = <any>fn.evaluate(tc, args);
     return result;
-};
+}
 
-type TestResult<T> =
-    | {'ok': true, value: T}
-    | {'ok': false, errorMessage: string};
+type TestResult<T> = { ok: true; value: T } | { ok: false; errorMessage: string };
 
 function ok<T>(result: T): TestResult<T> {
-    return {'ok': true, value: result};
+    return { ok: true, value: result };
 }
 
 function failed<T>(errorMessage: string): TestResult<T> {
-    return {'ok': false, errorMessage: errorMessage};
+    return { ok: false, errorMessage: errorMessage };
 }
 
 class TestContext implements intrinsics.IntrinsicContext {
@@ -363,10 +406,10 @@ class TestContext implements intrinsics.IntrinsicContext {
         partition?: string;
         urlSuffix?: string;
         stackNodeId?: string;
-        conditions?: { [id: string]: intrinsics.Expression },
-        parameters?: { [id: CloudFormationParameterLogicalId]: CloudFormationParameterWithId },
-        resources?: { [id: string]: Mapping<pulumi.Resource> },
-        pulumiMetadata?: { [cfnType: string]: PulumiResource },
+        conditions?: { [id: string]: intrinsics.Expression };
+        parameters?: { [id: CloudFormationParameterLogicalId]: CloudFormationParameterWithId };
+        resources?: { [id: string]: Mapping<pulumi.Resource> };
+        pulumiMetadata?: { [cfnType: string]: PulumiResource };
     }) {
         this.stackNodeId = args.stackNodeId || '';
         this.accountId = args.accountId || '';
@@ -379,14 +422,18 @@ class TestContext implements intrinsics.IntrinsicContext {
         this.pulumiMetadata = args.pulumiMetadata || {};
     }
 
-    tryFindResource(cfnType: string): PulumiResource|undefined {
-        if (this.pulumiMetadata.hasOwnProperty(cfnType)) {
+    resolveOutput(repr: OutputRepr): pulumi.Output<any> {
+        throw new Error('Method not implemented.');
+    }
+
+    tryFindResource(cfnType: string): PulumiResource | undefined {
+        if (cfnType in this.pulumiMetadata) {
             return this.pulumiMetadata[cfnType];
         }
-    };
+    }
 
     findParameter(parameterLogicalID: string): CloudFormationParameterWithId | undefined {
-        if (this.parameters.hasOwnProperty(parameterLogicalID)) {
+        if (parameterLogicalID in this.parameters) {
             return this.parameters[parameterLogicalID];
         }
     }
@@ -396,37 +443,39 @@ class TestContext implements intrinsics.IntrinsicContext {
         return this.succeed(param.Default!);
     }
 
-    findCondition(conditionName: string): intrinsics.Expression|undefined {
-        if (this.conditions.hasOwnProperty(conditionName)) {
+    findCondition(conditionName: string): intrinsics.Expression | undefined {
+        if (conditionName in this.conditions) {
             return this.conditions[conditionName];
         }
     }
 
     findResourceMapping(resourceLogicalID: string): Mapping<pulumi.Resource> | undefined {
-        if (this.resources.hasOwnProperty(resourceLogicalID)) {
+        if (resourceLogicalID in this.resources) {
             return this.resources[resourceLogicalID];
         }
     }
 
     evaluate(expression: intrinsics.Expression): intrinsics.Result<any> {
         // Evaluate known heuristics.
-        const known = [intrinsics.fnAnd,
-                       intrinsics.fnEquals,
-                       intrinsics.fnIf,
-                       intrinsics.fnNot,
-                       intrinsics.fnOr,
-                       intrinsics.ref];
+        const known = [
+            intrinsics.fnAnd,
+            intrinsics.fnEquals,
+            intrinsics.fnIf,
+            intrinsics.fnNot,
+            intrinsics.fnOr,
+            intrinsics.ref,
+        ];
         if (typeof expression === 'object' && Object.keys(expression).length == 1) {
             for (const k of known) {
                 if (k.name === Object.keys(expression)[0]) {
                     const args = expression[k.name];
-                    return k.evaluate(this, args)
+                    return k.evaluate(this, args);
                 }
             }
         }
 
         // Self-evaluate the expression. This is very incomplete.
-        const result: TestResult<any> = {'ok': true, value: expression};
+        const result: TestResult<any> = { ok: true, value: expression };
         return result;
     }
 
@@ -435,17 +484,17 @@ class TestContext implements intrinsics.IntrinsicContext {
         if (t.ok) {
             return fn(t.value);
         } else {
-            return {'ok': false, errorMessage: t.errorMessage};
+            return { ok: false, errorMessage: t.errorMessage };
         }
     }
 
     fail(msg: string): intrinsics.Result<any> {
-        const result: TestResult<any> = {'ok': false, errorMessage: msg};
+        const result: TestResult<any> = { ok: false, errorMessage: msg };
         return result;
     }
 
     succeed<T>(r: T): intrinsics.Result<T> {
-        const result: TestResult<any> = {'ok': true, value: r};
+        const result: TestResult<any> = { ok: true, value: r };
         return result;
     }