-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Error: Only one of field, host_header, http_header, http_request_method, path_pattern, query_string or source_ip can be set in a condition block #11323
Comments
I don't think it's just the old syntax that's broken - I'm getting the same error on a rule that has the following condition blocks outlined: condition {
path_pattern {
values = ["/examplepath"]
}
}
condition {
http_header {
http_header_name = "x-example-name"
values = ["somevalue*"]
}
}
|
Running into the same thing, I was able to reproduce using the following steps:
Basically it looks like making any changes to an already applied resource Workaround: |
Oh good pickup @KiNgMaR - in the example I posted, I was making two updates to the resource
It appears that perhaps the conflict is coming from trying to add the 'new-syntax' path_pattern rule before removing the 'old-syntax' rule. Tainting the resource (or manually removing the rule) before deploying resolves this issue, but it would be better if it could happen without intervention! |
Looks like a regression, it's not possible to update aws_lb_listener_rule resources in place, tainting works but that's not really a solution. State file contents show both old and new condition formats on newly created rules with provider.aws v2.42.0 (This PR https://github.com/terraform-providers/terraform-provider-aws/pull/8268/files)
Where I only have the following defined in my terraform resource
|
Damn. Sorry. The test suite doesn't have a test for performing in-place updates so this was missed. It's a feature of the backwards compatibility in both the module and AWS API. The API returns the field and values in both places in the API for the two old field types. Which then the terraform stores. When doing an update, terraform provides all the existing state merged with changes as that makes sense for "computed" values. Otherwise a lot of things wouldn't work. Except here it triggers the error code |
Also hitting this bug when making changes to existing resources. Same versions as the report. |
New condition rule logic breaks when one a condition is present but *not* being updated. Includes single condition when the action is being modified. User is presented with: Error: Only one of field, host_header, http_header, http_request_method, path_pattern, query_string or source_ip can be set in a condition block
We have a listener(ALB) with context paths and target groups in our terraform code, attaching existing target groups to new context paths or changing the order of the existing context path listener rules for the attached target groups in the code seems to produce this error for us.(since 13.12.19).
The workaround we used was to use terraform aws provider version 2.41.0 |
#11364) * Add some update tests. Issue #11323 New condition rule logic breaks when one a condition is present but *not* being updated. Includes single condition when the action is being modified. User is presented with: Error: Only one of field, host_header, http_header, http_request_method, path_pattern, query_string or source_ip can be set in a condition block * Handle rule updates when Condition not modified Fixes #11323 Fixes #11362 Output from acceptance testing: ``` --- PASS: TestAccAWSLBListenerRule_conditionHttpHeader_invalid (3.89s) --- PASS: TestAccAWSLBListenerRule_multipleConditionThrowsError (4.41s) --- PASS: TestAccAWSLBListenerRule_conditionAttributesCount (28.37s) --- PASS: TestAccAWSLBListenerRule_fixedResponse (175.92s) --- PASS: TestAccAWSLBListenerRule_basic (180.33s) --- PASS: TestAccAWSLBListenerRule_conditionHttpHeader (180.49s) --- PASS: TestAccAWSLBListenerRule_conditionHttpRequestMethod (185.53s) --- PASS: TestAccAWSLBListenerRule_conditionHostHeader (187.50s) --- PASS: TestAccAWSLBListenerRule_cognito (190.30s) --- PASS: TestAccAWSLBListenerRule_updateRulePriority (196.64s) --- PASS: TestAccAWSLBListenerRule_conditionPathPattern_deprecated (202.36s) --- PASS: TestAccAWSLBListenerRule_conditionPathPattern (209.18s) --- PASS: TestAccAWSLBListenerRule_Action_Order (210.40s) --- PASS: TestAccAWSLBListenerRule_conditionHostHeader_deprecated (215.83s) --- PASS: TestAccAWSLBListenerRule_updateFixedResponse (221.31s) --- PASS: TestAccAWSLBListenerRule_redirect (225.96s) --- PASS: TestAccAWSLBListenerRule_oidc (226.93s) --- PASS: TestAccAWSLBListenerRule_conditionQueryString (208.73s) --- PASS: TestAccAWSLBListenerRule_conditionUpdatePathPattern_deprecated (240.20s) --- PASS: TestAccAWSLBListenerRule_changeListenerRuleArnForcesNew (253.40s) --- PASS: TestAccAWSLBListenerRuleBackwardsCompatibility (260.08s) --- PASS: TestAccAWSLBListenerRule_Action_Order_Recreates (261.67s) --- PASS: TestAccAWSLBListenerRule_priority (280.50s) --- PASS: TestAccAWSLBListenerRule_conditionUpdateMultiple (177.25s) --- PASS: TestAccAWSLBListenerRule_conditionMultiple (190.69s) --- PASS: TestAccAWSLBListenerRule_conditionUpdateMixed (198.27s) --- PASS: TestAccAWSLBListenerRule_conditionSourceIp (208.93s) ```
The fix for this issue has been merged and will release with version 2.43.0 of the Terraform AWS Provider, later today. Thanks to @dpiddockcmp for the help fixing this. 👍 |
This has been released in version 2.43.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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! |
I think after merging #8268 existing (now deprecated)
condition
blocks are broken.Community Note
Terraform Version
Affected Resource(s)
aws_alb_listener_rule
Terraform Configuration Files
Expected Behavior
When
message_body
is edited and thus we try to apply following plan:we should update the listener rule correctly.
Actual behavior
An error occurs:
Additional information
Changing to not-deprecated version:
does not help.
The text was updated successfully, but these errors were encountered: