Skip to content

Commit

Permalink
Add support to Stack level tags in service_registry [DO NOT MERGE] (#239
Browse files Browse the repository at this point in the history
)

* Harcode tags for service, env and team
  • Loading branch information
jdmendozaa committed Nov 10, 2022
1 parent 260e648 commit 7cab964
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions efopen/ef_cf.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,23 @@ def main():

print("Template passed validation")

# Create stack-level tags that will be applied to all resources that support tagging.
team = context.service_registry.service_record(service_name).get("team_opsgenie", "")
tags = [
{
"Key": "service",
"Value": service_name,
},
{
"Key": "env",
"Value": context.env,
},
{
"Key": "team",
"Value": team,
}
]

# DO IT
try:
if context.changeset:
Expand All @@ -369,7 +386,8 @@ def main():
Parameters=parameters,
Capabilities=['CAPABILITY_AUTO_EXPAND', 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'],
ChangeSetName=stack_name,
ClientToken=stack_name
ClientToken=stack_name,
Tags=tags
)
if is_stack_termination_protected_env(context.env):
enable_stack_termination_protection(clients, stack_name)
Expand All @@ -383,7 +401,8 @@ def main():
StackName=stack_name,
TemplateBody=template,
Parameters=parameters,
Capabilities=['CAPABILITY_AUTO_EXPAND', 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM']
Capabilities=['CAPABILITY_AUTO_EXPAND', 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM'],
Tags=tags
)
if is_stack_termination_protected_env(context.env):
enable_stack_termination_protection(clients, stack_name)
Expand Down

0 comments on commit 7cab964

Please sign in to comment.