diff --git a/provider/aws/formation/app.json.tmpl b/provider/aws/formation/app.json.tmpl index a3314f88dd..7ff8ca800b 100644 --- a/provider/aws/formation/app.json.tmpl +++ b/provider/aws/formation/app.json.tmpl @@ -99,6 +99,11 @@ "Default": "200-399,401", "Description": "Specifies the HTTP codes that healthy targets must use when responding to an HTTP health check. You can specify values between 200 and 499, and the default value is \"200-399,401\". You can specify multiple values (for example, \"200,202\") or a range of values (for example, \"200-299\")." }, + "LoadBalancerGrpcSuccessCodes": { + "Type": "String", + "Default": "12", + "Description": "Specifies the GRPC codes that healthy targets must use when responding to an GRPC health check. You can specify values between 200 and 499, and the default value is \"12\". You can specify multiple values (for example, \"12,13\") or a range of values (for example, \"10-99\")." + }, "LogBucket": { "Type": "String", "Default": "" @@ -363,6 +368,7 @@ "Fargate": { "Fn::If": [ "Service{{ upper .Name }}Fargate", "Yes", { "Fn::If": [ "Service{{ upper .Name }}FargateSpot", "Spot", "No" ] } ] }, "LoadBalancerAlgorithm": { "Ref": "LoadBalancerAlgorithm" }, "LoadBalancerSuccessCodes": { "Ref": "LoadBalancerSuccessCodes" }, + "LoadBalancerGrpcSuccessCodes": { "Ref": "LoadBalancerGrpcSuccessCodes" }, "LogDriver": { "Ref": "LogDriver" }, "LogGroup": { "Fn::If": [ "EnableCloudWatch", { "Ref": "LogGroup" }, { "Ref": "AWS::NoValue" } ] }, "InternalDomains": { "Ref": "InternalDomains" }, diff --git a/provider/aws/formation/service.json.tmpl b/provider/aws/formation/service.json.tmpl index ae644a5260..d997524557 100644 --- a/provider/aws/formation/service.json.tmpl +++ b/provider/aws/formation/service.json.tmpl @@ -88,6 +88,11 @@ "Default": "200-399,401", "Description": "Specifies the HTTP codes that healthy targets must use when responding to an HTTP health check. You can specify values between 200 and 499, and the default value is \"200-399,401\". You can specify multiple values (for example, \"200,202\") or a range of values (for example, \"200-299\")." }, + "LoadBalancerGrpcSuccessCodes": { + "Type": "String", + "Default": "12", + "Description": "Specifies the GRPC codes that healthy targets must use when responding to an GRPC health check. You can specify values between 0 and 99, and the default value is \"12\". You can specify multiple values (for example, \"12,13\") or a range of values (for example, \"10-99\")." + }, "LogDriver": { "Default": "CloudWatch", "Description": "Log driver used by the rack and services to send logs. Default to CloudWatch. You must provide the SyslogDestination when setting as Syslog. It disable logs if blank.", @@ -232,9 +237,23 @@ "HealthyThresholdCount": "2", "UnhealthyThresholdCount": "2", "HealthCheckPath": "{{.Health.Path}}", - "Matcher": { "HttpCode": { "Ref": "LoadBalancerSuccessCodes" } }, + "Matcher": { + {{ if or (eq .Port.Scheme "grpc") (eq .Port.Scheme "secure-grpc") }} + "GrpcCode": { "Ref": "LoadBalancerGrpcSuccessCodes" } + {{ else }} + "HttpCode": { "Ref": "LoadBalancerSuccessCodes" } + {{ end }} + }, "Port": "{{.Port.Port}}", + {{ if eq .Port.Scheme "grpc" }} + "Protocol": "HTTP", + "ProtocolVersion": "GRPC", + {{ else if eq .Port.Scheme "secure-grpc" }} + "Protocol": "HTTPS", + "ProtocolVersion": "GRPC", + {{ else }} "Protocol": "{{ upcase .Port.Scheme }}", + {{ end }} "TargetGroupAttributes": [ { "Key": "deregistration_delay.timeout_seconds", "Value": "{{.Drain}}" }, { "Key": "load_balancing.algorithm.type", "Value": { "Ref": "LoadBalancerAlgorithm" } },