Skip to content

Commit

Permalink
fast workaround for select + getAZ (awslabs#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtim75 authored and PaulMaddox committed Aug 14, 2019
1 parent 881620e commit b2d834c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cloudformation/intrinsics.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ func Join(delimiter interface{}, values []string) string {

// Select returns a single object from a list of objects by index.
func Select(index interface{}, list []string) string {
if len(list) == 1 {
return encode(fmt.Sprintf(`{ "Fn::Select": [ "%v", "%v" ] }`, index, list[0]))
}
return encode(fmt.Sprintf(`{ "Fn::Select": [ "%v", [ "%v" ] ] }`, index, strings.Trim(strings.Join(list, `", "`), `, "`)))
}

Expand Down

0 comments on commit b2d834c

Please sign in to comment.