Skip to content

Commit

Permalink
[aws_lb_target_group] Allow a blank health check path, for TCP health…
Browse files Browse the repository at this point in the history
… checks

Fixes hashicorp#2978 "Validation forces invalid path for TCP health check" 

Currently the validation forces the health check path to begin with a slash("/"), even when the protocol is TCP, in which case the health check path must be blank. The validation is preventing valid use cases. 

Since this validation can only check the one field on its own, the check is amended to only validate the path begins with a "/" if the path is not blank. Note that when the path is blank, it is not passed to AWS at all (see lines 226-228), so I think this change does not weaken validation.
  • Loading branch information
whereisaaron authored Jan 12, 2018
1 parent 984d50b commit a9cf3e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aws/resource_aws_lb_target_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func validateAwsLbTargetGroupHealthCheckPath(v interface{}, k string) (ws []stri
errors = append(errors, fmt.Errorf(
"%q cannot be longer than 1024 characters: %q", k, value))
}
if !strings.HasPrefix(value, "/") {
if len(value) > 0 && !strings.HasPrefix(value, "/") {
errors = append(errors, fmt.Errorf(
"%q must begin with a '/' character: %q", k, value))
}
Expand Down

0 comments on commit a9cf3e0

Please sign in to comment.