The resource provides mechanisms to inject containers with configuration data while keeping containers agnostic of Kubernetes. Config Map can be used to store fine-grained information like individual properties or coarse-grained information like entire config files or JSON blobs.
resource "kubernetes_config_map_v1" "example" {
metadata {
name = "my-config"
}
data = {
api_host = "myhost:443"
db_host = "dbhost:5432"
"my_config_file.yml" = "${file("${path.module}/my_config_file.yml")}"
}
binary_data = {
"my_payload.bin" = "${filebase64("${path.module}/my_payload.bin")}"
}
}
The following arguments are supported:
binary_data
- (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/received before being sent/received to the apiserver.data
- (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.immutable
- (Optional) Immutable, if set to true, ensures that data stored in the ConfigMap cannot be updated (only object metadata can be modified). If not set to true, the field can be modified at any time. Defaulted to nil.metadata
- (Required) Standard config map's metadata. For more info see Kubernetes referencemetadata
annotations
- (Optional) An unstructured key value map stored with the config map that may be used to store arbitrary metadata.generate_name
- (Optional) Prefix, used by the server, to generate a unique name ONLY IF the name
field has not been provided. This value will also be combined with a unique suffix. For more info see Kubernetes referencelabels
- (Optional) Map of string keys and values that can be used to organize and categorize (scope and select) the config map. May match selectors of replication controllers and services.name
- (Optional) Name of the config map, must be unique. Cannot be updated. For more info see Kubernetes referencenamespace
- (Optional) Namespace defines the space within which name of the config map must be unique.generation
- A sequence number representing a specific generation of the desired state.resource_version
- An opaque value that represents the internal version of this config map that can be used by clients to determine when config map has changed. For more info see Kubernetes referenceuid
- The unique in time and space value for this config map. For more info see Kubernetes referenceConfig Map can be imported using its namespace and name, e.g.
$ terraform import kubernetes_config_map_v1.example default/my-config