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

resource/lb_listener_rule: update maximum priority value to 50000 #3379

Merged
merged 3 commits into from
Feb 16, 2018

Conversation

loivis
Copy link
Contributor

@loivis loivis commented Feb 14, 2018

update according to the latest document:
https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateRule.html

Valid Range: Minimum value of 1. Maximum value of 50000.

@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label Feb 14, 2018
@loivis loivis force-pushed the lb-listener-rule-maximum-priority branch from 8a3097d to 04b2681 Compare February 14, 2018 20:20
@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label Feb 14, 2018
@bflad
Copy link
Contributor

bflad commented Feb 14, 2018

This is a great catch! 😄 Do you mind simplifying this even further by removing the custom function and switching it to ValidateFunc: validateIntegerInRange(1, 50000)? Thanks!

@bflad bflad added the service/elbv2 Issues and PRs that pertain to the elbv2 service. label Feb 14, 2018
@bflad bflad added this to the v1.10.0 milestone Feb 14, 2018
@ghost ghost added size/S Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Feb 15, 2018
@loivis
Copy link
Contributor Author

loivis commented Feb 15, 2018

@bflad change applied and pushed.

@@ -154,7 +154,7 @@ func resourceAwsLbListenerRuleRead(d *schema.ResourceData, meta interface{}) err

// Rules are evaluated in priority order, from the lowest value to the highest value. The default rule has the lowest priority.
if *rule.Priority == "default" {
d.Set("priority", 99999)
d.Set("priority", 50000)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 In thinking about this a lot more, I think this will actually be a breaking change for anyone who managed to import a listener default rule (then set priority = 99999 in their configuration to match). We would need to migrate their state and note the "breaking" change.

That said, I just verified its technically possible to have a default priority rule and a 50000 priority rule, so changing default rules to 50000 could also be confusing as its also "incorrect". 🤷‍♂️

Maybe the most correct answer here is changing the attribute to type string and accepting default priority, but only for import. Or having a separate, special aws_lb_listener_default_rule resource (the API does error if you try to delete default rules). This is all turning into a lot of work though 😓 .

I'm not sure how you'd want to proceed but the quick way to fix the actual validation except default rules is to leave default rules set to 99999 and go back to the custom validation function where it allows 99999 along with the correct priority range of 1 through 50000. 🤕

@loivis
Copy link
Contributor Author

loivis commented Feb 15, 2018

Indeed it's a minor change in code but breaking change for user. I didn't realize the impact on imported resources as I never deal with default rule. I think the approach you mentioned is best for now. It's not necessary to change priority for default.

@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Feb 15, 2018
@bflad
Copy link
Contributor

bflad commented Feb 15, 2018

😅 From my comment earlier today, you'll also need to go back to the old custom validateAwsLbListenerRulePriority function and allow 99999 as a valid configuration. Sorry for the back and forth due to how this was implemented before we started trying to change it.

@loivis
Copy link
Contributor Author

loivis commented Feb 16, 2018

Ah, I think I get your point this time:smirk:. I wasn't thinking enough and lack of experiences on handling such scenarios.

@loivis loivis force-pushed the lb-listener-rule-maximum-priority branch from e286296 to 57acdcb Compare February 16, 2018 14:30
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Feb 16, 2018
@loivis loivis force-pushed the lb-listener-rule-maximum-priority branch from 57acdcb to 7d51f3a Compare February 16, 2018 14:35
@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label Feb 16, 2018
@loivis loivis force-pushed the lb-listener-rule-maximum-priority branch from 7d51f3a to 8e33671 Compare February 16, 2018 14:37
@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label Feb 16, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks again for finding this. 🚀

@bflad bflad merged commit dfe9d7a into hashicorp:master Feb 16, 2018
bflad added a commit that referenced this pull request Feb 16, 2018
@loivis loivis deleted the lb-listener-rule-maximum-priority branch February 18, 2018 18:49
@bflad
Copy link
Contributor

bflad commented Feb 27, 2018

This has been released in version 1.10.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 7, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/elbv2 Issues and PRs that pertain to the elbv2 service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants