|
98 | 98 | "ConstraintDescription": "this token must be generated from the git server/provider" |
99 | 99 | }, |
100 | 100 | "OauthKey": { |
101 | | - "Description": "zipdl method only. OAuth2 Key needed for BitBucket", |
| 101 | + "Description": "zipdl method only. OAuth2 Key needed for BitBucket. For bitbucket server this should be a username.", |
102 | 102 | "Type": "String", |
103 | 103 | "Default": "", |
104 | 104 | "ConstraintDescription": "this key must be generated from the git server/provider" |
105 | 105 | }, |
106 | 106 | "OauthSecret": { |
107 | 107 | "NoEcho": "true", |
108 | | - "Description": "zipdl method only. OAuth2 Secret needed for BitBucket", |
| 108 | + "Description": "zipdl method only. OAuth2 Secret needed for BitBucket. For bitbucket server this should be a password.", |
109 | 109 | "Type": "String", |
110 | 110 | "Default": "", |
111 | 111 | "ConstraintDescription": "this secret must be generated from the git server/provider" |
|
128 | 128 | "Default": "quickstart-git2s3/", |
129 | 129 | "Description": "S3 key prefix for the Quick Start assets. Quick Start key prefix can include numbers, lowercase letters, uppercase letters, hyphens (-), and forward slash (/).", |
130 | 130 | "Type": "String" |
| 131 | + }, |
| 132 | + "VPCId": { |
| 133 | + "Description": "Id of the VPC the DL Zip lambda should run in", |
| 134 | + "Type": "AWS::EC2::VPC::Id", |
| 135 | + "Default": "" |
| 136 | + }, |
| 137 | + "VPCCidrRange": { |
| 138 | + "Description": "CIDR range of the VPC", |
| 139 | + "Type": "String", |
| 140 | + "Default": "" |
| 141 | + }, |
| 142 | + "SubnetIds": { |
| 143 | + "Description": "SubnetIds the DL Zip lambda should run in", |
| 144 | + "Type": "List<AWS::EC2::Subnet::Id>", |
| 145 | + "Default": "" |
| 146 | + }, |
| 147 | + "ScmHostnameOverride": { |
| 148 | + "Description": "Hostname to override the incoming json request with", |
| 149 | + "Type": "String", |
| 150 | + "Default": "" |
131 | 151 | } |
132 | 152 | }, |
133 | 153 | "Conditions": { |
|
214 | 234 | ] |
215 | 235 | } |
216 | 236 | ] |
| 237 | + }, |
| 238 | + "ShouldRunInVPC":{ |
| 239 | + "Fn::Not": [{ |
| 240 | + "Fn::Equals": [{"Ref": "VPCId"}, ""] |
| 241 | + }] |
217 | 242 | } |
218 | 243 | }, |
219 | 244 | "Resources": { |
|
906 | 931 | "Runtime": "python2.7", |
907 | 932 | "Timeout": "300", |
908 | 933 | "Environment": { |
909 | | - "Variables": |
| 934 | + "Variables": |
910 | 935 | { "ExcludeGit":"True" } |
911 | 936 | }, |
912 | 937 | "Code": { |
|
922 | 947 | "ZipDlRole": { |
923 | 948 | "Type": "AWS::IAM::Role", |
924 | 949 | "Properties": { |
| 950 | + "ManagedPolicyArns": [ "arn:aws:iam::aws:policy/service-role/AWSLambdaENIManagementAccess" ], |
925 | 951 | "AssumeRolePolicyDocument": { |
926 | 952 | "Statement": [ |
927 | 953 | { |
|
991 | 1017 | ] |
992 | 1018 | } |
993 | 1019 | }, |
| 1020 | + "ZipDlLambdaSecurityGroup": { |
| 1021 | + "Type": "AWS::EC2::SecurityGroup", |
| 1022 | + "Properties": { |
| 1023 | + "GroupDescription": "Security Group to allow the lambda to access the git service", |
| 1024 | + "GroupName": "ZipDlLambdaSecurityGroup", |
| 1025 | + "SecurityGroupEgress": [ { |
| 1026 | + "CidrIp": {"Ref": "VPCCidrRange"}, |
| 1027 | + "FromPort": -1, |
| 1028 | + "IpProtocol": 'tcp', |
| 1029 | + "ToPort": -1 |
| 1030 | + } ], |
| 1031 | + "SecurityGroupIngress": [ { |
| 1032 | + "CidrIp": {"Ref": "VPCCidrRange"}, |
| 1033 | + "FromPort": -1, |
| 1034 | + "IpProtocol": 'tcp', |
| 1035 | + "ToPort": -1 |
| 1036 | + } ], |
| 1037 | + "VpcId": {"Ref": "VPCId"} |
| 1038 | + } |
| 1039 | + }, |
994 | 1040 | "ZipDlLambda": { |
995 | | - "DependsOn": "CopyZips", |
| 1041 | + "DependsOn": "CopyZips", |
996 | 1042 | "Type": "AWS::Lambda::Function", |
997 | 1043 | "Properties": { |
998 | 1044 | "Handler": "lambda_function.lambda_handler", |
|
1012 | 1058 | }, |
1013 | 1059 | "Runtime": "python2.7", |
1014 | 1060 | "MemorySize": 128, |
1015 | | - "Timeout": 30 |
| 1061 | + "Timeout": 30, |
| 1062 | + "VpcConfig": { |
| 1063 | + "Fn::If": [ |
| 1064 | + "ShouldRunInVPC", |
| 1065 | + { |
| 1066 | + "SecurityGroupIds": [ |
| 1067 | + { "Ref" : "ZipDlLambdaSecurityGroup"} |
| 1068 | + ], |
| 1069 | + "SubnetIds": { "Ref" : "SubnetIds"}, |
| 1070 | + }, |
| 1071 | + { |
| 1072 | + "Ref": "AWS::NoValue" |
| 1073 | + } |
| 1074 | + ] |
| 1075 | + }, |
| 1076 | + "Environment": { |
| 1077 | + "Variables": { "SCM_HOSTNAME_OVERRIDE": {"Ref": "ScmHostnameOverride" }} |
| 1078 | + } |
1016 | 1079 | } |
1017 | 1080 | }, |
1018 | 1081 | "WebHookRole": { |
|
0 commit comments