Clarifying the resource state persistence mechanism for custom Provider/Resource authors

This commit is contained in:
Travis Truman 2015-07-14 13:40:58 -04:00
parent eedcb40ee3
commit 4bf24d5f97
1 changed files with 5 additions and 1 deletions

View File

@ -142,7 +142,11 @@ The CRUD operations in more detail, along with their contracts:
* `Create` - This is called to create a new instance of the resource. * `Create` - This is called to create a new instance of the resource.
Terraform guarantees that an existing ID is not set on the resource Terraform guarantees that an existing ID is not set on the resource
data. That is, you're working with a new resource. data. That is, you're working with a new resource. Therefore, you are
responsible for calling `setId` on your `schema.ResourceData` using a
value suitable for your resource. This ensures whatever resource
state you set on `schema.ResourceData` will be persisted in local state.
If you neglect to `setId`, no resource state will be persisted.
* `Read` - This is called to resync the local state with the remote state. * `Read` - This is called to resync the local state with the remote state.
Terraform guarantees that an existing ID will be set. This ID should be Terraform guarantees that an existing ID will be set. This ID should be