Method: Ufo::TaskDefinition::Helpers::Vars::Builder#expansion

Defined in:
lib/ufo/task_definition/helpers/vars/builder.rb

#expansion(arn) ⇒ Object

arn:aws:ssm:us-west-2:111111111111:parameter/demo/dev/DB-NAME arn:aws:ssm:us-west-2:111111111111:parameter/demo/dev/DB-NAME



116
117
118
119
120
121
122
123
124
125
126
# File 'lib/ufo/task_definition/helpers/vars/builder.rb', line 116

def expansion(arn)
  md = arn.match(/(.*:)(parameter\/|secret:)(.*)/)
  if md
    prefix, type, name = md[1], md[2], md[3]
    # performance improvement only run names.expansion on the name portion
    expanded_name = names.expansion(name, dasherize: false) # dasherize: false. dont turn SECRET_NAME => SECRET-NAME
    "#{prefix}#{type}#{expanded_name}"
  else # not arn full value. In case user accidentally puts value in .secrets file KEY=value
    names.expansion(arn, dasherize: false) # dasherize: false. dont turn SECRET_NAME => SECRET-NAME
  end
end