Reputation: 31520
A little confused about how to do this or if its possible.
THis is not a nested stack. I want to set tags in my CF template that apply to all resources in the template. AWS::CloudFormation::Stack resource can do that, but I don't need/want a nested stack i just have one stack and one template.
Upvotes: 5
Views: 4216
Reputation: 2683
Use command deploy
with --tags
:
aws cloudformation deploy \
--template-file template.yaml \
--stack-name MyStack \
--tags Key1=Value1 Key2=Value2
Docs:
--tags (list) A list of tags to associate with the stack that is created or updated. AWS CloudFormation also propagates these tags to resources in the stack if the resource supports it. Syntax: TagKey1=TagValue1 TagKey2=TagValue2 ...
Upvotes: 5
Reputation: 81
You can solve that with a kind of a workaround. You can create another CF template that will include only the "AWS::CloudFormation::Stack" resource. In the parameters, provide the tags that you want, and in the "TemplateURL" property, provide the URL of a template that specifies the stack that you want to create as a resource. Note that the template must be stored on an Amazon S3 bucket, so the URL must have the form: https://s3.amazonaws.com/.../TemplateName.extension
For more details: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-templateurl
Upvotes: 1