@@ -29,6 +29,11 @@ export interface ILambdaDeploymentGroup extends cdk.IResource {
29
29
* @attribute
30
30
*/
31
31
readonly deploymentGroupArn : string ;
32
+
33
+ /**
34
+ * The Deployment Configuration this Group uses.
35
+ */
36
+ readonly deploymentConfig : ILambdaDeploymentConfig ;
32
37
}
33
38
34
39
/**
@@ -52,7 +57,7 @@ export interface LambdaDeploymentGroupProps {
52
57
/**
53
58
* The Deployment Configuration this Deployment Group uses.
54
59
*
55
- * @default LambdaDeploymentConfig#AllAtOnce
60
+ * @default LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES
56
61
*/
57
62
readonly deploymentConfig ?: ILambdaDeploymentConfig ;
58
63
@@ -135,6 +140,7 @@ export class LambdaDeploymentGroup extends cdk.Resource implements ILambdaDeploy
135
140
public readonly application : ILambdaApplication ;
136
141
public readonly deploymentGroupName : string ;
137
142
public readonly deploymentGroupArn : string ;
143
+ public readonly deploymentConfig : ILambdaDeploymentConfig ;
138
144
public readonly role : iam . IRole ;
139
145
140
146
private readonly alarms : cloudwatch . IAlarm [ ] ;
@@ -154,12 +160,13 @@ export class LambdaDeploymentGroup extends cdk.Resource implements ILambdaDeploy
154
160
} ) ;
155
161
156
162
this . role . addManagedPolicy ( iam . ManagedPolicy . fromAwsManagedPolicyName ( 'service-role/AWSCodeDeployRoleForLambda' ) ) ;
163
+ this . deploymentConfig = props . deploymentConfig || LambdaDeploymentConfig . CANARY_10PERCENT_5MINUTES ;
157
164
158
165
const resource = new CfnDeploymentGroup ( this , 'Resource' , {
159
166
applicationName : this . application . applicationName ,
160
167
serviceRoleArn : this . role . roleArn ,
161
168
deploymentGroupName : this . physicalName ,
162
- deploymentConfigName : ( props . deploymentConfig || LambdaDeploymentConfig . ALL_AT_ONCE ) . deploymentConfigName ,
169
+ deploymentConfigName : this . deploymentConfig . deploymentConfigName ,
163
170
deploymentStyle : {
164
171
deploymentType : 'BLUE_GREEN' ,
165
172
deploymentOption : 'WITH_TRAFFIC_CONTROL'
@@ -262,17 +269,26 @@ export interface LambdaDeploymentGroupAttributes {
262
269
* that we are referencing.
263
270
*/
264
271
readonly deploymentGroupName : string ;
272
+
273
+ /**
274
+ * The Deployment Configuration this Deployment Group uses.
275
+ *
276
+ * @default LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES
277
+ */
278
+ readonly deploymentConfig ?: ILambdaDeploymentConfig ;
265
279
}
266
280
267
281
class ImportedLambdaDeploymentGroup extends cdk . Resource implements ILambdaDeploymentGroup {
268
282
public readonly application : ILambdaApplication ;
269
283
public readonly deploymentGroupName : string ;
270
284
public readonly deploymentGroupArn : string ;
285
+ public readonly deploymentConfig : ILambdaDeploymentConfig ;
271
286
272
287
constructor ( scope : cdk . Construct , id : string , props : LambdaDeploymentGroupAttributes ) {
273
288
super ( scope , id ) ;
274
289
this . application = props . application ;
275
290
this . deploymentGroupName = props . deploymentGroupName ;
276
291
this . deploymentGroupArn = arnForDeploymentGroup ( props . application . applicationName , props . deploymentGroupName ) ;
292
+ this . deploymentConfig = props . deploymentConfig || LambdaDeploymentConfig . CANARY_10PERCENT_5MINUTES ;
277
293
}
278
294
}
0 commit comments