Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(elasticloadbalancingv2): Incorrect validation on NetworkLoadBalancer.configureHealthCheck() #16446

Closed
ryparker opened this issue Sep 9, 2021 · 3 comments · Fixed by #16445
Closed
Assignees
Labels
@aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@ryparker
Copy link
Contributor

ryparker commented Sep 9, 2021

The NetworkLoadBalancer's configureHealthCheck() method is incorrectly throwing a validation error when provided a valid protocol and the same value for both interval and timeout.

Error: Healthcheck interval 10 seconds must be greater than the timeout 10 seconds

This rule only applies to Application Load Balancers and not Network Load Balancers.

Reproduction Steps

const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack');
const vpc = new ec2.Vpc(stack, 'VPC', {});


new elbv2.NetworkTargetGroup(stack, 'TargetGroup', {
  vpc,
  port: 80,
  healthCheck: {
    interval: cdk.Duration.seconds(10),
    timeout: cdk.Duration.seconds(10),
    protocol: protocol,
  },
});

What did you expect to happen?

No validation errors.

What actually happened?

Error: Healthcheck interval 10 seconds must be greater than the timeout 10 seconds

Environment

  • CDK CLI Version : 1.121.0 (build 026cb8f)
  • Framework Version:
  • Node.js Version: v16.6.2
  • OS : Mac
  • Language (Version): TypeScript

Other

Fixed in PR: #16445


This is 🐛 Bug Report

@ryparker ryparker added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. @aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 labels Sep 9, 2021
@ryparker ryparker added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Sep 9, 2021
@ryparker
Copy link
Contributor Author

ryparker commented Sep 9, 2021

Related SIM ticket: V427669955

@ryparker
Copy link
Contributor Author

ryparker commented Sep 9, 2021

PR open: #16445

@ryparker ryparker assigned ryparker and unassigned njlynch Sep 9, 2021
@mergify mergify bot closed this as completed in #16445 Sep 29, 2021
mergify bot pushed a commit that referenced this issue Sep 29, 2021
…ncer.configureHealthCheck()` (#16445)

## Summary

The [`NetworkLoadBalancer`'s](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.NetworkLoadBalancer.html) [`configureHealthCheck()`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.ApplicationTargetGroup.html#configurewbrhealthwbrcheckhealthcheck) method is incorrectly throwing a validation error when provided a valid `protocol` and the same value for both `interval` and `timeout`. 

```sh
Error: Healthcheck interval 10 seconds must be greater than the timeout 10 seconds
```

This rule only applies to Application Load Balancers and not Network Load Balancers.

This PR:

- Moves the mentioned validation logic from the `BaseTargetGroup` class to the `ApplicationTargetGroup` class.
- Adds tests that check a validation error is thrown when **invalid** `protocol`, `interval`, `timeout`, & `path` combinations are provided for the respected TargetGroup type.
- Adds tests that check a validation error is **not** thrown when **valid** `protocol`, `interval`, `timeout`, & `path` combinations are provided for the respected TargetGroup type.

Provides fix for SIM ticket: V427669955
Fixes issue: #16446

Refs:
- [The mentioned validation logic was implemented by this PR.](#16107)
- [CreateTargetGroup CloudFormation docs](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html)
- [Application Load Balancer's Health check configuration docs](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html)
- [Network Load Balancer's Health check configuration docs](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-health-checks.html)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Feb 21, 2022
…ncer.configureHealthCheck()` (aws#16445)

## Summary

The [`NetworkLoadBalancer`'s](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.NetworkLoadBalancer.html) [`configureHealthCheck()`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-elasticloadbalancingv2.ApplicationTargetGroup.html#configurewbrhealthwbrcheckhealthcheck) method is incorrectly throwing a validation error when provided a valid `protocol` and the same value for both `interval` and `timeout`. 

```sh
Error: Healthcheck interval 10 seconds must be greater than the timeout 10 seconds
```

This rule only applies to Application Load Balancers and not Network Load Balancers.

This PR:

- Moves the mentioned validation logic from the `BaseTargetGroup` class to the `ApplicationTargetGroup` class.
- Adds tests that check a validation error is thrown when **invalid** `protocol`, `interval`, `timeout`, & `path` combinations are provided for the respected TargetGroup type.
- Adds tests that check a validation error is **not** thrown when **valid** `protocol`, `interval`, `timeout`, & `path` combinations are provided for the respected TargetGroup type.

Provides fix for SIM ticket: V427669955
Fixes issue: aws#16446

Refs:
- [The mentioned validation logic was implemented by this PR.](aws#16107)
- [CreateTargetGroup CloudFormation docs](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html)
- [Application Load Balancer's Health check configuration docs](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html)
- [Network Load Balancer's Health check configuration docs](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-health-checks.html)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-elasticloadbalancingv2 Related to Amazon Elastic Load Balancing V2 bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
2 participants