You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current behavior of the provider requiring the Kubernetes cluster to exist if any Kubernetes resources require a custom CRD is extremely baffling to Terraform users. Worse yet, the only indication of the issue is found in this cryptic error message:
╷
│ Error: Failed to construct REST client
│
│ with module.cluster-resources.kubernetes_manifest.main_gateway,
│ on cluster-resources/development.tf line 28, in resource "kubernetes_manifest" "main_gateway":
│ 28: resource "kubernetes_manifest" "main_gateway" {
│
│ cannot create REST client: no client config
╵
This message doesn't give any indication of the actual problem and may lead to defenestration of developer laptops. The provider docs do clearly describe the issue -but the provided solution of using multiple apply operations undermines the problem IAC tools are meant to solve. Any person initializing the Terraform configuration must remember that they need to manually find the module that contains the Kubernetes CRD resources and set count = 0 , do an apply, delete that parameter -and then apply again.
Therefore, I think a good short-term compromise solution is to simply allow manually adding in the CRD OpenAPI specifications in the provider block. This way, the provider wouldn't need to access the cluster unless it can't find a definition in the provided specs.
If the cluster does not yet exist and a CRD is not found in the provided map and the provider needs to look up the resource from the cluster, then a message should be sent to the user indicating that a CRD OpenAPI spec should be provided.
Potential Terraform Configuration
I ran into this issue today while trying to set up the new Gateway API on GKE -which this provider doesn't currently support natively. I think the following config would be a relatively straightforward solution to the problem:
Description
The current behavior of the provider requiring the Kubernetes cluster to exist if any Kubernetes resources require a custom CRD is extremely baffling to Terraform users. Worse yet, the only indication of the issue is found in this cryptic error message:
This message doesn't give any indication of the actual problem and may lead to defenestration of developer laptops. The provider docs do clearly describe the issue -but the provided solution of using multiple apply operations undermines the problem IAC tools are meant to solve. Any person initializing the Terraform configuration must remember that they need to manually find the module that contains the Kubernetes CRD resources and set
count = 0
, do an apply, delete that parameter -and then apply again.Therefore, I think a good short-term compromise solution is to simply allow manually adding in the CRD OpenAPI specifications in the provider block. This way, the provider wouldn't need to access the cluster unless it can't find a definition in the provided specs.
If the cluster does not yet exist and a CRD is not found in the provided map and the provider needs to look up the resource from the cluster, then a message should be sent to the user indicating that a CRD OpenAPI spec should be provided.
Potential Terraform Configuration
I ran into this issue today while trying to set up the new Gateway API on GKE -which this provider doesn't currently support natively. I think the following config would be a relatively straightforward solution to the problem:
References
Would solve #1625 #1775 and countless other duplicate issues that are sure to keep recurring until a solution to the custom CRD problem is implemented.
The text was updated successfully, but these errors were encountered: