fix
This commit is contained in:
29
meta/domain-devspaces/organisations.tf
Normal file
29
meta/domain-devspaces/organisations.tf
Normal file
@@ -0,0 +1,29 @@
|
||||
locals {
|
||||
sorted-organisation-names = reverse(distinct(sort([for org in var.organisations: org.name])))
|
||||
sorted-organisations = flatten([
|
||||
for name in local.sorted-organisation-names: [
|
||||
for org in var.organisations: org if org.name == name
|
||||
]
|
||||
])
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "organisations" {
|
||||
count = length(local.sorted-organisations)
|
||||
depends_on = [kubernetes_namespace_v1.ns]
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: "vynil.solidite.fr/v1"
|
||||
kind: "Install"
|
||||
metadata:
|
||||
name: "${local.sorted-organisations[count.index].name}"
|
||||
namespace: "${var.namespace}"
|
||||
labels: ${jsonencode(local.common-labels)}
|
||||
spec:
|
||||
distrib: "${var.distributions.domain}"
|
||||
category: "share"
|
||||
component: "organisation"
|
||||
options: ${jsonencode(merge(
|
||||
local.global,
|
||||
{ for k, v in local.sorted-organisations[count.index] : k => v if !contains(["name","organisations"], k) }
|
||||
))}
|
||||
EOF
|
||||
}
|
||||
Reference in New Issue
Block a user