Skip to content

Commit b8f0db5

Browse files
Add docs about input ID field (#3017)
This adds a section in the docs on fixing ID issues about this tfgen error: ``` error: Resource my_resource has a problem: an "id" input attribute is not allowed. To map this resource specify SchemaInfo.Name and ResourceInfo.ComputeID ``` It happens for PF resources with input ID fields.
1 parent fc6f3fb commit b8f0db5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/guides/resource-ids.md

+21
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,24 @@ Otherwise you can pass in any function that complies with:
8080
```go
8181
func(ctx context.Context, state resource.PropertyMap) (resource.ID, error)
8282
```
83+
84+
85+
### ID field is of input type
86+
87+
```
88+
error: Resource test_res has a problem: an "id" input attribute is not allowed. To map this resource specify SchemaInfo.Name and ResourceInfo.ComputeID
89+
```
90+
91+
If the resource has an `"id"` attribute but it is Optional or Required on the TF side, that makes it invalid for use in Pulumi. This can be worked around by renaming the field and specifying the `ResourceInfo.ComputeID` field for the resource:
92+
93+
```go
94+
"test_res": {
95+
Fields: map[string]*info.Schema{
96+
"id": {
97+
Name: "idProperty",
98+
},
99+
},
100+
ComputeID: tfbridge.DelegateIDField(resource.PropertyKey("idProperty"),
101+
"testprovider", "https://github.com/pulumi/pulumi-testprovider"),
102+
},
103+
```

0 commit comments

Comments
 (0)