This repository has been archived by the owner on Jul 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserverless.yaml
94 lines (84 loc) · 2.28 KB
/
serverless.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# serverless.yml
service: cfn-tools
provider:
name: aws
stage: prod
region: eu-west-1
profile: ${env:AWS_DEFAULT_PROFILE}
deploymentBucket: ${env:S3_DEPLOYMENT_BUCKET}
stackTags: # Optional CF stack tags
Owner: support@cloudreach.com
KillDate: never
Environment: PROD
environment:
KMS_KEY: alias/ec2stash
iamRoleStatements: # permissions for all of your functions can be set here
- Effect: Allow
Action:
- "ssm:DescribeParameters"
- "ssm:GetParameters"
- "kms:Decrypt"
Resource: "*"
functions:
secretstore:
handler: cfn-secretstore.lambda_handler
name: secretstore
description: CFN secretstore Helper
runtime: python2.7
memorySize: "256"
timeout: 300
tags: # Optional CF stack tags
Owner: support@cloudreach.com
KillDate: never
package:
exclude:
- ./**
include:
- cfn-secretstore.py
resources:
Description: "AWS Lambda Function: CfnSecretStore"
Resources:
KMSKey:
Type: "AWS::KMS::Key"
Properties:
Description: ${self:provider.environment.KMS_KEY}
Enabled: True
KeyPolicy:
Version: "2012-10-17"
Id: "ec2stash"
Statement:
-
Sid: "Allow Lambda role to use the key"
Effect: "Allow"
Principal:
AWS:
Fn::Join: ["", [ "arn:aws:iam::" , { "Ref": "AWS::AccountId" } , ":root" ] ]
Action:
- "kms:*"
Resource: "*"
KeyAlias:
Type: AWS::KMS::Alias
Properties:
AliasName: ${self:provider.environment.KMS_KEY}
TargetKeyId:
Ref: KMSKey
ExampleParameter:
Type: "AWS::SSM::Parameter"
Properties:
Name: "example.secretstore"
Type: "String"
Value: "ssm parameter automatic created from lambda-cfn-secretstore"
Description: "Parameter Example"
Outputs:
LambdaArn:
Description: CFN SSM parameter store
Value:
Fn::GetAtt: [ SecretstoreLambdaFunction, Arn ]
Export:
Name: CfnSecretStore
KMSKey:
Description: CFN KMS Key used for encrypt parameter store
Value:
Fn::GetAtt: [ KMSKey, Arn ]
Export:
Name: CfnSecretStoreKMSKey