Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Commit 62b4a37

Browse files
authored
v0.8.3.1
1 parent 274525c commit 62b4a37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1717
-1955
lines changed

Docs/articles/ReleaseNotes-Hicetas.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Release notes for LambdaSharp "Hicetas" (v0.8)
44
keywords: release, notes, hicetas
55
---
66

7-
# LambdaSharp "Hicetas" Release (v0.8.3.0) - 2021-05-18
7+
# LambdaSharp "Hicetas" Release (v0.8.3.1) - 2021-05-28
88

99
> Hicetas was a Greek philosopher of the Pythagorean School. He was born in Syracuse. Like his fellow Pythagorean Ecphantus and the Academic Heraclides Ponticus, he believed that the daily movement of permanent stars was caused by the rotation of the Earth around its axis. When Copernicus referred to Nicetus Syracusanus (Nicetus of Syracuse) in _De revolutionibus orbium coelestium_ as having been cited by Cicero as an ancient who also argued that the Earth moved, it is believed that he was actually referring to Hicetas. [(Wikipedia)](https://en.wikipedia.org/wiki/Hicetas)
1010
@@ -141,9 +141,25 @@ Part of this release, _LambdaSharp.Core_ functions were ported to .NET Core 3.1
141141

142142
## Releases
143143

144-
### (v0.8.3.0) - 2018-05-18
144+
### (v0.8.3.1) - 2021-05-28
145145

146-
### Features
146+
#### Features
147+
148+
* CLI
149+
* Simplified the mechanism for dynamically allowing operations on KMS keys passed in via `Secrets` parameter.
150+
151+
* Samples
152+
* Added `Samples/SecretSample` module showing how to use KMS encrypted values with Secret Manager and the access it from a Lambda function.
153+
154+
#### Fixes
155+
156+
* CLI
157+
* Fixed a regression in the parameters file processing.
158+
* Fixed a circular dependency when the `DecryptSecretFunction` was used to initialize a resource that was then scoped to a Lambda function.
159+
160+
### (v0.8.3.0) - 2021-05-18
161+
162+
#### Features
147163

148164
* All
149165
* Updated _Amazon.Lambda.*_ assembly references to v2.0.*

Docs/articles/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
- name: Releases
5858
items:
5959

60-
- name: Hicetas (v0.8.3.0)
60+
- name: Hicetas (v0.8.3.1)
6161
href: ReleaseNotes-Hicetas.md
6262

6363
- name: Geminus (v0.7.0.17)

Samples/SecretSample/Module.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# LambdaSharp (λ#)
2+
# Copyright (C) 2018-2021
3+
# lambdasharp.net
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
Module: Sample.SecretsManager
18+
Description: LambdaSharp CloudFormation Test
19+
Items:
20+
21+
- Parameter: UserName
22+
Type: String
23+
24+
- Parameter: Password
25+
Type: Secret
26+
27+
- Resource: CredentialsSecret
28+
Scope: MyFunction
29+
Type: AWS::SecretsManager::Secret
30+
Allow:
31+
- secretsmanager:GetSecretValue
32+
Properties:
33+
SecretString: !Sub
34+
- '{"username": "${user}", "password": "${password}"}'
35+
- user: !Ref UserName
36+
password: !Ref Password::Plaintext
37+
38+
- Function: MyFunction
39+
Memory: 1769
40+
Timeout: 30
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Amazon.SecretsManager;
4+
using Amazon.SecretsManager.Model;
5+
using LambdaSharp;
6+
7+
namespace Test.TestModule.MyFunction {
8+
9+
public class FunctionRequest { }
10+
public class FunctionResponse { }
11+
12+
public sealed class Function : ALambdaFunction<FunctionRequest, FunctionResponse> {
13+
14+
//--- Fields ---
15+
private string _secretArn;
16+
private IAmazonSecretsManager _secretManagerClient;
17+
18+
//--- Constructors ---
19+
public Function() : base(new LambdaSharp.Serialization.LambdaSystemTextJsonSerializer()) { }
20+
21+
//--- Methods ---
22+
public override async Task InitializeAsync(LambdaConfig config) {
23+
24+
// read configuration settings
25+
_secretArn = config.ReadText("CredentialsSecret");
26+
27+
// create clients
28+
_secretManagerClient = new AmazonSecretsManagerClient();
29+
}
30+
31+
public override async Task<FunctionResponse> ProcessMessageAsync(FunctionRequest request) {
32+
LogInfo("retrieving secret");
33+
var secret = await _secretManagerClient.GetSecretValueAsync(new GetSecretValueRequest {
34+
SecretId = _secretArn
35+
});
36+
LogInfo($"Received: {secret.SecretString}");
37+
return new FunctionResponse();
38+
}
39+
}
40+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<Deterministic>true</Deterministic>
5+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
6+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
7+
<RootNamespace>Test.TestModule.MyFunction</RootNamespace>
8+
<NoWarn>CS1998</NoWarn>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<PackageReference Include="AWSSDK.SecretsManager" Version="3.7.0.26"/>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<PackageReference Condition="'$(LAMBDASHARP)'==''" Include="LambdaSharp" Version="0.8.3.*"/>
15+
<ProjectReference Condition="'$(LAMBDASHARP)'!=''" Include="$(LAMBDASHARP)\src\LambdaSharp\LambdaSharp.csproj" />
16+
</ItemGroup>
17+
</Project>

Scripts/Set-Lash-Version.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$Env:LAMBDASHARP_VERSION_PREFIX="0.8.3.0"
1+
$Env:LAMBDASHARP_VERSION_PREFIX="0.8.3.1"
22
$Env:LAMBDASHARP_VERSION_SUFFIX=""
33

44
# create full version text

Scripts/run-tests.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ VERSION_PREFIX="1.0.0"
88

99
if [ -z "$1" ]; then
1010

11+
# run all unit tests
1112
for i in `find $LAMBDASHARP/ -name Tests.*.csproj`; do
1213
pushd $(dirname $(realpath $i)) > /dev/null 2>&1
1314
dotnet test --configuration Release
@@ -30,8 +31,17 @@ if [ -z "$1" ]; then
3031
exit $?
3132
fi
3233

33-
# delete only generated output files
34-
find $LAMBDASHARP/Tests/Modules/ -maxdepth 1 -name *.yml | xargs -l basename | sed 's/.yml/.json/' | xargs -I{} rm $LAMBDASHARP/Tests/Modules/Results/{} > /dev/null 2>&1
34+
# evaluate module parameters for each test file
35+
find $LAMBDASHARP/Tests/ParameterFiles/ -maxdepth 1 -name *.yml \
36+
| xargs -L 1 dotnet $LAMBDASHARP/src/LambdaSharp.Tool/bin/Debug/net5.0/LambdaSharp.Tool.dll util show-parameters --quiet
37+
38+
# delete generated output CloudFormation template files
39+
find $LAMBDASHARP/Tests/Modules/ -maxdepth 1 -name *.yml \
40+
| xargs -l basename \
41+
| sed 's/.yml/.json/' \
42+
| xargs -I{} rm $LAMBDASHARP/Tests/Modules/Results/{} > /dev/null 2>&1
43+
44+
# generate CloudFormation template for each test module
3545
dotnet $LAMBDASHARP/src/LambdaSharp.Tool/bin/Debug/net5.0/LambdaSharp.Tool.dll deploy \
3646
--verbose:exceptions \
3747
--no-beep \

Scripts/set-lash-version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
export LAMBDASHARP_VERSION_PREFIX=0.8.3.0
3+
export LAMBDASHARP_VERSION_PREFIX=0.8.3.1
44
export LAMBDASHARP_VERSION_SUFFIX=
55

66
# create full version text

Tests/Modules/Results/Condition-Function.json

Lines changed: 47 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"DeploymentChecksum": {
7171
"Type": "String",
7272
"Description": "Deployment Checksum",
73-
"Default": "1FD28946648756B786C43EC7E67C1AD9"
73+
"Default": "98539D2D986EA6FDAB667412AA63ADD1"
7474
}
7575
},
7676
"Resources": {
@@ -197,17 +197,6 @@
197197
"Ref": "AWS::NoValue"
198198
}
199199
]
200-
},
201-
"STR_MODULE_ROLE_SECRETSPOLICY": {
202-
"Fn::If": [
203-
"ModuleRoleSecretsPolicyCondition",
204-
{
205-
"Ref": "ModuleRoleSecretsPolicy"
206-
},
207-
{
208-
"Ref": "AWS::NoValue"
209-
}
210-
]
211200
}
212201
}
213202
},
@@ -263,6 +252,39 @@
263252
"PolicyDocument": {
264253
"Version": "2012-10-17",
265254
"Statement": [
255+
{
256+
"Sid": "DeploymentSecrets",
257+
"Effect": "Allow",
258+
"Action": [
259+
"kms:Decrypt",
260+
"kms:Encrypt"
261+
],
262+
"Resource": {
263+
"Fn::If": [
264+
"SecretsHasValue",
265+
{
266+
"Fn::Split": [
267+
",",
268+
{
269+
"Ref": "Secrets"
270+
}
271+
]
272+
},
273+
{
274+
"Ref": "AWS::NoValue"
275+
}
276+
]
277+
},
278+
"NotResource": {
279+
"Fn::If": [
280+
"SecretsHasValue",
281+
{
282+
"Ref": "AWS::NoValue"
283+
},
284+
"*"
285+
]
286+
}
287+
},
266288
{
267289
"Sid": "LogStream",
268290
"Effect": "Allow",
@@ -387,41 +409,6 @@
387409
]
388410
}
389411
},
390-
"ModuleRoleSecretsPolicy": {
391-
"Type": "AWS::IAM::Policy",
392-
"Condition": "ModuleRoleSecretsPolicyCondition",
393-
"Properties": {
394-
"PolicyDocument": {
395-
"Version": "2012-10-17",
396-
"Statement": [
397-
{
398-
"Sid": "Secrets",
399-
"Effect": "Allow",
400-
"Action": [
401-
"kms:Decrypt",
402-
"kms:Encrypt"
403-
],
404-
"Resource": {
405-
"Fn::Split": [
406-
",",
407-
{
408-
"Ref": "Secrets"
409-
}
410-
]
411-
}
412-
}
413-
]
414-
},
415-
"PolicyName": {
416-
"Fn::Sub": "${AWS::StackName}ModuleRoleSecrets"
417-
},
418-
"Roles": [
419-
{
420-
"Ref": "ModuleRole"
421-
}
422-
]
423-
}
424-
},
425412
"ModuleRegistration": {
426413
"Type": "Custom::LambdaSharpRegistrationModule",
427414
"Condition": "UseCoreServices",
@@ -592,6 +579,18 @@
592579
"value"
593580
]
594581
},
582+
"SecretsHasValue": {
583+
"Fn::Not": [
584+
{
585+
"Fn::Equals": [
586+
{
587+
"Ref": "Secrets"
588+
},
589+
""
590+
]
591+
}
592+
]
593+
},
595594
"XRayIsEnabled": {
596595
"Fn::Not": [
597596
{
@@ -714,18 +713,6 @@
714713
}
715714
]
716715
},
717-
"ModuleRoleSecretsPolicyCondition": {
718-
"Fn::Not": [
719-
{
720-
"Fn::Equals": [
721-
{
722-
"Ref": "Secrets"
723-
},
724-
""
725-
]
726-
}
727-
]
728-
},
729716
"FunctionRegistrationCondition": {
730717
"Fn::And": [
731718
{
@@ -831,7 +818,7 @@
831818
"Version": "2019-07-04",
832819
"Module": "Test.TestModule:1.0-DEV",
833820
"Description": "LambdaSharp CloudFormation Test",
834-
"TemplateChecksum": "1FD28946648756B786C43EC7E67C1AD9",
821+
"TemplateChecksum": "98539D2D986EA6FDAB667412AA63ADD1",
835822
"Date": "2019-08-09T15:00:00Z",
836823
"CoreServicesVersion": "1",
837824
"ParameterSections": [
@@ -924,7 +911,6 @@
924911
"FunctionLogGroup": "Function::LogGroup",
925912
"ModuleRole": "Module::Role",
926913
"ModuleRoleDeadLetterQueuePolicy": "Module::Role::DeadLetterQueuePolicy",
927-
"ModuleRoleSecretsPolicy": "Module::Role::SecretsPolicy",
928914
"ModuleRegistration": "Module::Registration",
929915
"FunctionRegistration": "Function::Registration",
930916
"FunctionLogGroupSubscription": "Function::LogGroupSubscription"

0 commit comments

Comments
 (0)