jckuester / awsweeper

A tool for cleaning your AWS account
Mozilla Public License 2.0
468 stars 45 forks source link

No dates for Cloudformation stacks #82

Closed andreamaruccia closed 4 years ago

andreamaruccia commented 4 years ago

my config:

aws_cloudformation_stack:
  - id: NOT(mystackname1|mystackname2)
    created:
      after: 2020-01-01

my command: ./awsweeper --profile my-sandbox --region eu-west-1 --dry-run --output string ./config.yml

gives an empty result (so nothing to be deleted)

INFO[0000] using region: eu-west-1                      
INFO[0001] This is a test run, nothing will be deleted! 

If I check the json by removing the date filter I will see an object like this one:

[
  {
    "Type": "aws_cloudformation_stack",
    "ID": "arn:aws:cloudformation:eu-west-1:*****:stack/*****/****-****-****-***-****",
    "Tags": {
      "***": "****"
    },
    "Created": null,
    "Attrs": null
  },
... <redacted>

You can see here that the date field is null

Update 1: To be noted that i'm using version v0.4.1 because of https://github.com/cloudetc/awsweeper/issues/81 Update 2: I've cloned the project and compiled it, same result

andreamaruccia commented 4 years ago

I've checked the codebase in case to make a MR, weired thing is that it just calls the aws go sdk which should have that field. I don't understand why it should not work, maybe the dependency is just outdated?

jckuester commented 4 years ago

Hi @andreamaruccia :wave: Thanks for opening this issue. I provided a fix (https://github.com/cloudetc/awsweeper/pull/83). The creation date field is named differently across resource types (sometimes CreatedTime, CreationTime, etc.), and I keep a lookup-list with the different names to look for with reflection.

andreamaruccia commented 4 years ago

amazing i confirm it works over here!