File tree Expand file tree Collapse file tree 4 files changed +15
-7
lines changed
infrastructure-as-code/aws-lambda-ec2-lifecycles/files Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,13 @@ def check_instance_tags(region):
25
25
# logger.info(instance.tags)
26
26
taglist = []
27
27
for tag in instance .tags :
28
- taglist .append (tag ['Key' ])
28
+ if tag ['Key' ] == 'TTL' or tag ['Key' ] == 'ttl' :
29
+ if isInteger (tag ['Value' ]):
30
+ taglist .append (tag ['Key' ].upper ())
31
+ elif tag ['Key' ] == 'Owner' or tag ['Key' ] == 'owner' :
32
+ taglist .append (tag ['Key' ].lower ())
33
+ else :
34
+ taglist .append (tag ['Key' ])
29
35
# logger.info(taglist)
30
36
if set (mandatory_tags ).issubset (set (taglist )):
31
37
nice_list .append (instance .id )
@@ -63,9 +69,9 @@ def get_tagged_instances():
63
69
for tag in instance ['Tags' ]:
64
70
if tag ['Key' ] == "Name" :
65
71
name = tag ['Value' ]
66
- if tag ['Key' ] == "owner" :
72
+ if tag ['Key' ] == "owner" or tag [ 'Key' ] == "Owner" :
67
73
owner = tag ['Value' ]
68
- if tag ['Key' ] == "TTL" :
74
+ if tag ['Key' ] == "TTL" or tag [ 'Key' ] == "ttl" :
69
75
if isInteger (tag ['Value' ]):
70
76
ttl = tag ['Value' ]
71
77
else :
Original file line number Diff line number Diff line change @@ -25,9 +25,11 @@ def check_instance_tags(region):
25
25
taglist = []
26
26
for tag in instance .tags :
27
27
# Ensures that TTL is valid
28
- if tag ['Key' ] == 'TTL' :
28
+ if tag ['Key' ] == 'TTL' or tag [ 'Key' ] == 'ttl' :
29
29
if isInteger (tag ['Value' ]):
30
- taglist .append (tag ['Key' ])
30
+ taglist .append (tag ['Key' ].upper ())
31
+ elif tag ['Key' ] == 'Owner' or tag ['Key' ] == 'owner' :
32
+ taglist .append (tag ['Key' ].lower ())
31
33
else :
32
34
taglist .append (tag ['Key' ])
33
35
if set (mandatory_tags ).issubset (set (taglist )):
@@ -64,9 +66,9 @@ def get_untagged_instances():
64
66
for tag in instance ['Tags' ]:
65
67
if tag ['Key' ] == "Name" :
66
68
name = tag ['Value' ]
67
- if tag ['Key' ] == "owner" :
69
+ if tag ['Key' ] == "owner" or tag [ 'Key' ] == "Owner" :
68
70
owner = tag ['Value' ]
69
- if tag ['Key' ] == "TTL" :
71
+ if tag ['Key' ] == "TTL" or tag [ 'Key' ] == "ttl" :
70
72
if isInteger (tag ['Value' ]):
71
73
ttl = tag ['Value' ]
72
74
else :
You can’t perform that action at this time.
0 commit comments