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

python templates need access to more data from stack_config #583

Open
1oglop1 opened this issue Jan 6, 2019 · 0 comments
Open

python templates need access to more data from stack_config #583

1oglop1 opened this issue Jan 6, 2019 · 0 comments

Comments

@1oglop1
Copy link
Contributor

1oglop1 commented Jan 6, 2019

Currently only sceptre_user_data is passed to sceptre.Template
https://github.com/cloudreach/sceptre/blob/master/sceptre/stack.py#L203

and then passed to sceptre_handler
https://github.com/cloudreach/sceptre/blob/master/sceptre/template.py#L129

This leads to lose relation between template and stack config.
E.G:
stack_config.yaml

parameters:
  VpcId: 1234
sceptre_user_data:
  SecurityGroups:
  - sg-1234

Currently every templates needs to implement sceptre_handler method
template.py

import troposphere as tr

def sceptre_handler(sceptre_user_data):
   # from here the template developer has access only to  sceptre_user_data
   # if stack_config contains parameters developer needs to create them without having any reference to the stack config
   tmplt = tr.Template()
   tmplt.add_parameter(tr.parameter(Parameter('VpcId'))
  # but properties of resources could be loaded from stack config via sceptre_user_data
   tmpl.add_resource(tr.ec2.SecurityGroup('sg', **sceptre_user_data['SecurityGroup'])

Possible quick fix is to add parameters and other data passed to the Template.
Another way is to refactor the approach how the templates are being created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants