@@ -26,8 +26,7 @@ export interface EcsDeploymentGroupProps {
26
26
testTrafficListenerArn : string ;
27
27
terminationWaitTimeInMinutes : number ;
28
28
autoRollbackOnEvents ?: RollbackEvent [ ] ;
29
- existsDeploymentConfigName ?: string ;
30
- createDeploymentConfigInput ?: CodeDeploy . CreateDeploymentConfigInput ;
29
+ deploymentConfigName ?: string ;
31
30
}
32
31
33
32
const codeDeploy = new CodeDeploy ( ) ;
@@ -47,8 +46,7 @@ const getProperties = (
47
46
testTrafficListenerArn : props . TestTrafficListenerArn ,
48
47
terminationWaitTimeInMinutes : props . TerminationWaitTimeInMinutes ,
49
48
autoRollbackOnEvents : props . AutoRollbackOnEvents ,
50
- existsDeploymentConfigName : props . ExistsDeploymentConfigName ,
51
- createDeploymentConfigInput : props . CreateDeploymentConfigInput ,
49
+ deploymentConfigName : props . DeploymentConfigName ,
52
50
} ) ;
53
51
54
52
const onCreate = async ( event : CloudFormationCustomResourceCreateEvent ) : Promise < HandlerReturn > => {
@@ -62,14 +60,9 @@ const onCreate = async (event: CloudFormationCustomResourceCreateEvent): Promise
62
60
testTrafficListenerArn,
63
61
terminationWaitTimeInMinutes,
64
62
autoRollbackOnEvents,
65
- existsDeploymentConfigName,
66
- createDeploymentConfigInput,
63
+ deploymentConfigName,
67
64
} = getProperties ( event . ResourceProperties ) ;
68
65
69
- if ( ! existsDeploymentConfigName && createDeploymentConfigInput ) {
70
- await codeDeploy . createDeploymentConfig ( createDeploymentConfigInput ) . promise ( ) ;
71
- }
72
-
73
66
await codeDeploy
74
67
. createDeploymentGroup ( {
75
68
applicationName,
@@ -108,7 +101,7 @@ const onCreate = async (event: CloudFormationCustomResourceCreateEvent): Promise
108
101
deploymentType : 'BLUE_GREEN' ,
109
102
deploymentOption : 'WITH_TRAFFIC_CONTROL' ,
110
103
} ,
111
- deploymentConfigName : existsDeploymentConfigName ?? createDeploymentConfigInput ?. deploymentConfigName ,
104
+ deploymentConfigName : deploymentConfigName ?? 'CodeDeployDefault.OneAtATime' ,
112
105
} )
113
106
. promise ( ) ;
114
107
@@ -164,22 +157,14 @@ const onUpdate = async (event: CloudFormationCustomResourceUpdateEvent): Promise
164
157
} ;
165
158
166
159
const onDelete = async ( event : CloudFormationCustomResourceDeleteEvent ) : Promise < void > => {
167
- const { applicationName, deploymentGroupName, existsDeploymentConfigName , createDeploymentConfigInput } = getProperties ( event . ResourceProperties ) ;
160
+ const { applicationName, deploymentGroupName } = getProperties ( event . ResourceProperties ) ;
168
161
169
162
await codeDeploy
170
163
. deleteDeploymentGroup ( {
171
164
applicationName,
172
165
deploymentGroupName,
173
166
} )
174
167
. promise ( ) ;
175
-
176
- if ( ! existsDeploymentConfigName && createDeploymentConfigInput ) {
177
- await codeDeploy
178
- . deleteDeploymentConfig ( {
179
- deploymentConfigName : createDeploymentConfigInput ?. deploymentConfigName ,
180
- } )
181
- . promise ( ) ;
182
- }
183
168
} ;
184
169
185
170
export const handler = async ( event : CloudFormationCustomResourceEvent ) : Promise < HandlerReturn | void > => {
0 commit comments