Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling Remediation Configuration before deleting config rule #1001

Merged
merged 1 commit into from
Aug 29, 2023

Conversation

Muhammad-Ahmad-Rai
Copy link
Contributor

Fixes the Error: "ResourceInUseException: The rule{RULE_NAME} currently has a RemediationConfiguration. Please delete the RemediationConfiguration and try again."

@Muhammad-Ahmad-Rai Muhammad-Ahmad-Rai requested a review from a team as a code owner May 18, 2023 08:28
@der-eismann
Copy link
Member

Hey @Muhammad-Ahmad-Rai, thanks for the PR and sorry for the late reply! Could you resolve the conflict and rebase your changes, ideally without the changes from #993? That would be awesome 🙂

@der-eismann der-eismann added the status/waiting-reponse Waiting for the issue author to respond to a question. label Aug 25, 2023
@Muhammad-Ahmad-Rai
Copy link
Contributor Author

Hey @Muhammad-Ahmad-Rai, thanks for the PR and sorry for the late reply! Could you resolve the conflict and rebase your changes, ideally without the changes from #993? That would be awesome 🙂

@der-eismann Done

Copy link
Member

@der-eismann der-eismann left a comment

Choose a reason for hiding this comment

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

I'm starting to wonder if it would make more sense to create a separate RemediationConfiguration resources, but I don't know how these things interact, so let's follow your approach.

Comment on lines +47 to +49
f.svc.DeleteRemediationConfiguration(&configservice.DeleteRemediationConfigurationInput{
ConfigRuleName: f.configRuleName,
})
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

@der-eismann der-eismann removed the status/waiting-reponse Waiting for the issue author to respond to a question. label Aug 25, 2023
@der-eismann der-eismann merged commit 7c612f4 into rebuy-de:main Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants