Skip to content

Name validation regex is invalid #214

@alkar

Description

@alkar

Terraform Version

Terraform v0.11.10
+ provider.kubernetes v1.3.0

Affected Resource(s)

  • kubernetes_cluster_role_binding

Terraform Configuration Files

resource "kubernetes_cluster_role_binding" "example" {
  metadata {
    name = "foo:bar"
  }

  role_ref {
    api_group = "rbac.authorization.k8s.io"
    kind      = "ClusterRole"
    name      = "cluster-admin"
  }

  subject {
    kind      = "Group"
    name      = "system:masters"
    api_group = "rbac.authorization.k8s.io"
  }
}

Expected Behavior

I expect the provider to be able to create the resource. The colon is allowed in all RBAC resources as far as I'm aware but I cannot find any relevant documentation.

Actual Behavior

$ terraform plan

Error: kubernetes_cluster_role_binding.example: metadata.0.name a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Steps to Reproduce

  1. terraform plan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions