Skip to content

Commit

Permalink
CPD-7592 keep standard tags when updating
Browse files Browse the repository at this point in the history
Change: patch
Purpose: maintenance
  • Loading branch information
lethanh273 committed Dec 2, 2022
1 parent f523c75 commit 11180be
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/moonshot/stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 11180be

Please sign in to comment.