diff --git a/DEPRECATED_APIs.md b/DEPRECATED_APIs.md index c39b41d8ad275..78d21b8dab5f7 100644 --- a/DEPRECATED_APIs.md +++ b/DEPRECATED_APIs.md @@ -2,6 +2,7 @@ | Module | API Element | Message | |--------|-------------|---------| +| aws-cdk-lib/aws-route53 | RecordSetOptions.​deleteExisting | This property is dangerous and can lead to unintended record deletion in case of deployment failure.| | @aws-cdk/core | AppProps.​runtimeInfo | use `versionReporting` instead | | @aws-cdk/core | Arn.​parse() | use split instead | | @aws-cdk/core | ArnComponents.​sep | use arnFormat instead | diff --git a/packages/aws-cdk-lib/aws-route53/lib/record-set.ts b/packages/aws-cdk-lib/aws-route53/lib/record-set.ts index 568bc127d437a..315998792f51e 100644 --- a/packages/aws-cdk-lib/aws-route53/lib/record-set.ts +++ b/packages/aws-cdk-lib/aws-route53/lib/record-set.ts @@ -219,6 +219,7 @@ export interface RecordSetOptions { * > an existing Record Set's `deleteExisting` property from `false -> true` after deployment * > will delete the record! * + * @deprecated This property is dangerous and can lead to unintended record deletion in case of deployment failure. * @default false */ readonly deleteExisting?: boolean; @@ -419,6 +420,7 @@ export class RecordSet extends Resource implements IRecordSet { this.domainName = recordSet.ref; if (props.deleteExisting) { + Annotations.of(this).addWarningV2('@aws-cdk/aws-route53:deleteExisting', 'deleteExisting field is deprecated do not use it'); // Delete existing record before creating the new one const provider = DeleteExistingRecordSetProvider.getOrCreateProvider(this, DELETE_EXISTING_RECORD_SET_RESOURCE_TYPE, { policyStatements: [{ // IAM permissions for all providers