Open MrVentzi opened 3 years ago
I also hace such error. In my case i have such kubernetes_manifest resource
resource "kubernetes_manifest" "vertical-pod-autoscaler" {
provider = kubernetes-alpha
manifest = {
"apiVersion" = "autoscaling.k8s.io/v1"
"kind" = "VerticalPodAutoscaler"
...
Terraform plan fails with error
β·
β Error: No valid OpenAPI definition
β
β with kubernetes_manifest.vertical-pod-autoscaler,
β on vpa.tf line 4, in resource "kubernetes_manifest" "vertical-pod-autoscaler":
β 4: resource "kubernetes_manifest" "vertical-pod-autoscaler" {
β
β Resource VerticalPodAutoscaler.v1.autoscaling.k8s.io does not have a valid OpenAPI definition in this cluster.
β
β Usually this is caused by a CustomResource without a schema.
Cluster has verticalpodautoscalers api resource with Kind: VerticalPodAutoscaler but with NAME verticalpodautoscalers
kubectl api-resources --api-group=autoscaling.k8s.io
NAME SHORTNAMES APIVERSION NAMESPACED KIND
verticalpodautoscalers vpa autoscaling.k8s.io/v1 true VerticalPodAutoscaler
It looks like kubernetes-alpha checks Kind instead of CRD. In my exaple it checks Resource VerticalPodAutoscaler.v1.autoscaling.k8s.io instead of Resource VerticalPodAutoscalers.v1.autoscaling.k8s.io
You should use api resource name instead of kind for validating OpenAPI definition
Terraform, Provider, Kubernetes versions
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Steps to Reproduce
Expected Behavior
What should have happened? Be able to plan/apply by honouring depends_on and waiting for each resource to be applied in turn.
Installing the istio_operator adds the
install.istio.io
group, in turn, when that is available, installing istio will add a few more such assecurity.istio.io
Actual Behavior
What actually happened?
The provider doesn't know how to plan the resources as their dependencies have not yet been created.
To get around it:
IF running 0.3.3 provider version then we get:
which is mentioned here: https://github.com/hashicorp/terraform-provider-kubernetes-alpha/issues/181#issuecomment-830264484
which means we cannot even target the istio install with latest provider.
Any ideas are welcome as currently we have no way of applying the state cleanly.
Thanks
Important Factoids
References
Community Note