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

Support endPort in kubernetes_network_policy #2455

Open
joelthompson opened this issue Apr 3, 2024 · 2 comments · May be fixed by #2494
Open

Support endPort in kubernetes_network_policy #2455

joelthompson opened this issue Apr 3, 2024 · 2 comments · May be fixed by #2494

Comments

@joelthompson
Copy link

Description

Kubernetes NetPols support specifying a range of ports (stable as of 1.25) using endPort. It isn't possible to specify that using the current Kubernetes provider.

Potential Terraform Configuration

resource "kubernetes_network_policy" "example" {
  metadata {
    name      = "terraform-example-network-policy"
    namespace = "default"
  }

  spec {
    pod_selector {
      match_expressions {
        key      = "name"
        operator = "In"
        values   = ["webfront", "api"]
      }
    }

    ingress {
      ports {
        port     = 1025
        endPort  = 65535
        protocol = "TCP"
      }
      from {
        namespace_selector {
          match_labels = {
            name = "default"
          }
        }
      }
    }
    policy_types = ["Ingress"]
  }
}

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@jrhouston
Copy link
Contributor

Thanks for opening this @joelthompson. We should add this here:

Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"port": {
Type: schema.TypeString,
Description: networkPolicyV1PortPortDoc,
Optional: true,
},
"protocol": {
Type: schema.TypeString,
Description: networkPolicyV1PortProtocolDoc,
Optional: true,
Default: "TCP",

@tostieme
Copy link

I would like to work on this 🙂

@tostieme tostieme linked a pull request May 18, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants