https://serverless-stack.com/ logo
#sst
Title
# sst
a

Adrián Mouly

08/28/2021, 6:01 AM
File
cdk.context.json
should be added to source control?
f

Frank

08/28/2021, 6:10 AM
yes
a

Adrián Mouly

08/28/2021, 6:11 AM
Any reason?
I mean, isn’t this generated?
f

Frank

08/28/2021, 6:12 AM
CDK stores some states in there, ie. hosted zone information; # of AZs in ur region; etc
a

Adrián Mouly

08/28/2021, 6:12 AM
Yeah I saw it, but can this conflict with SEED?
f

Frank

08/28/2021, 6:12 AM
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

Adrián Mouly

08/28/2021, 6:13 AM
Ok.
f

Frank

08/28/2021, 6:14 AM
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

Adrián Mouly

08/28/2021, 6:14 AM
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

Frank

08/28/2021, 6:15 AM
Oh yeah… I’ve heard ppl bringing that up b4
a

Adrián Mouly

08/28/2021, 6:15 AM
It’s like caching those values.
Yeah.
f

Frank

08/28/2021, 6:15 AM
I an see that being problematic
a

Adrián Mouly

08/28/2021, 6:15 AM
Yeah that’s why I don’t want to commit this file, tbh.
f

Frank

08/28/2021, 6:16 AM
okay I think I see what’s goign on’
whenever you are calling CDK’s xxxxFromLookup, the value is will be cached
a

Adrián Mouly

08/28/2021, 6:17 AM
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

Frank

08/28/2021, 6:18 AM
yeah u probably want the VPC and SG stuff to be cached
a

Adrián Mouly

08/28/2021, 6:19 AM
Might be faster for CI/CD?
f

Frank

08/28/2021, 6:19 AM
for SSM, try using
fromStringParameter
or
valueForStringParameter
the values shouldn’t be cached in the context
a

Adrián Mouly

08/28/2021, 6:20 AM
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.
4 Views