Skip to content

Commit 92b2e3a

Browse files
committed
Add ephemeral resource best practices
1 parent bf9b53b commit 92b2e3a

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

website/docs/plugin/best-practices/hashicorp-provider-design-principles.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,14 @@ The benefits of this practice include:
7979
- Ensuring Terraform can statically validate the entire configuration anywhere
8080
- Preventing practitioner issues should the environment change between Terraform commands
8181
- Preventing practitioner issues should networking or a service become unavailable
82+
83+
## Ephemeral Resources should represent a single sensitive API object
84+
85+
A Terraform ephemeral resource should be a declarative representation of a single sensitive API object, such as an API token or secret, which will be
86+
created and/or retrieved from the API during the Open operation.
87+
88+
The benefits of this practice include:
89+
90+
- Maximizing predictability and minimizing the blast radius of open/close operations
91+
- Enabling composition of related or dependent components in new and innovative ways
92+
- Preventing maintainer burden of managing multiple underlying components

website/docs/plugin/best-practices/sensitive-state.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ it's inevitable that [sensitive information will find its way into
1212
Terraform](/terraform/language/state/sensitive-data) in these circumstances. There are a
1313
couple of recommended approaches for managing sensitive state in Terraform.
1414

15+
## Using Ephemeral Resources
16+
17+
<Highlight>
18+
19+
Ephemeral resource support is only available in the [Terraform Plugin Framework](/terraform/plugin/framework)
20+
21+
</Highlight>
22+
23+
[Ephemeral resources](/terraform/language/v1.10.x/resources/ephemeral) allow Terraform to reference external data, while
24+
guaranteeing that this data will not be persisted in plan or state. When working with a sensitive API object such as an API token or secret,
25+
model that object using an ephemeral resource whenever possible.
26+
1527
## Using `Sensitive` Flag functionality
1628

1729
When working with a field that contains information likely to be considered

website/docs/plugin/framework-benefits.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,5 +256,6 @@ Additional new and improved features in the framework include:
256256
- **Validation Capabilities**: The framework exposes many more configuration validation integration points than the SDK. It is also extensible with provider-defined types that implement validation in the type itself.
257257
- **Functions**: The framework supports provider-defined functions which are exposed for practitioner configurations.
258258
- **Enhanced Import and Planning Capabilities**: The framework enables additional import and plan handling capabilities not available in SDKv2.
259+
- **Ephemeral Resources**: The framework supports ephemeral resources which do not store data in the Terraform plan or state artifacts.
259260

260261
Refer to [Framework Feature Comparison](/terraform/plugin/framework/migrating/benefits) for a continued list of features, details, and examples.

0 commit comments

Comments
 (0)