Apply from a CRD URL?
marcellodesales opened this issue · 1 comments
marcellodesales commented
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
- Like it's usual for the community, URLs can be from git repos that points to a given directory in a given branch
- See Step 6 from https://docs.aws.amazon.com/eks/latest/userguide/alb-ingress.html
- It includes parameters of the dir and the label (branch, tag or SHA)
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
- Download all the files from the URL to a known directory
- Execute kubectl apply -k in the dir
vroad commented
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
}