Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Disabling Remediation Configuration before deleting config rule #1001

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions resources/configservice-configrules.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func ListConfigServiceConfigRules(sess *session.Session) ([]Resource, error) {
}

func (f *ConfigServiceConfigRule) Remove() error {
f.svc.DeleteRemediationConfiguration(&configservice.DeleteRemediationConfigurationInput{
ConfigRuleName: f.configRuleName,
})
Comment on lines +47 to +49
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
f.svc.DeleteRemediationConfiguration(&configservice.DeleteRemediationConfigurationInput{
ConfigRuleName: f.configRuleName,
})
_, err := f.svc.DeleteRemediationConfiguration(&configservice.DeleteRemediationConfigurationInput{
ConfigRuleName: f.configRuleName,
})
if err != nil {
return err
}

I think we should catch the error here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a chance that no remediation configuration exist for the given config rule, and that will result in NoSuchRemediationConfigurationException

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that makes sense


_, err := f.svc.DeleteConfigRule(&configservice.DeleteConfigRuleInput{
ConfigRuleName: f.configRuleName,
Expand Down