1
votes

I am trying to add a new stack into the existing cloudformation infrastructure. But for some reason, the new stack is not getting deployed along with other stacks.

When I deploy this new stack separately, it works properly.

Here's the code:

FILE1.ts

export class newStack extends Construct {

    readonly oneStack: OneStack;

    readonly twoStack: TwoStack;

    readonly myNewStack: MyNewStack;

    constructor(scope: Construct, id: string, props: someProps) {
        super(scope, id);

        const { env, region, stageSetting } = props;

        this.oneStack = new OneStack(this, `${id}-OneStack`, {
            ...props,
            stackName: `${id}-ABCDEFG`,
        });

        this.twoStack = new TwoStack(scope, `${id}-TwoStack`,{
            ...props,
        });

        this.myNewStack = new MyNewStack(this, `${id}-Alarms`, {
            ...props,
        });
    }
}

FILE2.ts


deploymentgrps.push({
            name: "name"
            stacks: [
                newStack.oneStack,
                newStack.twoStack,
                newStack.myNewStackStack,
            ],
            deploymentRule: "rules here"
        });

regularDeploymentGroupOpts.forEach((grp_member) => pipeline.addDeploymentGroup(grp_member))

In other file, upon doing

const abc = new newStack()

all stacks should be generated, is my understanding. On deploying the CDK change, myNewStack is not getting deployed like oneStack and twoStack. Does anyone see anything that I am missing here?

1

1 Answers

0
votes

You should check a list of stack that you will deploy.

cdk ls

For example:

oneStack
twoStack
myNewStack

Then you want to deploy all stacks:

cdk deploy oneStack twoStack myNewStack