Skip to content

Commit d55e5d7

Browse files
austinvallerainkwanrkoron007
committed
Framework - Resource Identity Documentation (#361)
* add skeleton of thoughts on doc updates * Initial update to reflect the addition of resource identity.mdx * Second update of documentation to address some comments * Removing extra line * Update content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/resources/identity.mdx Co-authored-by: Rose M Koron <[email protected]> * adjust type pages * Apply suggestions from code review Co-authored-by: Rose M Koron <[email protected]> * remove stack + note callout * add to nav * update code examples and change name back * update identity docs * more identity updates * updates + todos * space * remove sections * last updates to identity docs --------- Co-authored-by: Rain <[email protected]> Co-authored-by: Rain Kwan <[email protected]> Co-authored-by: Rose M Koron <[email protected]>
1 parent db1eb2d commit d55e5d7

File tree

15 files changed

+499
-2
lines changed

15 files changed

+499
-2
lines changed

content/terraform-plugin-framework/v1.15.x/data/plugin-framework-nav-data.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
"title": "Delete",
6464
"path": "resources/delete"
6565
},
66+
{
67+
"title": "Identity",
68+
"path": "resources/identity"
69+
},
6670
{
6771
"title": "Configure Clients",
6872
"path": "resources/configure"
@@ -91,6 +95,10 @@
9195
"title": "Upgrade State",
9296
"path": "resources/state-upgrade"
9397
},
98+
{
99+
"title": "Upgrade Identity",
100+
"path": "resources/identity-upgrade"
101+
},
94102
{
95103
"title": "Manage Private State",
96104
"path": "resources/private-state"

content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/handling-data/attributes/bool.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ The acceptable behaviors of these configurability options are:
5959
- `Optional` and `Computed`: The value may be practitioner configured or the value may be set in provider logic when the practitioner configuration is null.
6060
- `Computed` only: The value will be set in provider logic and any practitioner configuration causes the framework to automatically raise an error diagnostic for the unexpected configuration value.
6161

62+
#### Resource Identity
63+
64+
If creating a resource identity schema, set either `OptionalForImport` or `RequiredForImport` to `true` to inform Terraform if practitioners must set the attribute when importing with that resource's identity.
65+
66+
The acceptable behaviors of these configurability options are:
67+
68+
- `RequiredForImport` only: A practitioner must configure the attribute to a known value (not `null`), otherwise Terraform automatically raises an error diagnostic for the missing value.
69+
- `OptionalForImport` only: A practitioner must configure the value to a known value or `null`.
70+
6271
### Custom Types
6372

6473
You may want to build your own attribute value and type implementations to allow your provider to combine validation, description, and plan customization behaviors into a reusable bundle. This helps avoid duplication or reimplementation and ensures consistency. These implementations use the `CustomType` field in the attribute type.

content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/handling-data/attributes/float32.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ The acceptable behaviors of these configurability options are:
6565
- `Optional` and `Computed`: The value may be practitioner configured or the value may be set in provider logic when the practitioner configuration is null.
6666
- `Computed` only: The value will be set in provider logic and any practitioner configuration causes the framework to automatically raise an error diagnostic for the unexpected configuration value.
6767

68+
#### Resource Identity
69+
70+
If creating a resource identity schema, set either `OptionalForImport` or `RequiredForImport` to `true` to inform Terraform if practitioners must set the attribute when importing with that resource's identity.
71+
72+
The acceptable behaviors of these configurability options are:
73+
74+
- `RequiredForImport` only: A practitioner must configure the attribute to a known value (not `null`), otherwise Terraform automatically raises an error diagnostic for the missing value.
75+
- `OptionalForImport` only: A practitioner must configure the value to a known value or `null`.
76+
6877
### Custom Types
6978

7079
You may want to build your own attribute value and type implementations to allow your provider to combine validation, description, and plan customization behaviors into a reusable bundle. This helps avoid duplication or reimplementation and ensures consistency. These implementations use the `CustomType` field in the attribute type.

content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/handling-data/attributes/float64.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ The acceptable behaviors of these configurability options are:
6565
- `Optional` and `Computed`: The value may be practitioner configured or the value may be set in provider logic when the practitioner configuration is null.
6666
- `Computed` only: The value will be set in provider logic and any practitioner configuration causes the framework to automatically raise an error diagnostic for the unexpected configuration value.
6767

68+
#### Resource Identity
69+
70+
If creating a resource identity schema, set either `OptionalForImport` or `RequiredForImport` to `true` to inform Terraform if practitioners must set the attribute when importing with that resource's identity.
71+
72+
The acceptable behaviors of these configurability options are:
73+
74+
- `RequiredForImport` only: A practitioner must configure the attribute to a known value (not `null`), otherwise Terraform automatically raises an error diagnostic for the missing value.
75+
- `OptionalForImport` only: A practitioner must configure the value to a known value or `null`.
76+
6877
### Custom Types
6978

7079
You may want to build your own attribute value and type implementations to allow your provider to combine validation, description, and plan customization behaviors into a reusable bundle. This helps avoid duplication or reimplementation and ensures consistency. These implementations use the `CustomType` field in the attribute type.

content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/handling-data/attributes/int32.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ The acceptable behaviors of these configurability options are:
6565
- `Optional` and `Computed`: The value may be practitioner configured or the value may be set in provider logic when the practitioner configuration is null.
6666
- `Computed` only: The value will be set in provider logic and any practitioner configuration causes the framework to automatically raise an error diagnostic for the unexpected configuration value.
6767

68+
#### Resource Identity
69+
70+
If creating a resource identity schema, set either `OptionalForImport` or `RequiredForImport` to `true` to inform Terraform if practitioners must set the attribute when importing with that resource's identity.
71+
72+
The acceptable behaviors of these configurability options are:
73+
74+
- `RequiredForImport` only: A practitioner must configure the attribute to a known value (not `null`), otherwise Terraform automatically raises an error diagnostic for the missing value.
75+
- `OptionalForImport` only: A practitioner must configure the value to a known value or `null`.
76+
6877
### Custom Types
6978

7079
You may want to build your own attribute value and type implementations to allow your provider to combine validation, description, and plan customization behaviors into a reusable bundle. This helps avoid duplication or reimplementation and ensures consistency. These implementations use the `CustomType` field in the attribute type.

content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/handling-data/attributes/int64.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ The acceptable behaviors of these configurability options are:
6565
- `Optional` and `Computed`: The value may be practitioner configured or the value may be set in provider logic when the practitioner configuration is null.
6666
- `Computed` only: The value will be set in provider logic and any practitioner configuration causes the framework to automatically raise an error diagnostic for the unexpected configuration value.
6767

68+
#### Resource Identity
69+
70+
If creating a resource identity schema, set either `OptionalForImport` or `RequiredForImport` to `true` to inform Terraform if practitioners must set the attribute when importing with that resource's identity.
71+
72+
The acceptable behaviors of these configurability options are:
73+
74+
- `RequiredForImport` only: A practitioner must configure the attribute to a known value (not `null`), otherwise Terraform automatically raises an error diagnostic for the missing value.
75+
- `OptionalForImport` only: A practitioner must configure the value to a known value or `null`.
76+
6877
### Custom Types
6978

7079
You may want to build your own attribute value and type implementations to allow your provider to combine validation, description, and plan customization behaviors into a reusable bundle. This helps avoid duplication or reimplementation and ensures consistency. These implementations use the `CustomType` field in the attribute type.

content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/handling-data/attributes/list.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ The acceptable behaviors of these configurability options are:
8282
- `Optional` and `Computed`: The value may be practitioner configured or the value may be set in provider logic when the practitioner configuration is null.
8383
- `Computed` only: The value will be set in provider logic and any practitioner configuration causes the framework to automatically raise an error diagnostic for the unexpected configuration value.
8484

85+
#### Resource Identity
86+
87+
If creating a resource identity schema, set either `OptionalForImport` or `RequiredForImport` to `true` to inform Terraform if practitioners must set the attribute when importing with that resource's identity.
88+
89+
The acceptable behaviors of these configurability options are:
90+
91+
- `RequiredForImport` only: A practitioner must configure the attribute to a known value (not `null`), otherwise Terraform automatically raises an error diagnostic for the missing value.
92+
- `OptionalForImport` only: A practitioner must configure the value to a known value or `null`.
93+
8594
### Custom Types
8695

8796
You may want to build your own attribute value and type implementations to allow your provider to combine validation, description, and plan customization behaviors into a reusable bundle. This helps avoid duplication or reimplementation and ensures consistency. These implementations use the `CustomType` field in the attribute type.

content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/handling-data/attributes/number.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ The acceptable behaviors of these configurability options are:
6565
- `Optional` and `Computed`: The value may be practitioner configured or the value may be set in provider logic when the practitioner configuration is null.
6666
- `Computed` only: The value will be set in provider logic and any practitioner configuration causes the framework to automatically raise an error diagnostic for the unexpected configuration value.
6767

68+
#### Resource Identity
69+
70+
If creating a resource identity schema, set either `OptionalForImport` or `RequiredForImport` to `true` to inform Terraform if practitioners must set the attribute when importing with that resource's identity.
71+
72+
The acceptable behaviors of these configurability options are:
73+
74+
- `RequiredForImport` only: A practitioner must configure the attribute to a known value (not `null`), otherwise Terraform automatically raises an error diagnostic for the missing value.
75+
- `OptionalForImport` only: A practitioner must configure the value to a known value or `null`.
76+
6877
### Custom Types
6978

7079
You may want to build your own attribute value and type implementations to allow your provider to combine validation, description, and plan customization behaviors into a reusable bundle. This helps avoid duplication or reimplementation and ensures consistency. These implementations use the `CustomType` field in the attribute type.

content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/handling-data/attributes/string.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ The acceptable behaviors of these configurability options are:
5858
- `Optional` and `Computed`: The value may be practitioner configured or the value may be set in provider logic when the practitioner configuration is null.
5959
- `Computed` only: The value will be set in provider logic and any practitioner configuration causes the framework to automatically raise an error diagnostic for the unexpected configuration value.
6060

61+
#### Resource Identity
62+
63+
If creating a resource identity schema, set either `OptionalForImport` or `RequiredForImport` to `true` to inform Terraform if practitioners must set the attribute when importing with that resource's identity.
64+
65+
The acceptable behaviors of these configurability options are:
66+
67+
- `RequiredForImport` only: A practitioner must configure the attribute to a known value (not `null`), otherwise Terraform automatically raises an error diagnostic for the missing value.
68+
- `OptionalForImport` only: A practitioner must configure the value to a known value or `null`.
69+
6170
### Custom Types
6271

6372
You may want to build your own attribute value and type implementations to allow your provider to combine validation, description, and plan customization behaviors into a reusable bundle. This helps avoid duplication or reimplementation and ensures consistency. These implementations use the `CustomType` field in the attribute type.

content/terraform-plugin-framework/v1.15.x/docs/plugin/framework/resources/create.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ func (r ThingResource) Create(ctx context.Context, req resource.CreateRequest, r
155155
}
156156
```
157157

158+
## Resource Identity
159+
160+
Managed resources that support identity also need to set the identity data during `Create`, see the ["Identity" page](/terraform/plugin/framework/resources/identity#writing-identity) for more information.
161+
158162
## Caveats
159163

160164
Note these caveats when implementing the `Create` method:

0 commit comments

Comments
 (0)