Skip to content

Commit

Permalink
fix rds parameter default group nuke issue (gruntwork-io#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
james03160927 authored Jun 11, 2024
1 parent 03b54f4 commit a111ffb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions aws/resources/rds_parameter_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resources

import (
"context"
"strings"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/rds"
Expand All @@ -18,6 +19,13 @@ func (pg *RdsParameterGroup) getAll(c context.Context, configObj config.Config)
&rds.DescribeDBParameterGroupsInput{},
func(page *rds.DescribeDBParameterGroupsOutput, lastPage bool) bool {
for _, parameterGroup := range page.DBParameterGroups {
// we can't delete default paramter group
// Default parameter group names can include a period, such as default.mysql8.0. However, custom parameter group names can't include a period.
if strings.HasPrefix(aws.StringValue(parameterGroup.DBParameterGroupName), "default.") {
logging.Debugf("Skipping %s since it is a default parameter group", aws.StringValue(parameterGroup.DBParameterGroupName))
continue
}

if configObj.RdsParameterGroup.ShouldInclude(config.ResourceValue{
Name: parameterGroup.DBParameterGroupName,
}) {
Expand Down

0 comments on commit a111ffb

Please sign in to comment.