Skip to content

Latest commit

 

History

History
125 lines (98 loc) · 2.43 KB

kubernetes_service_account.md

File metadata and controls

125 lines (98 loc) · 2.43 KB

kubernetes_service_account

back

Index

Terraform

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

top

Example Usage

module "kubernetes_service_account" {
  source = "./modules/kubernetes/d/kubernetes_service_account"


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

top

Variables

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

top

Datasource

data "kubernetes_service_account" "this" {

  dynamic "metadata" {
    for_each = var.metadata
    content {
      # annotations - (optional) is a type of map of string
      annotations = metadata.value["annotations"]
      # 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 "automount_service_account_token" {
  description = "returns a bool"
  value       = data.kubernetes_service_account.this.automount_service_account_token
}

output "default_secret_name" {
  description = "returns a string"
  value       = data.kubernetes_service_account.this.default_secret_name
}

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

output "image_pull_secret" {
  description = "returns a list of object"
  value       = data.kubernetes_service_account.this.image_pull_secret
}

output "secret" {
  description = "returns a list of object"
  value       = data.kubernetes_service_account.this.secret
}

output "this" {
  value = kubernetes_service_account.this
}

top