From a111ffb7c9f44bc75280c475d53dc2b06f369c72 Mon Sep 17 00:00:00 2001 From: James Kwon <96548424+hongil0316@users.noreply.github.com> Date: Tue, 11 Jun 2024 18:37:07 -0400 Subject: [PATCH] fix rds parameter default group nuke issue (#721) --- aws/resources/rds_parameter_group.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aws/resources/rds_parameter_group.go b/aws/resources/rds_parameter_group.go index 69d94694..fddbb185 100644 --- a/aws/resources/rds_parameter_group.go +++ b/aws/resources/rds_parameter_group.go @@ -2,6 +2,7 @@ package resources import ( "context" + "strings" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/rds" @@ -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, }) {