File `cdk.context.json` should be added to source ...
# sst
a
File
cdk.context.json
should be added to source control?
f
yes
a
Any reason?
I mean, isn’t this generated?
f
CDK stores some states in there, ie. hosted zone information; # of AZs in ur region; etc
a
Yeah I saw it, but can this conflict with SEED?
f
so say if AWS adds a new AZ for ur region, u don’t all of a sudden have a new AZ, new VPC config when you deploy
it shouldn’t conflict
a
Ok.
f
We recommend that your project’s context files be placed under version control along with the rest of your application, as the information in them is part of your app’s state and is critical to being able to synthesize and deploy consistently.
https://docs.aws.amazon.com/cdk/latest/guide/context.html
a
Interesting.
I delete it sometimes when I want for example to refresh the SSM values.
I saw the ssm values are stored there, and sometimes I need to change them.
f
Oh yeah… I’ve heard ppl bringing that up b4
a
It’s like caching those values.
Yeah.
f
I an see that being problematic
a
Yeah that’s why I don’t want to commit this file, tbh.
f
okay I think I see what’s goign on’
whenever you are calling CDK’s xxxxFromLookup, the value is will be cached
a
Oh makes sense.
I also have VPC stuff there, because I do lookup also.
VPC, security-group and SSM, all of those are lookup for me.
f
yeah u probably want the VPC and SG stuff to be cached
a
Might be faster for CI/CD?
f
for SSM, try using
fromStringParameter
or
valueForStringParameter
the values shouldn’t be cached in the context
a
Ok checking.
fromStringParameterName
requires to set an ID, what is that for?
Going to try
valueForStringParameter
better.
Looks like this worked, no cached values anymore.