Skip to content

Commit

Permalink
Add deprecation warning for importing datadog_api_key resources. (#2543)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyjet authored Aug 29, 2024
1 parent e8613df commit cbaf1ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion datadog/fwprovider/resource_datadog_api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (r *apiKeyResource) Metadata(_ context.Context, request resource.MetadataRe

func (r *apiKeyResource) Schema(_ context.Context, _ resource.SchemaRequest, response *resource.SchemaResponse) {
response.Schema = schema.Schema{
Description: "Provides a Datadog API Key resource. This can be used to create and manage Datadog API Keys.",
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.",
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
Description: "Name for API Key.",
Expand Down Expand Up @@ -140,6 +140,10 @@ func (r *apiKeyResource) Delete(ctx context.Context, request resource.DeleteRequ
}

func (r *apiKeyResource) ImportState(ctx context.Context, request resource.ImportStateRequest, response *resource.ImportStateResponse) {
response.Diagnostics.AddWarning(
"Deprecated",
"The import functionality for datadog_api_key resources 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 the datadog_api_key resource to create and manage new API keys.",
)
resource.ImportStatePassthroughID(ctx, frameworkPath.Root("id"), request, response)
}

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/api_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "datadog_api_key Resource - terraform-provider-datadog"
subcategory: ""
description: |-
Provides a Datadog API Key resource. This can be used to create and manage Datadog API Keys.
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.
---

# datadog_api_key (Resource)

Provides a Datadog API Key resource. This can be used to create and manage Datadog API Keys.
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.

## Example Usage

Expand Down

0 comments on commit cbaf1ca

Please sign in to comment.