diff --git a/pkg/config/filter.go b/pkg/config/filter.go index 61fcbef0..019ed8eb 100644 --- a/pkg/config/filter.go +++ b/pkg/config/filter.go @@ -84,11 +84,12 @@ func parseDate(input string) (time.Time, error) { return t, nil } - formats := []string{"2006-01-02", + formats := []string{ + "2006-01-02", "2006/01/02", "2006-01-02T15:04:05Z", - "2006-01-02 15:04:05.000 -0700 MST", // Date format used by AWS for CreateTime on ASGs - time.RFC3339Nano, // Format of t.MarshalText() and t.MarshalJSON() + "2006-01-02 15:04:05 -0700 MST", // Date format used by AWS for CreateTime on ASGs + time.RFC3339Nano, // Format of t.MarshalText() and t.MarshalJSON() time.RFC3339, } for _, f := range formats { diff --git a/pkg/config/filter_test.go b/pkg/config/filter_test.go index a26df88c..25f0d236 100644 --- a/pkg/config/filter_test.go +++ b/pkg/config/filter_test.go @@ -48,18 +48,22 @@ func TestUnmarshalFilter(t *testing.T) { }, { yaml: `{"type":"dateOlderThan","value":"0"}`, - match: []string{strconv.Itoa(int(future.Unix())), + match: []string{ + strconv.Itoa(int(future.Unix())), future.Format("2006-01-02"), future.Format("2006/01/02"), future.Format("2006-01-02T15:04:05Z"), + future.Format("2006-01-02 15:04:05.000 +0000 UTC"), future.Format(time.RFC3339Nano), future.Format(time.RFC3339), }, - mismatch: []string{"", + mismatch: []string{ + "", strconv.Itoa(int(past.Unix())), past.Format("2006-01-02"), past.Format("2006/01/02"), past.Format("2006-01-02T15:04:05Z"), + past.Format("2006-01-02 15:04:05.14 -0700 MST"), past.Format(time.RFC3339Nano), past.Format(time.RFC3339), }, @@ -98,5 +102,4 @@ func TestUnmarshalFilter(t *testing.T) { } }) } - } diff --git a/resources/autoscaling-groups.go b/resources/autoscaling-groups.go index 5f41ec7d..94aff114 100644 --- a/resources/autoscaling-groups.go +++ b/resources/autoscaling-groups.go @@ -1,6 +1,8 @@ package resources import ( + "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/autoscaling" @@ -27,7 +29,6 @@ func ListAutoscalingGroups(s *session.Session) ([]Resource, error) { } return !lastPage }) - if err != nil { return nil, err } @@ -65,7 +66,7 @@ func (asg *AutoScalingGroup) Properties() types.Properties { properties.SetTag(tag.Key, tag.Value) } - properties.Set("CreatedTime", asg.group.CreatedTime) + properties.Set("CreatedTime", asg.group.CreatedTime.Format(time.RFC3339)) properties.Set("Name", asg.group.AutoScalingGroupName) return properties