diff --git a/lib/moonshot/stack.rb b/lib/moonshot/stack.rb index fb9e78c1..e66a625b 100644 --- a/lib/moonshot/stack.rb +++ b/lib/moonshot/stack.rb @@ -39,6 +39,7 @@ def update(dry_run:, force:) raise "No stack found #{@name.blue}!" unless stack_exists? change_set = ChangeSet.new(new_change_set, @name) + wait_for_change_set(change_set) return unless change_set.valid? @@ -94,6 +95,12 @@ def outputs .to_h end + def existing_tags + get_stack(@name) + .tags + .map { |o| { key: o.key, value: o.value } } + end + def exists? cf_client.describe_stacks(stack_name: @name) true @@ -235,6 +242,7 @@ def new_change_set parameters: @config.parameters.values.map(&:to_cf), tags: make_tags } + if @config.template_s3_bucket parameters[:template_url] = upload_template_to_s3 else @@ -301,7 +309,7 @@ def make_tags default_tags << { key: @config.additional_tag, value: @name } end - default_tags + @config.extra_tags + (default_tags + @config.extra_tags + existing_tags).uniq! end def format_event(event)