It might be to late to answer this, I also new in using CDK but I implement such functionality by providing additional context through cdk command option --context and then retrieve the rest of the context defined in cdk.json file based on it, as the sample shown below, cdk.json file:
I synth the cdk app by issuing command cdk synth --profile prod --context env=dev and the conf constant result would be like,
{
"someProperty": "developmentDomain.com"
}
Also I want to keep the env context provided receives dev or prod value only, hence I implement schema validation using zod while parsing the env context
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
It might be to late to answer this, I also new in using CDK but I implement such functionality by providing additional context through cdk command option
--context
and then retrieve the rest of the context defined incdk.json
file based on it, as the sample shown below,cdk.json
file:bin/app.ts
file:I synth the cdk app by issuing command
cdk synth --profile prod --context env=dev
and theconf
constant result would be like,Also I want to keep the
env
context provided receivesdev
orprod
value only, hence I implement schema validation using zod while parsing theenv
context