Is there a way to access default stack name from jinja template?
If not, is there a way to access it from within stack config file - then I can set a custom variable within namespace 'sceptre_user_data'.
I guess I could write a custom resolver, but I'm imagining it must already be available somehow.
Thanks.
Adding it to sceptre_user_data would surely work, you dont need to write a custom resolver for it. However, I am not sure if the stack name is automatically available to the jinja or not. @andyoll
@andyoll did @ankitml answer your question?
template name or entire stack name?
file name is {{ self._TemplateReference__context.name }}
stack name can be derived from a few variables and passed as sceptre_user_data
I think it would be {{ environment_config.project_code }}-{{ environment_path | join('-') }}-{{ self._TemplateReference__context.name[:-5] }} (however you'd be better of using the pseudo parameter (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html#cfn-pseudo-param-stackname))
I'm looking to do the same sort of thing. I want to pass the stack name to the cmd hook. Is this possible? Something like this..
template_path: templates/ExternalBucket.yaml
stack_name: TestStudy
parameters:
SynapseUserName: "zippa"
hooks:
after_create:
- !cmd "BucketHelper.sh {{ stack_config.stack_name }}"
Answering my own question. What I'm trying to do seems possible only in V2.
kudos @zaro0508 looks like you solved this huh: https://github.com/zaro0508/sceptre-identity-resolver
would be great to have this included in sceptre :)
I don't think it is resolved yet!
Most helpful comment
template name or entire stack name?
file name is {{ self._TemplateReference__context.name }}
stack name can be derived from a few variables and passed as sceptre_user_data
I think it would be
{{ environment_config.project_code }}-{{ environment_path | join('-') }}-{{ self._TemplateReference__context.name[:-5] }}(however you'd be better of using the pseudo parameter (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/pseudo-parameter-reference.html#cfn-pseudo-param-stackname))