diff --git a/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/cluster.ts b/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/cluster.ts index 5a268236228af..7dd119d96c20e 100644 --- a/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/cluster.ts +++ b/packages/@aws-cdk/custom-resource-handlers/lib/aws-eks/cluster-resource-handler/cluster.ts @@ -138,18 +138,22 @@ export class ClusterResourceHandler extends ResourceHandler { if (this.newProps.tags) { //Update tags const tagsToAdd = getTagsToUpdate(this.oldProps.tags, this.newProps.tags); - const tagConfig: EKS.TagResourceCommandInput = { - resourceArn: cluster?.arn, - tags: tagsToAdd, - }; - await this.eks.tagResource(tagConfig); + if (tagsToAdd) { + const tagConfig: EKS.TagResourceCommandInput = { + resourceArn: cluster?.arn, + tags: tagsToAdd, + }; + await this.eks.tagResource(tagConfig); + } //Remove tags const tagsToRemove = getTagsToRemove(this.oldProps.tags, this.newProps.tags); - const unTagConfig: EKS.UntagResourceCommandInput = { - resourceArn: cluster?.arn, - tagKeys: tagsToRemove, - }; - await this.eks.untagResource(unTagConfig); + if (tagsToRemove.length > 0 ) { + const config: EKS.UntagResourceCommandInput = { + resourceArn: cluster?.arn, + tagKeys: tagsToRemove, + }; + await this.eks.untagResource(config); + } } else { //Remove all tags const config: EKS.UntagResourceCommandInput = {