how to delete an object before inserting?
marcellodesales opened this issue · 0 comments
marcellodesales commented
Describe the bug
- Re-running terraform apply fails with the following:
Error: customresourcedefinitions.apiextensions.k8s.io "targetgroupbindings.elbv2.k8s.aws" already exists
on k8s_system_load_balancer_controller_install.tf line 37, in resource "k8s_manifest" "load_balancer_controller_crds":
37: resource "k8s_manifest" "load_balancer_controller_crds" {
Steps to reproduce the issue:
- Get an object for applying
data "http" "load_balancer_controller_crds" {
url = "https://github.com/aws/eks-charts/raw/master/stable/aws-load-balancer-controller/crds/crds.yaml"
}
resource "k8s_manifest" "load_balancer_controller_crds" {
content = data.http.load_balancer_controller_crds.body
namespace = kubernetes_service_account.load_balancer_controller.metadata.0.namespace
}
Expected behavior
- Maybe execute
kubectl delete
before doing kubectl apply?- To update I usually do
curl -o https://......./crd.yaml URL && \
kubectl delete -f crd.yaml && \
kubectl apply -f crd.yaml