Skip to content

Commit

Permalink
Add lambda alias to live deploy template
Browse files Browse the repository at this point in the history
Signed-off-by: jsetton <[email protected]>
  • Loading branch information
jsetton committed Nov 13, 2024
1 parent 2618e73 commit c3dcd72
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions .github/scripts/generateDeployConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,28 @@ function updateSkillInfraTemplate() {
Description: `${schema.Resources.AlexaSkillFunction.Properties.Description} (${process.env.RELEASE_VERSION})`
}
};
// Define skill function version permission resource name
const permissionResource = `AlexaSkillFunctionPermission${revision}`;
// Add skill function version permission resource
schema.Resources[permissionResource] = {
// Add skill function alias resource
schema.Resources.AlexaSkillFunctionAlias = {
Type: 'AWS::Lambda::Alias',
DeletionPolicy: 'Retain',
Properties: {
Name: 'live',
FunctionName: { Ref: 'AlexaSkillFunction' },
FunctionVersion: { 'Fn::GetAtt': [versionResource, 'Version'] },
Description: `${schema.Resources.AlexaSkillFunction.Properties.Description} (Live)`
}
};
// Add skill function alias permission resource
schema.Resources.AlexaSkillFunctionAliasPermission = {
Type: 'AWS::Lambda::Permission',
DeletionPolicy: 'Retain',
Properties: {
...schema.Resources.AlexaSkillFunctionPermission.Properties,
FunctionName: { Ref: versionResource }
FunctionName: { Ref: 'AlexaSkillFunctionAlias' }
}
};
// Update skill endpoint output value
schema.Outputs.SkillEndpoint.Value = { Ref: versionResource };
schema.Outputs.SkillEndpoint.Value = { Ref: 'AlexaSkillFunctionAlias' };
// Save skill infrastructure template schema
saveSchema(schema, SKILL_INFRA_TEMPLATE_FILE);
}
Expand Down

0 comments on commit c3dcd72

Please sign in to comment.