You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(api-key): add store_sensitive_state provider flag
Add provider-level control over sensitive data storage in state:
- New store_sensitive_state provider configuration (defaults true)
- API key resources respect flag to conditionally store key values
- When false, key field is set to null in state for security
- Updated documentation with ephemeral resource usage patterns
- Examples demonstrating secure ephemeral resource patterns
Enables users to prevent sensitive API keys from being stored
in Terraform state while maintaining resource functionality
through ephemeral resource access patterns.
Description: "Use this data source to retrieve information about an existing api key. Deprecated. This will be removed in a future release with prior notice. Securely store your API keys using a secret management system or use the datadog_api_key resource to manage API keys in your Datadog account.",
47
+
Description: "Use this data source to retrieve information about an existing API key. **Deprecated**: This will be removed in a future release with prior notice. For secure access to API key values without storing them in Terraform state, use the ephemeral `datadog_api_key` resource instead. See the ephemeral resource documentation for examples of secure API key access patterns.",
Description: "The value of the API Key. **Security Note**: This field exposes sensitive data in Terraform state. For secure access without state storage, use the ephemeral `datadog_api_key` resource instead.",
DeprecationMessage: "Deprecated. This will be removed in a future release with prior notice. Securely store your API keys using a secret management system or use the datadog_api_key resource to manage API keys in your Datadog account.",
71
+
DeprecationMessage: "This data source is deprecated and will be removed in a future release with prior notice. For secure access to API key values without storing them in Terraform state, use the ephemeral datadog_api_key resource instead.",
resp.Diagnostics.AddError("Deprecated", "The datadog_api_key data source is deprecated and will be removed in a future release. Securely store your API key using a secret management system or use the datadog_api_key resource to manage API keys in your Datadog account.")
171
+
resp.Diagnostics.AddError("Deprecated", "The datadog_api_key data source is deprecated and will be removed in a future release. For secure access to API key values without storing them in Terraform state, use the ephemeral datadog_api_key resource instead.")
Description: "The HTTP request maximum retry number. Defaults to 3.",
287
289
},
290
+
"store_sensitive_state": schema.StringAttribute{
291
+
Optional: true,
292
+
Description: "Whether to expose API key values in Terraform state. Valid values are [`true`, `false`]. Defaults to `true` for backwards compatibility. When false, API key resources will not include the key value, requiring the use of ephemeral datadog_api_key resources instead.",
Description: "Provides a Datadog API Key resource. This can be used to create and manage Datadog API Keys. Import functionality for this resource is deprecated and will be removed in a future release with prior notice. Securely store your API keys using a secret management system or use this resource to create and manage new API keys.",
54
+
Description: "Provides a Datadog API Key resource. This can be used to create and manage Datadog API Keys. Import functionality for this resource is deprecated and will be removed in a future release with prior notice. For enhanced security when `store_sensitive_state = false`, use the ephemeral `datadog_api_key` resource to access key values without storing them in state.",
53
55
Attributes: map[string]schema.Attribute{
54
56
"name": schema.StringAttribute{
55
57
Description: "Name for API Key.",
56
58
Required: true,
57
59
},
58
60
"key": schema.StringAttribute{
59
-
Description: "The value of the API Key.",
61
+
Description: "The value of the API Key. This field is only populated when the provider's `store_sensitive_state` is set to `true` (default). When `store_sensitive_state` is `false`, use the ephemeral `datadog_api_key` resource to access the key value without storing it in state.",
d=frameworkDiag.NewErrorDiagnostic("remote_config_read_enabled is true but Remote config is not enabled at org level", "Please either remove remote_config_read_enabled from the resource configuration or enable Remote config at org level")
Description: "Whether to expose API key values in Terraform state. Valid values are [`true`, `false`]. Defaults to `true` for backwards compatibility. When false, API key resources will not include the key value, requiring the use of ephemeral datadog_api_key resources instead.",
Retrieves an existing Datadog API key as an ephemeral resource. The API key value is retrieved securely and made available for use in other resources without being stored in state.
7
+
---
8
+
9
+
# datadog_api_key (Ephemeral Resource)
10
+
11
+
Retrieves an existing Datadog API key as an ephemeral resource. The API key value is retrieved securely and made available for use in other resources without being stored in state.
12
+
13
+
## Example Usage
14
+
15
+
```terraform
16
+
# Example: Using ephemeral resources for enhanced security
17
+
# Set store_sensitive_state = false in your provider configuration
18
+
19
+
terraform {
20
+
required_providers {
21
+
datadog = {
22
+
source = "DataDog/datadog"
23
+
}
24
+
}
25
+
}
26
+
27
+
provider "datadog" {
28
+
# Enhanced security: API key values won't be stored in state
29
+
store_sensitive_state = false
30
+
}
31
+
32
+
# Create the API key resource (key value won't be stored in state)
33
+
resource "datadog_api_key" "example" {
34
+
name = "Example API Key"
35
+
}
36
+
37
+
# Access the key value using ephemeral resource (not stored in state)
38
+
ephemeral "datadog_api_key" "example" {
39
+
id = datadog_api_key.example.id
40
+
}
41
+
42
+
# Use the ephemeral key value in other resources
43
+
resource "some_external_resource" "example" {
44
+
api_key = ephemeral.datadog_api_key.example.key
45
+
}
46
+
47
+
# Or store in locals for reuse
48
+
locals {
49
+
api_key = ephemeral.datadog_api_key.example.key
50
+
}
51
+
```
52
+
53
+
<!-- schema generated by tfplugindocs -->
54
+
## Schema
55
+
56
+
### Required
57
+
58
+
-`id` (String) The ID of the API key to retrieve.
59
+
60
+
### Read-Only
61
+
62
+
-`key` (String, Sensitive) The actual API key value (sensitive).
63
+
-`name` (String) The name of the API key.
64
+
-`remote_config_read_enabled` (Boolean) Whether remote configuration reads are enabled for this key.
Provides a Datadog API Key resource. This can be used to create and manage Datadog API Keys. Import functionality for this resource is deprecated and will be removed in a future release with prior notice. Securely store your API keys using a secret management system or use this resource to create and manage new API keys.
6
+
Provides a Datadog API Key resource. This can be used to create and manage Datadog API Keys. Import functionality for this resource is deprecated and will be removed in a future release with prior notice. For enhanced security when store_sensitive_state = false, use the ephemeral datadog_api_key resource to access key values without storing them in state.
7
7
---
8
8
9
9
# datadog_api_key (Resource)
10
10
11
-
Provides a Datadog API Key resource. This can be used to create and manage Datadog API Keys. Import functionality for this resource is deprecated and will be removed in a future release with prior notice. Securely store your API keys using a secret management system or use this resource to create and manage new API keys.
11
+
Provides a Datadog API Key resource. This can be used to create and manage Datadog API Keys. Import functionality for this resource is deprecated and will be removed in a future release with prior notice. For enhanced security when `store_sensitive_state = false`, use the ephemeral `datadog_api_key`resource to access key values without storing them in state.
-`key` (String, Sensitive) The value of the API Key.
36
+
-`key` (String, Sensitive) The value of the API Key. This field is only populated when the provider's `store_sensitive_state` is set to `true` (default). When `store_sensitive_state` is `false`, use the ephemeral `datadog_api_key` resource to access the key value without storing it in state.
0 commit comments