Skip to content

Latest commit

 

History

History
129 lines (104 loc) · 3.24 KB

kubernetes_config_map.md

File metadata and controls

129 lines (104 loc) · 3.24 KB

kubernetes_config_map

back

Index

Terraform

terraform {
  required_providers {
    kubernetes = ">= 2.0.3"
  }
}

top

Example Usage

module "kubernetes_config_map" {
  source = "./modules/kubernetes/r/kubernetes_config_map"

  # binary_data - (optional) is a type of map of string
  binary_data = {}
  # data - (optional) is a type of map of string
  data = {}

  metadata = [{
    annotations      = {}
    generate_name    = null
    generation       = null
    labels           = {}
    name             = null
    namespace        = null
    resource_version = null
    self_link        = null
    uid              = null
  }]
}

top

Variables

variable "binary_data" {
  description = "(optional) - BinaryData contains the binary data. Each key must consist of alphanumeric characters, '-', '_' or '.'. BinaryData can contain byte sequences that are not in the UTF-8 range. The keys stored in BinaryData must not overlap with the ones in the Data field, this is enforced during validation process. Using this field will require 1.10+ apiserver and kubelet. This field only accepts base64-encoded payloads that will be decoded/encoded before being sent/received to/from the apiserver."
  type        = map(string)
  default     = null
}

variable "data" {
  description = "(optional) - Data contains the configuration data. Each key must consist of alphanumeric characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use the BinaryData field. The keys stored in Data must not overlap with the keys in the BinaryData field, this is enforced during validation process."
  type        = map(string)
  default     = null
}

variable "metadata" {
  description = "nested block: NestingList, min items: 1, max items: 1"
  type = set(object(
    {
      annotations      = map(string)
      generate_name    = string
      generation       = number
      labels           = map(string)
      name             = string
      namespace        = string
      resource_version = string
      self_link        = string
      uid              = string
    }
  ))
}

top

Resource

resource "kubernetes_config_map" "this" {
  # binary_data - (optional) is a type of map of string
  binary_data = var.binary_data
  # data - (optional) is a type of map of string
  data = var.data

  dynamic "metadata" {
    for_each = var.metadata
    content {
      # annotations - (optional) is a type of map of string
      annotations = metadata.value["annotations"]
      # generate_name - (optional) is a type of string
      generate_name = metadata.value["generate_name"]
      # labels - (optional) is a type of map of string
      labels = metadata.value["labels"]
      # name - (optional) is a type of string
      name = metadata.value["name"]
      # namespace - (optional) is a type of string
      namespace = metadata.value["namespace"]
    }
  }

}

top

Outputs

output "id" {
  description = "returns a string"
  value       = kubernetes_config_map.this.id
}

output "this" {
  value = kubernetes_config_map.this
}

top