kubernetes_cluster_role

A ClusterRole creates a role at the cluster level and in all namespaces.

Example Usage

resource "kubernetes_cluster_role" "example" {
  metadata {
    name = "terraform-example"
  }

  rule {
    api_groups = [""]
    resources  = ["namespaces", "pods"]
    verbs      = ["get", "list", "watch"]
  }
}

Aggregation Rule Example Usage

resource "kubernetes_cluster_role" "example" {
  metadata {
    name = "terraform-example"
  }

  aggregation_rule {
    cluster_role_selectors {
      match_labels = {
        foo = "bar"
      }

      match_expressions {
        key      = "environment"
        operator = "In"
        values   = ["non-exists-12345"]
      }
    }
  }
}

Argument Reference

The following arguments are supported:

Nested Blocks

metadata

Arguments

Attributes

rule

Arguments

aggregation_rule

Arguments

cluster_role_selectors

Arguments

Import

ClusterRole can be imported using the name, e.g.

$ terraform import kubernetes_cluster_role.example terraform-name