terraform 中“kubectl apply -k”的等价物是什么?

我想在我的 EKS 集群中使用 EFS。我正在关注这个 eks workshop

我需要使用 kustomize 部署 EFS CSI Driver

kubectl apply -k "github.com/kubernetes-sigs/aws-efs-csi-driver/deploy/kubernetes/overlays/stable/?ref=release-1.0"

terraform 中上述命令的等价物是什么?

是这样的吗?

terraform {
  required_providers {
    kustomization = {
      source  = "kbst/kustomize"
      version = "0.2.0-beta.3"
    }
  }
  required_version = ">= 0.12"
}

provider "kustomization" {}

data "kustomization" "test" {
  provider = kustomization

  path = "github.com/kubernetes-sigs/aws-efs-csi-driver/deploy/kubernetes/overlays/stable/?ref=release-1.0"
}

resource "kustomization_resource" "test" {
  provider = kustomization

  for_each = data.kustomization.test.ids

  manifest = data.kustomization.test.manifests[each.value]
}
stack overflow What's the equivalent of "kubectl apply -k" in terraform?
原文答案
author avatar

接受的答案

是的,您展示的方式是实现它的正确方式。您可以获得有关自定义提供程序 here 的更多信息。


答案: