resource "kubectl_manifest" "ConfigMap_multus-cni-config" {
  yaml_body  = <<-EOF
    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: multus-cni-config
      namespace: ${var.namespace}
      labels: ${jsonencode(local.common-labels)}
      ownerReferences: ${jsonencode(var.install_owner)}
    data:
      cni-conf.json: |-
        {
          "name": "multus-cni-network",
          "type": "multus",
          "capabilities": {
            "portMappings": true
          },
          "delegates": [
            {
              "cniVersion": "0.3.1",
              "name": "default-cni-network",
              "plugins": [
                {
                  "type": "flannel",
                  "name": "flannel.1",
                    "delegate": {
                      "isDefaultGateway": true,
                      "hairpinMode": true
                    }
                  },
                  {
                    "type": "portmap",
                    "capabilities": {
                      "portMappings": true
                    }
                  }
              ]
            }
          ],
          "kubeconfig": "${var.cni.conf_dir}/multus.d/multus.kubeconfig"
        }
EOF
}

