77 lines
1.3 KiB
HCL
77 lines
1.3 KiB
HCL
# Example: Using Kubernetes Namespace Module
|
|
|
|
terraform {
|
|
required_version = ">= 1.0"
|
|
|
|
required_providers {
|
|
kubernetes = {
|
|
source = "hashicorp/kubernetes"
|
|
version = "~> 2.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
provider "kubernetes" {
|
|
# Configure your Kubernetes provider
|
|
# config_path = "~/.kube/config"
|
|
}
|
|
|
|
# Namespace Module
|
|
module "namespace" {
|
|
source = "../../modules/kubernetes/namespace"
|
|
|
|
name = "my-app"
|
|
|
|
labels = {
|
|
app = "my-app"
|
|
env = "production"
|
|
managed = "terraform"
|
|
team = "platform"
|
|
}
|
|
|
|
annotations = {
|
|
description = "Namespace for my-app production environment"
|
|
}
|
|
|
|
resource_quota = {
|
|
"requests.cpu" = "4"
|
|
"requests.memory" = "8Gi"
|
|
"limits.cpu" = "8"
|
|
"limits.memory" = "16Gi"
|
|
"persistentvolumeclaims" = "10"
|
|
"services.loadbalancers" = "2"
|
|
}
|
|
|
|
limit_range = {
|
|
default = {
|
|
"cpu" = "500m"
|
|
"memory" = "1Gi"
|
|
}
|
|
default_request = {
|
|
"cpu" = "100m"
|
|
"memory" = "128Mi"
|
|
}
|
|
max = {
|
|
"cpu" = "2"
|
|
"memory" = "4Gi"
|
|
}
|
|
min = {
|
|
"cpu" = "50m"
|
|
"memory" = "64Mi"
|
|
}
|
|
max_limit_request_ratio = {
|
|
"cpu" = "4"
|
|
}
|
|
}
|
|
}
|
|
|
|
# Outputs
|
|
output "namespace_name" {
|
|
value = module.namespace.namespace_name
|
|
}
|
|
|
|
output "namespace_id" {
|
|
value = module.namespace.namespace_id
|
|
}
|
|
|