From cbaf1ca34be2f055b04d47a9cb43c4a9f4b6a3dc Mon Sep 17 00:00:00 2001 From: Diner Date: Thu, 29 Aug 2024 14:29:12 -0400 Subject: [PATCH] Add deprecation warning for importing datadog_api_key resources. (#2543) --- datadog/fwprovider/resource_datadog_api_key.go | 6 +++++- docs/resources/api_key.md | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/datadog/fwprovider/resource_datadog_api_key.go b/datadog/fwprovider/resource_datadog_api_key.go index 3e497145f8..769c75123d 100644 --- a/datadog/fwprovider/resource_datadog_api_key.go +++ b/datadog/fwprovider/resource_datadog_api_key.go @@ -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.", @@ -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) } diff --git a/docs/resources/api_key.md b/docs/resources/api_key.md index eec4b03833..0043c4ff30 100644 --- a/docs/resources/api_key.md +++ b/docs/resources/api_key.md @@ -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