kubernetes_default_service_account

Kubernetes creates a "default" service account in each namespace. This is the service account that will be assigned by default to pods in the namespace.

The kubernetes_default_service_account resource behaves differently from normal resources. The service account is created by a Kubernetes controller and Terraform "adopts" it into management. This resource should only be used once per namespace.

Example Usage

resource "kubernetes_default_service_account" "example" {
  metadata {
    namespace = "terraform-example"
  }
  secret {
    name = "${kubernetes_secret.example.metadata.0.name}"
  }
}

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

Argument Reference

The following arguments are supported:

Nested Blocks

metadata

Arguments

Attributes

image_pull_secret

Arguments

secret

Arguments

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Destroying

If you remove a kubernetes_default_service_account resource from your configuration, Terraform will send a delete request to the Kubernetes API. Kubernetes will automatically replace this service account, but any customizations will be lost. If you no longer want to manage a default service account with Terraform, use terraform state rm to remove it from state before removing the configuration.

Import

The default service account can be imported using the namespace and name, e.g.

$ terraform import kubernetes_default_service_account.example terraform-example/default