mlevit / aws-auto-cleanup

Programmatically delete AWS resources based on an allowlist and time to live (TTL) settings
MIT License
496 stars 55 forks source link

ElasticBeanstalk resources are being detected / deleted, but we are unable to whitelist resources on our cleanup site #115

Closed dikuesan1 closed 2 years ago

dikuesan1 commented 2 years ago

Describe the bug After running the cleanup, ElasticBeanstalk resources can not be whitelisted on our exemption site.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'ElasticBeanstalk console'
  2. Click on ' Create a new environment'
  3. Create new environment and application
  4. Run the cleanup in dry run mode
  5. Check Cleanup site to whitelist an ElasticBeanstalk resource

Expected behavior The expected behavior is for a window to pop up once you click the "+", then you are expected to input the owner and reason why you would like to whitelist the resource. I enabled EC2 resources during this testing and was able to whitelist one of the instance after running in dry run mode but when selecting the "+" beside an ElasticBeanstalk resource, the "+" functionality is unresponsive.

Screenshots

ElasticBeanstalk detection after cleanup

AWS (please complete the following information):

Additional context

In the screenshot, you will see the yellow "+" button in the Exception List column that I am referring to. For some reason the functionality is unresponsive. Any of resource tested, this functionality works. On ElasticBeanstalk resources behave in an unresponsive manner after detection.

Haven't been able to get this working on my end.

mlevit commented 2 years ago

Hey @dikuesan1. Just did a little digging and I think I know what the issue is. The service is the log is Elastic Beanstalk but the service in my app settings is elasticbeanstalk which is really based on the way the servie is named in Boto3.

The problem is, when you press that button, the serivce name, resource, and ID are sent to a JS function called createAllowlistEntryFromExecutionLog where the service name has its spaces (`) replaced by underscores (_) and is lowercased to match the service name in the app settings. But as you can see, they won't match becauseelastic_beanstalk!=elasticbeanstalk`.

So i'll have to update the service name in my app settings to have an underscore seperator. This will however have an impact on existing allowlists. I'll make the change and ask you to test/validate if that's OK.

mlevit commented 2 years ago

@dikuesan1 can you pull this branch and test it? https://github.com/servian/aws-auto-cleanup/tree/115-elasticbeanstalk-resources-are-being-detected-deleted-but-we-are-unable-to-whitelist-resources-on-our-cleanup-site

The app settings have changed so this will impact any allowlists.