Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

handle manifests with multiple resources? #4

Open
ericchiang opened this issue Feb 3, 2018 · 5 comments
Open

handle manifests with multiple resources? #4

ericchiang opened this issue Feb 3, 2018 · 5 comments

Comments

@ericchiang
Copy link
Owner

No description provided.

@adamdunkley
Copy link

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
Copy link
Owner Author

There's no workaround. Happy to accept PRs if someone get's to this before I do.

@gaui
Copy link

gaui commented Jun 21, 2018

We only have manifests with multiple resources, so shame we can't use this.

@andrewgeller
Copy link

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
Copy link

The workaround does not process the contents serially.

gordalina added a commit to gordalina/terraform-provider-k8s that referenced this issue Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants