kubernetes_secret

The resource provides mechanisms to inject containers with sensitive information, such as passwords, while keeping containers agnostic of Kubernetes. Secrets can be used to store sensitive information either as individual properties or coarse-grained entries like entire files or JSON blobs. The resource will by default create a secret which is available to any pod in the specified (or default) namespace.

Example Usage

resource "kubernetes_secret" "example" {
  metadata {
    name = "basic-auth"
  }

  data {
    username = "admin"
    password = "P4ssw0rd"
  }

  type = "kubernetes.io/basic-auth"
}

Example Usage (Docker config)

resource "kubernetes_secret" "example" {
  metadata {
    name = "docker-cfg"
  }

  data {
    ".dockercfg" = "${file("${path.module}/.docker/config.json")}"
  }

  type = "kubernetes.io/dockercfg"
}

Argument Reference

The following arguments are supported:

Nested Blocks

metadata

Arguments

Attributes

Import

Secret can be imported using its namespace and name, e.g.

$ terraform import kubernetes_secret.example default/my-secret

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/kubernetes/r/secret.html