Skip to content

Commit

Permalink
Merge pull request #21 from jaffee/current-stack
Browse files Browse the repository at this point in the history
add cf value of "current" stack to template vars
  • Loading branch information
daidokoro authored Jun 15, 2017
2 parents b0abb31 + 6d5efc6 commit 0a195c6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commands/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ func (s *stack) deployTimeParser() error {
values := config.vars()

// Add metadata specific to the stack we're working with to the parser
values["stack"] = s.name
values["stack"] = values[s.name]
values["parameters"] = s.parameters

t.Execute(&doc, values)
Expand Down Expand Up @@ -628,7 +628,7 @@ func (s *stack) genTimeParser() error {
values := config.vars()

// Add metadata specific to the stack we're working with to the parser
values["stack"] = s.name
values["stack"] = values[s.name]
values["parameters"] = s.parameters

t.Execute(&doc, values)
Expand Down
16 changes: 16 additions & 0 deletions examples/currentstack/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
region: us-east-1
project: myproj

global:

stacks:
mystacksmall:
source: templates/single.yml
cf:
nodes: 2
instancetype: t2.nano
mystackbig:
source: templates/single.yml
cf:
nodes: 10
instancetype: c4.xlarge
11 changes: 11 additions & 0 deletions examples/currentstack/templates/single.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Description: Test Stack deployed by qaz
AWSTemplateFormatVersion: '2010-09-09'
Resources:
{{- range $i, $_ := loop .stack.nodes }}
MyInstance{{ $i }}:
Type: "AWS::EC2::Instance"
Properties:
InstanceType: {{$.stack.instancetype}}
KeyName: "mykey"
ImageID: "ami-e3c3b8f4"
{{- end -}}

0 comments on commit 0a195c6

Please sign in to comment.