Robin
02/23/2022, 1:32 PMRoss Coundon
02/23/2022, 1:35 PMthdxr
02/23/2022, 1:47 PMRobin
02/23/2022, 1:48 PMimport { StringParameter } from "@aws-cdk/aws-ssm";
const api = StringParameter.valueFromLookup(
this,
"/thingy/api/url"
);
Robin
02/23/2022, 1:49 PMsst.Stack
class constructorRobin
02/23/2022, 1:50 PMAre you using a specific version of the parameter?No. But, we have removed it and added again to ensure there is no history. Good thought.
thdxr
02/23/2022, 1:55 PMthdxr
02/23/2022, 1:56 PMStringParameter.fromStringParameterName
which will pass in a token which gets resolved during the cfn deployRobin
02/23/2022, 1:57 PMcdk.context.json
is that in he .build
directory?thdxr
02/23/2022, 2:04 PMthdxr
02/23/2022, 2:04 PMthdxr
02/23/2022, 2:05 PMRoss Gerbasi
02/23/2022, 4:55 PMfromStringParameterName
as it seems to not require the full secret ID. For now I've been using this little helper utility, but maybe there is a better way?
getRef(secretName: string, field?: string) {
const SecretId = `arn:aws:secretsmanager:${region}:${account}:secret:${secretName}`
return SecretValue.secretsManager(SecretId, {
jsonField: field,
}).toString()
},
thdxr
02/23/2022, 4:55 PMthdxr
02/23/2022, 4:56 PMRoss Gerbasi
02/23/2022, 4:58 PMthdxr
02/23/2022, 4:59 PMRoss Gerbasi
02/23/2022, 5:05 PMthdxr
02/23/2022, 5:08 PM/app/stage/<KEY>
there's an API for pulling all of them by prefixthdxr
02/23/2022, 5:08 PMthdxr
02/23/2022, 5:09 PMRoss Gerbasi
02/23/2022, 5:09 PMRoss Gerbasi
02/23/2022, 5:10 PMRoss Coundon
02/23/2022, 5:48 PMRoss Coundon
02/23/2022, 5:48 PMRoss Gerbasi
02/23/2022, 5:58 PMsst deploy
it will somehow get the latest param? Isn't the data in CF just a reference? Trying to make sure i understand what the "update a param and get it into production" workflow looks like, if you are using build time params and not runtime.Ross Coundon
02/23/2022, 5:59 PMRoss Gerbasi
02/23/2022, 6:12 PMfromStringParameterName
is async though, I am guessing it doesnt actually call out to AWS to get latest info. I would think this is making a token for CF to pick up the latest on deploy...
Guess i need to do some tests here, see if i have the same trouble here as i did with secrets where the secret updated but the SST deploy was unware so there was no delta and thus no updates.Ross Coundon
02/23/2022, 7:08 PM