Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lambda alias to live deploy template #720

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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