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

Alert triggered for deleted resource (Resource group 'test' could not be found.) #709

Open
Rohit1509 opened this issue Jan 9, 2023 · 5 comments

Comments

@Rohit1509
Copy link

We are currently running into an error when resources have been deleted during the progress of the scan of a subscription. The errors typically look something like this: "Resource group 'test' could not be found.". If a deletion is in progress and Inspec catches the resource exactly at that same time, it gives an alert which ideally should not be the case.

Possible Solution

Implement error handling that skips the resource if the resource no longer exists

@sathish-progress
Copy link
Contributor

sathish-progress commented Jan 12, 2023

Inspec always skips the resources when the resource is not available but tries to report it..
BTW, Could you give an example of your controls?

@Rohit1509
Copy link
Author

Inspec always skips the resources when the resource is not available but tries to report it.. BTW, Could you give an example of your controls?

Hi @sathish-progress , so it does catch a resource which is either not completely created or deleted and gives out this error mentioned in the title. This is example of control we have:

image

@Rohit1509
Copy link
Author

@sathish-progress , any updates on this issue ? Thanks!

@sathish-progress
Copy link
Contributor

@Rohit1509 so the resource_data attribute that you have passed in this example lets you use the cached information from plural resource so if in case you have the data consistency issues, I would recommend to first check the resource with exists matcher and than use the other matchers

@soumyo13
Copy link
Contributor

Steps I followed:

  1. Created a resource group “test123”

  2. Created a storage_account say “sa123” in the resource group

  3. While running the control, I did the below cases:

    1. I deleted the resource_group along with the storage account - I didn’t get any errors. The control ran successfully.

    2. I deleted only the storage group keeping the resource group - I didn’t get any errors. The control ran successfully.

  4. Other cases also I tried. I hit on the delete button on the resource_group along with the storage account. And then immediately ran the control. It worked fine.

I tried these scenarios and I couldn’t able to replicate this issue. And in the comments, @sathish-progress also has given a solution.

If you are still getting this error, let us know the exact scenario so that we can work on it.

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

No branches or pull requests

4 participants