I do multiple stacks via changing the state file based off of env:
constructor(scope: Construct, name: string, c: StackConfig) {
super(scope, name);
new S3Backend(this, {
bucket: "some-bucket-here",
key: c.name("state-env"),
region: "" // wherever
});
}
// ... at the bottom of main
new Stack(app, 'something-something-dev', { environment: "dev", name: (i) => `${i}-dev` });
new Stack(app, 'something-something-prod', { environment: "prod", name: (i) => `${i}-prod` });
Then you can use stacks properly.
Re:Terraform 1.0
by cmclaughlin on Tuesday June 08, 2021 @11:42PM
(#27443982)
Support for multiple stacks in a single file was added to cdktf recently. I’ve been managing dozens of production stacks in a single repo for a while now and highly recommended it.
Re:Terraform 1.0
by ManWith2Plans on Wednesday June 09, 2021 @08:18AM
(#27447029)
And yet if you try to pass values from one stack to another, it will fail spectacularly.
Stick with terraform if you need to provision non-aws resources. Otherwise, use aws-cdk.