Ash Rhazaly
03/30/2022, 7:41 AMError: There is already a Construct with name 'SecretFromCompleteArn' in ApiStack
private getSecrets(ssmString: string): string {
const secretsManagerArn = StringParameter.valueForStringParameter(this, ssmString);
const { secretValue } = Secret.fromSecretCompleteArn(
this,
"SecretFromCompleteArn",
secretsManagerArn
);
return secretValue.toString();
}
const api = new sst.ApiGatewayV1Api(this, "api", {
defaultFunctionProps: {
environment: {
...database.environments(),
CREDENTIALS_ONE: this.getSecrets(ssmString1),
CREDENTIALS_TWO: this.getSecrets(ssmString2),
NODE_ENV: stage,
},
},
Brinsley
03/30/2022, 9:51 AM"SecretFromCompleteArn",
Make that value dynamic based on the function param and you should be good.Brinsley
03/30/2022, 9:52 AMthdxr
03/30/2022, 1:11 PMthdxr
03/30/2022, 1:11 PMAsh Rhazaly
03/30/2022, 2:44 PMthdxr
03/30/2022, 2:46 PMthdxr
03/30/2022, 2:46 PMthdxr
03/30/2022, 2:47 PMBrinsley
03/30/2022, 2:48 PMBrinsley
03/30/2022, 2:50 PMAsh Rhazaly
03/30/2022, 2:54 PMAsh Rhazaly
03/30/2022, 2:55 PMthdxr
03/30/2022, 2:56 PMthdxr
03/30/2022, 2:59 PM