forked from aws-samples/aws-serverless-samfarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yaml
65 lines (65 loc) · 2.42 KB
/
main.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
AWSTemplateFormatVersion: "2010-09-09"
Description: "Main template for a CI/CD Serverless application."
Parameters:
AppName:
Type: String
Description: Name of the application.
MinLength: "1"
MaxLength: "80"
AllowedPattern: "[A-Za-z0-9-]+"
ConstraintDescription: Malformed input parameter. AppName must only contain upper and lower case letters, numbers, and -.
SAMInputFile:
Type: String
Description: The filename for the SAM file.
Default: saml.yaml
SAMOutputFile:
Type: String
Description: The filename for the output SAM file from the buildspec file.
Default: post-saml.yaml
StagingFile:
Type: String
Description: The cloudformation staging file. Leave empty if no staging file is needed.
Default: beta.json
CodeBuildImage:
Type: String
Default: "aws/codebuild/nodejs:7.0.0"
Description: Image used for CodeBuild project.
GitHubRepoName:
Type: String
Description: The GitHub repo name
GitHubRepoBranch:
Type: String
Description: The GitHub repo branch code pipelines should watch for changes on
Default: master
GitHubUser:
Type: String
Description: GitHub UserName. This username must have access to the GitHubToken.
GitHubToken:
NoEcho: true
Type: String
Description: "Secret. OAuthToken with access to Repo. Long string of characters and digits. Go to https://github.com/settings/tokens"
Resources:
ServerlessRoles:
Type: "AWS::CloudFormation::Stack"
Properties:
Parameters:
AppName: !Ref AppName
TemplateURL: "https://awscomputeblogimages.s3-us-west-2.amazonaws.com/samfarm-pipeline-roles.yaml"
ServerlessPipeline:
Type: "AWS::CloudFormation::Stack"
DependsOn: [ServerlessRoles]
Properties:
Parameters:
AppName: !Ref AppName
SAMInputFile: !Ref SAMInputFile
SAMOutputFile: !Ref SAMOutputFile
StagingFile: !Ref StagingFile
CodeBuildImage: !Ref CodeBuildImage
GitHubRepoName: !Ref GitHubRepoName
GitHubRepoBranch: !Ref GitHubRepoBranch
GitHubUser: !Ref GitHubUser
GitHubToken: !Ref GitHubToken
CodePipelineRole: !GetAtt ServerlessRoles.Outputs.CodePipelineRole
CloudformationRole: !GetAtt ServerlessRoles.Outputs.CloudformationDeployRole
CodeBuildRole: !GetAtt ServerlessRoles.Outputs.CodeBuildRole
TemplateURL: "https://awscomputeblogimages.s3-us-west-2.amazonaws.com/samfarm-pipeline.yaml"