Skip to content

Commit 3e4f4ca

Browse files
committed
fix(configservice-configrules): filter out rules created by config-conforms
1 parent 91ab562 commit 3e4f4ca

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

resources/configservice-configrules.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ package resources
22

33
import (
44
"context"
5-
65
"fmt"
76

87
"github.com/aws/aws-sdk-go/aws"
98
"github.com/aws/aws-sdk-go/service/configservice"
109

1110
"github.com/ekristen/libnuke/pkg/registry"
1211
"github.com/ekristen/libnuke/pkg/resource"
12+
"github.com/ekristen/libnuke/pkg/types"
1313

1414
"github.com/ekristen/aws-nuke/pkg/nuke"
1515
)
@@ -69,6 +69,10 @@ func (f *ConfigServiceConfigRule) Filter() error {
6969
return fmt.Errorf("cannot remove rule owned by securityhub.amazonaws.com")
7070
}
7171

72+
if aws.StringValue(f.createdBy) == "config-conforms.amazonaws.com" {
73+
return fmt.Errorf("cannot remove rule owned by config-conforms.amazonaws.com")
74+
}
75+
7276
return nil
7377
}
7478

@@ -83,3 +87,9 @@ func (f *ConfigServiceConfigRule) Remove(_ context.Context) error {
8387
func (f *ConfigServiceConfigRule) String() string {
8488
return *f.configRuleName
8589
}
90+
91+
func (f *ConfigServiceConfigRule) Properties() types.Properties {
92+
props := types.NewProperties()
93+
props.Set("CreatedBy", f.createdBy)
94+
return props
95+
}

0 commit comments

Comments
 (0)