Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPD-7592 keep standard tags when updating #290

Open
wants to merge 1 commit into
base: proxy-cli-hook-aws-v2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!
lethanh273 marked this conversation as resolved.
Show resolved Hide resolved
end

def format_event(event)
Expand Down