Skip to content

Commit 080daac

Browse files
austinvalleSBGoods
andcommitted
Framework: Add documentation for actions in plugin framework (#848)
* small changes to existing pages * start with a one pager * final updates to action page * update validation page * update general schema pages * update attribute docs to be less specific about each schema * update block types to be less specific * updated type docs to be less specific * split into two pages * Apply suggestions from code review Co-authored-by: Selena Goods <[email protected]> --------- Co-authored-by: Selena Goods <[email protected]>
1 parent ad70668 commit 080daac

40 files changed

+489
-105
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,19 @@
306306
}
307307
]
308308
},
309+
{
310+
"title": "Actions",
311+
"routes": [
312+
{
313+
"title": "Overview",
314+
"path": "actions"
315+
},
316+
{
317+
"title": "Implementation",
318+
"path": "actions/implementation"
319+
}
320+
]
321+
},
309322
{
310323
"title": "Handling Data",
311324
"routes": [

content/terraform-plugin-framework/v1.16.x/docs/plugin/framework/actions/implementation.mdx

Lines changed: 356 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
page_title: Actions overview
3+
description: >-
4+
Actions allow providers to expose side-effects that interact with remote systems.
5+
Practitioners can use actions to express workflows that don't strictly fit into typical
6+
CRUD resource management. Learn how the plugin framework can help you implement actions.
7+
---
8+
9+
# Actions
10+
11+
<Highlight>
12+
13+
Action support is in technical preview and offered without compatibility promises until Terraform 1.14 is generally available.
14+
15+
</Highlight>
16+
17+
Actions are an abstraction that allow providers to expose side-effects that interact with remote systems. Practitioners
18+
can use actions to express workflows that don't strictly fit into typical [CRUD resource management](/terraform/plugin/framework/resources),
19+
such as disaster recovery or ad-hoc maintenance. Actions can be invoked directly with the Terraform CLI or with
20+
a trigger in a plan/apply workflow.
21+
22+
## Action types
23+
24+
Each action in a provider has a statically defined action type in the [schema](/terraform/plugin/framework/actions/implementation#schema-method), which informs Terraform how the action can be used
25+
by the practitioner and what effect the action can have on [resource state](/terraform/plugin/framework/handling-data/terraform-concepts#state).
26+
Currently, the only available action type is:
27+
28+
- [Unlinked](/terraform/plugin/framework/actions/implementation#unlinked-action) - An action type that cannot cause changes to state.
29+
30+
Action types that can modify resource state are not available in Terraform 1.14, but are planned for future releases.
31+
32+
## Implementation
33+
34+
Learn about how to [implement code](/terraform/plugin/framework/actions/implementation) for an action in the framework.

content/terraform-plugin-framework/v1.16.x/docs/plugin/framework/ephemeral-resources/index.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@ description: >-
88

99
# Ephemeral resources
1010

11-
<Highlight>
12-
13-
Ephemeral resource support is in technical preview and offered without compatibility promises until Terraform 1.10 is generally available.
14-
15-
</Highlight>
16-
17-
[Ephemeral resources](/terraform/language/v1.10.x/resources/ephemeral) are an abstraction that allows Terraform to reference external data. Unlike [data sources](/terraform/language/data-sources), Terraform guarantees that ephemeral resource data will not be persisted in plan or state artifacts. The data produced by an ephemeral resource can only be referenced in [specific ephemeral contexts](/terraform/language/v1.10.x/resources/ephemeral#referencing-ephemeral-resources) or Terraform will throw an error.
11+
[Ephemeral resources](/terraform/language/resources/ephemeral) are an abstraction that allows Terraform to reference external data. Unlike [data sources](/terraform/language/data-sources), Terraform guarantees that ephemeral resource data will not be persisted in plan or state artifacts. The data produced by an ephemeral resource can only be referenced in [specific ephemeral contexts](/terraform/language/resources/ephemeral#referencing-ephemeral-resources) or Terraform will throw an error. Ephemeral resources are supported in Terraform 1.10 and later.
1812

1913
This page describes the basic implementation details required for supporting an ephemeral resource within the provider. Ephemeral resources, as a part of their lifecycle, must implement:
2014

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ resource "examplecloud_thing" "example" {
1919

2020
## Schema Definition
2121

22-
Use one of the following attribute types to directly add a bool value to a [schema](/terraform/plugin/framework/handling-data/schemas) or [nested attribute type](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types):
22+
Boolean attributes are supported in all framework [schemas](/terraform/plugin/framework/handling-data/schemas) and [nested attribute types](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types).
23+
Each concept (provider, resource, data source, etc.) has a separate `BoolAttribute` which can be used to add a bool value to a schema. For example (non-exhaustive):
2324

2425
| Schema Type | Attribute Type |
2526
|-------------|----------------|
2627
| [Data Source](/terraform/plugin/framework/data-sources) | [`schema.BoolAttribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/datasource/schema#BoolAttribute) |
2728
| [Provider](/terraform/plugin/framework/providers) | [`schema.BoolAttribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/provider/schema#BoolAttribute) |
2829
| [Resource](/terraform/plugin/framework/resources) | [`schema.BoolAttribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource/schema#BoolAttribute) |
29-
| [Ephemeral Resource](/terraform/plugin/framework/ephemeral-resources) | [`schema.BoolAttribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/ephemeral/schema#BoolAttribute) |
3030

3131
In this example, a resource schema defines a top level required bool attribute named `example_attribute`:
3232

content/terraform-plugin-framework/v1.16.x/docs/plugin/framework/handling-data/attributes/dynamic.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ resource "examplecloud_thing" "example" {
4848

4949
## Schema Definition
5050

51-
Use one of the following attribute types to directly add a dynamic value to a [schema](/terraform/plugin/framework/handling-data/schemas) or a [single nested attribute type](/terraform/plugin/framework/handling-data/attributes/single-nested):
51+
Dynamic attributes are supported in most framework [schemas](/terraform/plugin/framework/handling-data/schemas) and the [single nested attribute type](/terraform/plugin/framework/handling-data/attributes/single-nested).
52+
Each concept (provider, resource, data source, etc.) has a separate `DynamicAttribute` which can be used to add a dynamic value to a schema. For example (non-exhaustive):
5253

5354
| Schema Type | Attribute Type |
5455
|-------------|----------------|
5556
| [Data Source](/terraform/plugin/framework/data-sources) | [`schema.DynamicAttribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/datasource/schema#DynamicAttribute) |
5657
| [Provider](/terraform/plugin/framework/providers) | [`schema.DynamicAttribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/provider/schema#DynamicAttribute) |
5758
| [Resource](/terraform/plugin/framework/resources) | [`schema.DynamicAttribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource/schema#DynamicAttribute) |
58-
| [Ephemeral Resource](/terraform/plugin/framework/ephemeral-resources) | [`schema.DynamicAttribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/ephemeral/schema#DynamicAttribute) |
5959

6060
In this example, a resource schema defines a top level required dynamic attribute named `example_attribute`:
6161

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ resource "examplecloud_thing" "example" {
2525

2626
## Schema Definition
2727

28-
Use one of the following attribute types to directly add a float32 value to a [schema](/terraform/plugin/framework/handling-data/schemas) or [nested attribute type](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types):
28+
Float32 attributes are supported in all framework [schemas](/terraform/plugin/framework/handling-data/schemas) and [nested attribute types](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types).
29+
Each concept (provider, resource, data source, etc.) has a separate `Float32Attribute` which can be used to add a float32 value to a schema. For example (non-exhaustive):
2930

3031
| Schema Type | Attribute Type |
3132
|-------------|----------------|
3233
| [Data Source](/terraform/plugin/framework/data-sources) | [`schema.Float32Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/datasource/schema#Float32Attribute) |
3334
| [Provider](/terraform/plugin/framework/providers) | [`schema.Float32Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/provider/schema#Float32Attribute) |
3435
| [Resource](/terraform/plugin/framework/resources) | [`schema.Float32Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource/schema#Float32Attribute) |
35-
| [Ephemeral Resource](/terraform/plugin/framework/ephemeral-resources) | [`schema.Float32Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/ephemeral/schema#Float32Attribute) |
3636

3737
In this example, a resource schema defines a top level required float32 attribute named `example_attribute`:
3838

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ resource "examplecloud_thing" "example" {
2525

2626
## Schema Definition
2727

28-
Use one of the following attribute types to directly add a float64 value to a [schema](/terraform/plugin/framework/handling-data/schemas) or [nested attribute type](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types):
28+
Float64 attributes are supported in all framework [schemas](/terraform/plugin/framework/handling-data/schemas) and [nested attribute types](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types).
29+
Each concept (provider, resource, data source, etc.) has a separate `Float64Attribute` which can be used to add a float64 value to a schema. For example (non-exhaustive):
2930

3031
| Schema Type | Attribute Type |
3132
|-------------|----------------|
3233
| [Data Source](/terraform/plugin/framework/data-sources) | [`schema.Float64Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/datasource/schema#Float64Attribute) |
3334
| [Provider](/terraform/plugin/framework/providers) | [`schema.Float64Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/provider/schema#Float64Attribute) |
3435
| [Resource](/terraform/plugin/framework/resources) | [`schema.Float64Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource/schema#Float64Attribute) |
35-
| [Ephemeral Resource](/terraform/plugin/framework/ephemeral-resources) | [`schema.Float64Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/ephemeral/schema#Float64Attribute) |
3636

3737
In this example, a resource schema defines a top level required float64 attribute named `example_attribute`:
3838

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ resource "examplecloud_thing" "example" {
2525

2626
## Schema Definition
2727

28-
Use one of the following attribute types to directly add a int32 value to a [schema](/terraform/plugin/framework/handling-data/schemas) or [nested attribute type](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types):
28+
Int32 attributes are supported in all framework [schemas](/terraform/plugin/framework/handling-data/schemas) and [nested attribute types](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types).
29+
Each concept (provider, resource, data source, etc.) has a separate `Int32Attribute` which can be used to add an int32 value to a schema. For example (non-exhaustive):
2930

3031
| Schema Type | Attribute Type |
3132
|-------------|----------------|
3233
| [Data Source](/terraform/plugin/framework/data-sources) | [`schema.Int32Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/datasource/schema#Int32Attribute) |
3334
| [Provider](/terraform/plugin/framework/providers) | [`schema.Int32Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/provider/schema#Int32Attribute) |
3435
| [Resource](/terraform/plugin/framework/resources) | [`schema.Int32Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource/schema#Int32Attribute) |
35-
| [Ephemeral Resource](/terraform/plugin/framework/ephemeral-resources) | [`schema.Int32Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/ephemeral/schema#Int32Attribute) |
3636

3737
In this example, a resource schema defines a top level required int32 attribute named `example_attribute`:
3838

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ resource "examplecloud_thing" "example" {
2525

2626
## Schema Definition
2727

28-
Use one of the following attribute types to directly add a int64 value to a [schema](/terraform/plugin/framework/handling-data/schemas) or [nested attribute type](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types):
28+
Int64 attributes are supported in all framework [schemas](/terraform/plugin/framework/handling-data/schemas) and [nested attribute types](/terraform/plugin/framework/handling-data/attributes#nested-attribute-types).
29+
Each concept (provider, resource, data source, etc.) has a separate `Int64Attribute` which can be used to add an int64 value to a schema. For example (non-exhaustive):
2930

3031
| Schema Type | Attribute Type |
3132
|-------------|----------------|
3233
| [Data Source](/terraform/plugin/framework/data-sources) | [`schema.Int64Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/datasource/schema#Int64Attribute) |
3334
| [Provider](/terraform/plugin/framework/providers) | [`schema.Int64Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/provider/schema#Int64Attribute) |
3435
| [Resource](/terraform/plugin/framework/resources) | [`schema.Int64Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/resource/schema#Int64Attribute) |
35-
| [Ephemeral Resource](/terraform/plugin/framework/ephemeral-resources) | [`schema.Int64Attribute`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-framework/ephemeral/schema#Int64Attribute) |
3636

3737
In this example, a resource schema defines a top level required int64 attribute named `example_attribute`:
3838

0 commit comments

Comments
 (0)