Skip to content

Commit

Permalink
add extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlikl committed May 9, 2024
1 parent 0816500 commit 8145a99
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 8145a99

Please sign in to comment.