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

ACL Header rule for loadbalancer frontend #1211

Closed
rchallie opened this issue Apr 13, 2022 · 4 comments · Fixed by #1229
Closed

ACL Header rule for loadbalancer frontend #1211

rchallie opened this issue Apr 13, 2022 · 4 comments · Fixed by #1229
Labels
enhancement load-balancer Load-balancer issues, bugs and feature requests
Milestone

Comments

@rchallie
Copy link
Contributor

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Hi ! I tried to create an ACL rule to deny access to an host using the Host header.
Like I didn't found the http_filter value for the header I created it manually on the Dashboard and I refreshed my terraform state to get it.
Here the part of my teraform state that I got:

{
  "action": [
    {
      "type": "deny"
    }
  ],
  "match": [
    {
      "http_filter": "http_header_match",
      # Missing something like: http_filter_header_name
      "http_filter_value": [
        "nice.domain"
      ],
      "invert": false,
      "ip_subnet": [
        "XX.XX.XXX.XX"
      ]
    }
  ],
  "name": "Deny access to Host by IP"
}

First thing, the header name Host doesn't appear.
Second, when I do a terraform plan, it want to destroy my ACL rule created manually.

I tried to recreate it using terraform configuration and got:

Error: expected acl.0.match.0.http_filter to be one of [acl_http_filter_none path_begin path_end regex], got http_header_match

New or Affected Resource(s)

  • scaleway_lb_frontend -> acl

Can it be interresting to add the posibility to use the http_filter value http_header_match ?

@remyleone remyleone added this to the v2.2.1 milestone Apr 14, 2022
@remyleone remyleone added the load-balancer Load-balancer issues, bugs and feature requests label Apr 15, 2022
@remyleone
Copy link
Member

remyleone commented Apr 21, 2022

Hello, can you share a minimal snippet of code that reproduces the problem that you experience? Have you tried creating a frontend from scratch with the header matching rule you mention?

https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/lb_frontend#with-acls

@rchallie
Copy link
Contributor Author

rchallie commented Apr 21, 2022

Hi, I didn't code anything for this because the http_filter for header (http_header_match) is not mentioned somewhere in the documentation, it only mention:
Possible values are: acl_http_filter_none, path_begin, path_end or regex.
So I create the resource on the dashboard and import it on my terraform state to know the filter name.
But here is the output of my terraform when I plan:

  # scaleway_lb_frontend.lb_frontends["frontend_https"] will be updated in-place
  ~ resource "scaleway_lb_frontend" "lb_frontends" {
        id             = "fr-par-1/xxxxx-xxx..."
        name           = "frontend_https"
        # (4 unchanged attributes hidden)

      - acl {
          - name = "Name" -> null

          - action {
              - type = "deny" -> null
            }

          - match {
              - http_filter       = "http_header_match" -> null
              - http_filter_value = [
                  - "my.domain.com",
                ] -> null
              - invert            = false -> null
              - ip_subnet         = [
                  - "XX.XX.XXX.XX",
                ] -> null
            }
        }
        # (1 unchanged block hidden)
    }

I was just suprised that neither the terraform state nor the output mention the header name (in my case Host) .
I will go back with a snippet of code.

@remyleone remyleone linked a pull request Apr 21, 2022 that will close this issue
@remyleone
Copy link
Member

I'm working on adding support for this option. Once it is ready, I will notify you so that you can give feedback if you want it :)

@rchallie
Copy link
Contributor Author

Nice job & thank you ! I will try it with joy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement load-balancer Load-balancer issues, bugs and feature requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants