handle manifests with multiple resources?
Opened this issue · 5 comments
ericchiang commented
handle manifests with multiple resources?
adamdunkley commented
I just bumped in to this with installing the dashboard the KOPS way. The dream would be to use HTTP to download the resource and it work: https://raw.githubusercontent.com/kubernetes/kops/master/addons/kubernetes-dashboard/v1.8.3.yaml
Error produced currently:
Error: Error applying plan:
1 error(s) occurred:
* module.paws.k8s_manifest.dashboard_deployment: 1 error(s) occurred:
* k8s_manifest.dashboard_deployment: expected to create 1 resource, got 6
Is there a workaround?
ericchiang commented
There's no workaround. Happy to accept PRs if someone get's to this before I do.
gaui commented
We only have manifests with multiple resources, so shame we can't use this.
andrewgeller commented
One workaround is to use terraform to split the manifests:
data "http" "kd_manifests" {
url = "https://raw.githubusercontent.com/kubernetes/kops/master/addons/kubernetes-dashboard/v1.8.3.yaml"
}
# replace --- with SPLIT_DELIMITER because split does not support a regex delimiter
# regex may not be perfect (eg whitespace after the dashes may be valid? or something else?)
locals {
kd_manifests = "${split("SPLIT_DELIMITER", replace(data.http.kd_manifests.body, "/(?m:^---$)/", "SPLIT_DELIMITER"))}"
}
resource "k8s_manifest" "kd_manifest" {
count = "${length(local.kd_manifests)}"
content = "${element(local.kd_manifests, count.index)}"
}
gordalina commented
The workaround does not process the contents serially.