Skip to content

Commit

Permalink
Modify DeleteSecurityGroup function to use securityGroup Id (#1942)
Browse files Browse the repository at this point in the history
  • Loading branch information
akankshakumari393 authored Mar 7, 2023
1 parent a4a8534 commit 85755d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/app/rds_aurora_mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func (a *RDSAuroraMySQLDB) Uninstall(ctx context.Context) error {

// delete security group
log.Info().Print("Deleting security group.", field.M{"app": a.name})
_, err = ec2Cli.DeleteSecurityGroup(ctx, a.securityGroupName)
_, err = ec2Cli.DeleteSecurityGroup(ctx, a.securityGroupID)
if err != nil {
if err, ok := err.(awserr.Error); ok {
switch err.Code() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/app/rds_postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (pdb RDSPostgresDB) Uninstall(ctx context.Context) error {

// Delete security group
log.Info().Print("Deleting security group.", field.M{"app": pdb.name})
_, err = ec2Cli.DeleteSecurityGroup(ctx, pdb.securityGroupName)
_, err = ec2Cli.DeleteSecurityGroup(ctx, pdb.securityGroupID)
if err != nil {
if err, ok := err.(awserr.Error); ok {
switch err.Code() {
Expand Down
6 changes: 3 additions & 3 deletions pkg/aws/ec2/ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ func (e EC2) AuthorizeSecurityGroupIngress(ctx context.Context, groupName, cidr,
return e.AuthorizeSecurityGroupIngressWithContext(ctx, sgi)
}

func (e EC2) DeleteSecurityGroup(ctx context.Context, groupName string) (*ec2.DeleteSecurityGroupOutput, error) {
func (e EC2) DeleteSecurityGroup(ctx context.Context, groupId string) (*ec2.DeleteSecurityGroupOutput, error) {
sgi := &ec2.DeleteSecurityGroupInput{
DryRun: &e.DryRun,
GroupName: &groupName,
DryRun: &e.DryRun,
GroupId: aws.String(groupId),
}
return e.DeleteSecurityGroupWithContext(ctx, sgi)
}

0 comments on commit 85755d6

Please sign in to comment.