first commit

This commit is contained in:
2024-01-10 13:23:08 +01:00
commit e0baae6132
25 changed files with 765 additions and 0 deletions

22
service/svc.tf Normal file
View File

@@ -0,0 +1,22 @@
locals {
ports = [ for idx, target in var.targets : {
"name" = target
"port"= var.ports[idx]
"protocol"= var.protocols[idx]
"targetPort" = target
}]
}
resource "kubectl_manifest" "service" {
yaml_body = <<-EOF
apiVersion: v1
kind: Service
metadata:
name: "${var.instance}-${var.component}"
namespace: "${var.namespace}"
labels: ${jsonencode(var.labels)}
spec:
type: ClusterIP
ports: ${jsonencode(local.ports)}
selector: ${jsonencode(var.labels)}
EOF
}