Permalink
Browse files

Merge pull request #1469 from davetchen/master

Add Tags to create_stack call
  • Loading branch information...
2 parents 2dfb255 + 563bb43 commit d4d6c1d2bdbfa7db14401276997030b2282252d7 @geemus geemus committed Jan 14, 2013
Showing with 17 additions and 0 deletions.
  1. +17 −0 lib/fog/aws/requests/cloud_formation/create_stack.rb
@@ -51,6 +51,23 @@ def create_stack(stack_name, options = {})
end
end
+ num_tags = 0
+ if options['Tags']
+ options['Tags'].keys.each_with_index do |key, index|
+ index += 1 # tags are 1-indexed
+ num_tags += 1 # 10 tag max
+
+ params.merge!({
+ "Tags.member.#{index}.Key" => key,
+ "Tags.member.#{index}.Value" => options['Tags'][key]
+ })
+ end
+ end
+
+ if num_tags > 10
+ raise ArgumentError.new("a maximum of 10 tags can be specified <#{num_tags}>")
+ end
+
if options['TemplateBody']
params['TemplateBody'] = options['TemplateBody']
elsif options['TemplateURL']

0 comments on commit d4d6c1d

Please sign in to comment.