Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply from a CRD URL? #61

Open
marcellodesales opened this issue Oct 27, 2020 · 1 comment
Open

Apply from a CRD URL? #61

marcellodesales opened this issue Oct 27, 2020 · 1 comment

Comments

@marcellodesales
Copy link

Is your feature request related to a problem? Please describe.

I'd like to apply from a CRD URL...

Describe the solution you'd like to see

kubectl apply -k "github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master
  • For this provider, I would expect something very simple:
resource "k8s_manifest" "load_balancer_controller_crds" {
  url   = "github.com/aws/eks-charts/stable/aws-load-balancer-controller//crds?ref=master"
  namespace = kubernetes_service_account.load_balancer_controller.metadata.0.namespace
}

Describe alternatives you've considered

  1. Download all the files from the URL to a known directory
  2. Execute kubectl apply -k in the dir
@vroad
Copy link

vroad commented Nov 15, 2020

That should be possible at least for public http URLs, with the combination of hashicorp/http provider.
Should work as long as each yaml file contain only one resource (See issue #7 for more details).

locals {
  grafana_operator_version = "0.2.5"
  grafana_operator_crd_urls = {
    grafana = "https://raw.githubusercontent.com/banzaicloud/banzai-charts/chart/grafana-operator/${local.grafana_operator_version}/grafana-operator/crds/grafana.yaml"
    grafana_dashboards = "https://raw.githubusercontent.com/banzaicloud/banzai-charts/chart/grafana-operator/${local.grafana_operator_version}/grafana-operator/crds/grafanadashboards.yaml"
    grafana_data_sources = "https://raw.githubusercontent.com/banzaicloud/banzai-charts/chart/grafana-operator/${local.grafana_operator_version}/grafana-operator/crds/grafanadatasources.yaml"
  }
}

data "http" "grafana-operator-crds" {
  for_each = local.grafana_operator_crd_urls
  url = each.value
}

resource "k8s_manifest" "grafana-operator-crds" {
  for_each = local.grafana_operator_crd_urls
  content = data.http.grafana-operator-crds[each.key].body
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants