File tree 2 files changed +32
-0
lines changed
packages/@aws-cdk/aws-elasticloadbalancingv2
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,17 @@ export interface BaseTargetGroupProps {
40
40
* @default No health check
41
41
*/
42
42
healthCheck ?: HealthCheck ;
43
+
44
+ /**
45
+ * The type of targets registered to this TargetGroup, either IP or Instance.
46
+ *
47
+ * All targets registered into the group must be of this type. If you
48
+ * register targets to the TargetGroup in the CDK app, the TargetType is
49
+ * determined automatically.
50
+ *
51
+ * @default Determined automatically
52
+ */
53
+ targetType ?: TargetType ;
43
54
}
44
55
45
56
/**
@@ -179,6 +190,7 @@ export abstract class BaseTargetGroup extends cdk.Construct implements ITargetGr
179
190
}
180
191
181
192
this . healthCheck = baseProps . healthCheck || { } ;
193
+ this . targetType = baseProps . targetType ;
182
194
183
195
this . resource = new cloudformation . TargetGroupResource ( this , 'Resource' , {
184
196
targetGroupName : baseProps . targetGroupName ,
Original file line number Diff line number Diff line change @@ -93,6 +93,26 @@ export = {
93
93
test . done ( ) ;
94
94
} ,
95
95
96
+ 'Can configure targetType on TargetGroups' ( test : Test ) {
97
+ // GIVEN
98
+ const stack = new cdk . Stack ( ) ;
99
+ const vpc = new ec2 . VpcNetwork ( stack , 'Stack' ) ;
100
+
101
+ // WHEN
102
+ new elbv2 . ApplicationTargetGroup ( stack , 'TargetGroup' , {
103
+ vpc,
104
+ port : 80 ,
105
+ targetType : elbv2 . TargetType . Ip
106
+ } ) ;
107
+
108
+ // THEN
109
+ expect ( stack ) . to ( haveResource ( 'AWS::ElasticLoadBalancingV2::TargetGroup' , {
110
+ TargetType : 'ip'
111
+ } ) ) ;
112
+
113
+ test . done ( ) ;
114
+ } ,
115
+
96
116
'Can add target groups with and without conditions' ( test : Test ) {
97
117
// GIVEN
98
118
const stack = new cdk . Stack ( ) ;
You can’t perform that action at this time.
0 commit comments