early-keyboard-41388
10/27/2021, 10:34 AMnew aws.lambda.Alias(
`alias-${stageSanitized}-new`,
{
name: 'SER001',
functionVersion: lambdaFN.version,
functionName: lambdaFN.name,
description: 'Alias for SER001 environment',
},
{ parent: lambdaFN, protect: true },
);
I already have an alias created for a given version of the same Lambda. But when I make pulumi update
, I get that the existing Alias will get deleted. What am I missing? So both Alias have different names: one for the env
, like dev
, and the other, simulating a feature (SER001
).
I even added the protected flag…little-cartoon-10569
10/27/2021, 7:23 PMearly-keyboard-41388
10/28/2021, 7:32 AMconst myLayer = new aws.lambda.LayerVersion("layer-dev", args);
const myFunction = new aws.lambda.Function("lambda-function1", {
...args,
name: 'my-function-dev',
layers: [myLayer.arn],
publish: true
});
new aws.lambda.Alias("alias-dev", {
name: 'dev',
functionVersion: myFunction.version,
functionName: myFunction.arn,
})
[stageSanitized = “dev”]
So with that scenario, I tried two options:
• Same Pulumi stack, changed the stageSanitized from dev
(code above) to SER001
(feature branch). And Pulumi deletes the dev Alias. Makes sense, as it’s not in the new Pulumi desired final state. Is there a way NOT to be deleted, and leave it as is? Because I need it to stay there, pointing to the Lambda published version as it was. So, basically could point me to a direction to understand if there’s a way to work with Lambda’s aliases with Pulumi?
• Different Pulumi stack, or maybe this is the way to go. Instead of using the Alias on a Lambda, it’s needed to make a complete deployment with another stack name, with the stack reference in the resources naming (so there’s no collision, as I’m forcing the AWS resources names, for references purposes).
Thanks!little-cartoon-10569
10/28/2021, 7:33 PMearly-keyboard-41388
10/29/2021, 8:04 AMdev
(no reference to the actual stack name), so Pulumi name and AWS resource name for Layer and Lambda are the same between stacks.
• But, the Alias is related to the Stack: dev
|| ser001
. Pointing to the same Lambda.
On the Lambda code for the new deployment (ser001
Stack), wouldn’t I get an error because the naming is the same (Pulumi and AWS resource)? Or how can I make this new deployment for another stack be just a new version on the same Lambda?little-cartoon-10569
10/31/2021, 6:58 PMif ("dev" == Pulumi.getStack()
), and export the stack reference. In the other stack, use the stack reference when creating the alias.