Skip to content

Commit

Permalink
Merge pull request #141 from Petersoj/delete_ec2_tags
Browse files Browse the repository at this point in the history
feat: remove EC2 instances tags before termination
  • Loading branch information
ekristen authored Apr 14, 2024
2 parents 2fec95f + 3e27ebd commit 3b24ac9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions resources/ec2-instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ func (i *EC2Instance) Filter() error {
}

func (i *EC2Instance) Remove(_ context.Context) error {
deleteTagsParams := &ec2.DeleteTagsInput{
Resources: []*string{i.instance.InstanceId},
}
if _, err := i.svc.DeleteTags(deleteTagsParams); err != nil {
return err
}

params := &ec2.TerminateInstancesInput{
InstanceIds: []*string{i.instance.InstanceId},
}
Expand Down

0 comments on commit 3b24ac9

Please sign in to comment.