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

aws_alb_listener_rule resource should not be able to accept multiple values in the condition object #12983

Closed
jflammia opened this issue Mar 22, 2017 · 2 comments · Fixed by #13051

Comments

@jflammia
Copy link

Using the aws_alb_listener_rule, the argument 'condition' with field 'path-pattern' is documented as accepting a list for the 'values'. However, AWS does not allow this.

AWS Documentation

Rule Conditions

Each rule condition can have one path pattern. You can create multiple rules, each with a different path pattern, in order to route requests to different target groups based on the URLs in the requests. If the URL in a request matches a path pattern in a listener rule exactly, the request is routed using that rule; otherwise, the request is routed using the default rule.

From my Terraform configuration file:

resource "aws_alb_listener_rule" "jenkins" {
  listener_arn = "${aws_alb_listener.https.arn}"
  priority     = 100

  action {
    type             = "forward"
    target_group_arn = "${module.jenkins.alb_target_group_arn}"
  }

  condition {
    field  = "path-pattern"
    values = ["/jenkins", "/jenkins/*"]
  }
}

resource "aws_alb_listener_rule" "artifactory" {
  listener_arn = "${aws_alb_listener.https.arn}"
  priority     = 101

  action {
    type             = "forward"
    target_group_arn = "${module.artifactory.alb_target_group_arn}"
  }

  condition {
    field  = "path-pattern"
    values = ["/artifactory", "/artifactory/*"]
  }
}

Response after running 'terraform apply':

Error applying plan:

2 error(s) occurred:

* module.utils.aws_alb_listener_rule.artifactory: 1 error(s) occurred:

* aws_alb_listener_rule.artifactory: Error modifying ALB Listener Rule: ValidationError: The 'path-pattern' field contains too many values; the limit is '1'
	status code: 400, request id: 3c1caee3-0f37-11e7-aca5-6ba0d22bd4d1
* module.utils.aws_alb_listener_rule.jenkins: 1 error(s) occurred:

* aws_alb_listener_rule.jenkins: Error modifying ALB Listener Rule: ValidationError: The 'path-pattern' field contains too many values; the limit is '1'
	status code: 400, request id: 3c1caeca-0f37-11e7-9c22-29da514a138b

This occurs using Terraform 0.9.1

stack72 added a commit that referenced this issue Mar 24, 2017
Fixes: #12983

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSALBListenerRule_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/24 19:31:26 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSALBListenerRule_ -timeout 120m
=== RUN   TestAccAWSALBListenerRule_basic
--- PASS: TestAccAWSALBListenerRule_basic (247.76s)
=== RUN   TestAccAWSALBListenerRule_multipleConditionThrowsError
--- PASS: TestAccAWSALBListenerRule_multipleConditionThrowsError (0.02s)
PASS
ok	github.com/hashicorp/terraform/builtin/providers/aws	247.815s
```
stack72 added a commit that referenced this issue Mar 24, 2017
Fixes: #12983

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSALBListenerRule_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/24 19:31:26 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSALBListenerRule_ -timeout 120m
=== RUN   TestAccAWSALBListenerRule_basic
--- PASS: TestAccAWSALBListenerRule_basic (247.76s)
=== RUN   TestAccAWSALBListenerRule_multipleConditionThrowsError
--- PASS: TestAccAWSALBListenerRule_multipleConditionThrowsError (0.02s)
PASS
ok	github.com/hashicorp/terraform/builtin/providers/aws	247.815s
```
stack72 added a commit that referenced this issue Mar 24, 2017
Fixes: #12983

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSALBListenerRule_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/24 19:31:26 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSALBListenerRule_ -timeout 120m
=== RUN   TestAccAWSALBListenerRule_basic
--- PASS: TestAccAWSALBListenerRule_basic (247.76s)
=== RUN   TestAccAWSALBListenerRule_multipleConditionThrowsError
--- PASS: TestAccAWSALBListenerRule_multipleConditionThrowsError (0.02s)
PASS
ok	github.com/hashicorp/terraform/builtin/providers/aws	247.815s
```
@dpanchal-visuallease
Copy link

Actually it does support, I tried with TF version terraform_0.12.19_linux_amd64/terraform and it worked fine.

@ghost
Copy link

ghost commented Jan 27, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jan 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants