Skip to content

Provider does CRD validation at plan time and should do this at apply time. #2597

@jsingleton785

Description

@jsingleton785

Terraform Version, Provider Version and Kubernetes Version

Terraform version: 1.9.6
Kubernetes provider version: 2.32.0
Kubernetes version: 1.28.13

Affected Resource(s)

kubernetes_manifest

Terraform Configuration Files

resource "helm_release" "cert_manager" {
chart = "/tmp/cert-manager.tgz"
name = "cert-manager"
namespace = "cert-manager"
wait = false
values = {...}
}

resource "kubernetes_manifest" "ClusterIssuer" {
depends_on = [ helm_release.cert_manager ]
manifest = {
apiVersion = "cert-manager.io/v1"
kind = "ClusterIssuer"
metadata = {
name = "issuer"
}
spec = {
selfSigned = {}
}
}
}


### Debug Output
│ Error: API did not recognize GroupVersionKind from manifest (CRD may not be installed)
│
│   with kubernetes_manifest.ClusterIssuer,
│   on main.tf line 64, in resource "kubernetes_manifest" "ClusterIssuer":
│   64: resource "kubernetes_manifest" "ClusterIssuer" {
│
│ no matches for kind "ClusterIssuer" in group "cert-manager.io"

### Steps to Reproduce
1. `terraform apply`

### Expected Behavior
Provider uses the depends_on properly to wait for the other resource to be created, then it will find the CRD properly and the apply will work without error.

If necessary,  it would make sense for this to throw a warning, but not fail the apply, during the plan.

### Actual Behavior
Provider checks for the CRD before the other resource can be created and doesn't allow the module to proceed to the apply step. 

### References
https://github.com/hashicorp/terraform-provider-kubernetes/issues/2187

### Community Note
<!--- Please keep this note for the community --->
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions