Skip to content

Commit 910ad18

Browse files
use bridge functions in doc
1 parent 4e39b75 commit 910ad18

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/resource-ids.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,21 @@ If the type of the `"id"` attribute is not coercible to a string, you must set `
6060
error: Resource test_res has a problem: no "id" attribute. To map this resource consider specifying ResourceInfo.ComputeID
6161
```
6262

63-
If the resource simply doesn't have an `"id"` attribute, you will need to set `ResourceInfo.ComputeID`.
63+
If the resource simply doesn't have an `"id"` attribute, you will need to set `ResourceInfo.ComputeID`.
64+
If you want to delegate the ID field in Pulumi to another attribute, you should use `tfbridge.DelegateIDField` to produce a `ResourceInfo.ComputeID` compatible function.
6465

6566
```go
66-
"test_res": {ComputeID: computeIDField("id")}
67+
"test_res": {ComputeID: tfbridge.DelegateIDField("id", "testprovider", "https://github.com/pulumi/pulumi-testprovider")}
6768
```
6869

69-
Note that the computeIDField needs to be a valid property, i.e. if the mapped resource does not have a field called "id",
70+
Note that the delegated ID field needs to be a valid property, i.e. if the mapped resource does not have a field called "id",
7071
you may need to map this field to something else:
7172

7273
```go
73-
"test_res": {ComputeID: computeIDField("valid_key")}
74+
"test_res": {ComputeID: tfbridge.DelegateIDField("valid_key", "testprovider", "https://github.com/pulumi/pulumi-testprovider")}
7475
```
7576

76-
If you want to delegate the ID field in Pulumi to another attribute, you should use `tfbridge.DelegateIDField` to produce a `ResourceInfo.ComputeID` compatible function.
77+
7778
Otherwise you can pass in any function that complies with:
7879

7980
```go

0 commit comments

Comments
 (0)