Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow setting stackName of Stack inside the Stack

See original GitHub issue

Currently you can explicitly set the stack name by passing in the stackName prop to a Stack. It would be nice to be able to dynamically set the stack name within the Stack implementation.

Use Case

I would like to be able to use a stack parameter in the stack name. For example I have parameters cluster=BigCluster and JobNumber=123. I would like the name of my stack to be MyStack-BigCluster-123

Proposed Solution

a setStackName(String) method in Stack would be ideal.

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

eladbcommented, May 6, 2020

You can achieve this by simply passing in the stack name to the super call like this:

interface MyStackProps extends StackProps {
  cluster: string;
  jobNumber: number;

class MyStack extends Stack {
  constructor(scope: Construct, id: string, props: MyStackProps) {
    super(scope, id, {
      stackName: `MyStack-${props.jobNumber}-${props.cluster}`,
      ...props // before/after will impact if consumers can specify a custom `stackName`

Closing for now. Let me know if this is what you are after.

lyonzycommented, Sep 7, 2021

Thanks, that’s an answer for the synth phase but I was really hoping to do a “synth once deploy many” approach which would mean it would need to synthesise with a placeholder value of some kind that deploy understands.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specifying stack name and parameters - AWS CloudFormation
Specify the stack name and parameters that are defined in the template by using the AWS CloudFormation console.
Read more >
Is there a way to configure the 'Stack Name' of nested stacks in ...
In a given template, you have access to the pseudo-parameters stackId and stackName. Those can be marked for export, then referenced in ......
Read more >
4. Managing cloud environments - Spring Cloud
In order to allow multiple stacks in parallel, each resource in the stack ... The configuration consists of an additional element attribute stack-name...
Read more >
CloudFormation — Boto3 Docs 1.26.36 documentation
Don't confuse a child stack's name with its corresponding logical ID defined in the parent stack. For an example of a continue update...
Read more >
Intro to Pulumi: Stacks
While stacks with applied configuration settings will often be accompanied by Pulumi.<stack-name>.yaml files, these files are not created by pulumi stack init ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found