diff --git a/moto/elbv2/models.py b/moto/elbv2/models.py index 71abaf110..7b8cd3571 100644 --- a/moto/elbv2/models.py +++ b/moto/elbv2/models.py @@ -430,7 +430,7 @@ class ELBv2Backend(BaseBackend): if target_group.name == name: raise DuplicateTargetGroupName() - if FakeTargetGroup.HTTP_CODE_REGEX.match(kwargs['http_codes']) is None: + if FakeTargetGroup.HTTP_CODE_REGEX.match(kwargs['matcher']['HttpCode']) is None: raise RESTError('InvalidParameterValue', 'HttpCode must be like 200 | 200-399 | 200,201 ...') arn = "arn:aws:elasticloadbalancing:%s:1:targetgroup/%s/50dc6c495c0c9188" % (self.region_name, name) @@ -760,7 +760,7 @@ class ELBv2Backend(BaseBackend): raise RESTError('InvalidParameterValue', 'HttpCode must be like 200 | 200-399 | 200,201 ...') if http_codes is not None: - target_group.http_status_codes = http_codes + target_group.matcher['HttpCode'] = http_codes if health_check_interval is not None: target_group.healthcheck_interval_seconds = health_check_interval if health_check_path is not None: diff --git a/moto/elbv2/responses.py b/moto/elbv2/responses.py index 9a189b1c9..aa855b430 100644 --- a/moto/elbv2/responses.py +++ b/moto/elbv2/responses.py @@ -201,7 +201,7 @@ class ELBV2Response(BaseResponse): healthcheck_timeout_seconds=healthcheck_timeout_seconds, healthy_threshold_count=healthy_threshold_count, unhealthy_threshold_count=unhealthy_threshold_count, - http_codes=http_codes + matcher={'HttpCode': http_codes} ) template = self.response_template(CREATE_TARGET_GROUP_TEMPLATE)