-
Notifications
You must be signed in to change notification settings - Fork 975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add generic kubernetes resource #141
Comments
FYI there's a alternative Terraform provider for Kubernetes that allows for configuration via raw manifests. |
We need something like this as well since we have started codifying our operations domain knowledge in automation. However, what I think would be more useful is to have a resource definition format that would allow this provider to support any resource and properties with the full change-management fidelity that Terraform allows. You seem to lose a large number of capabilities with the manifest-driven provider. |
Related issue: #3 More pro arguments:
|
While working with the Terraform Kubernetes Provider to manage a cluster, I also thought about having a generic resource. In particular, I was surprised that one of the most important resource such as the The alternative terraform-provider-k8s mentioned by @shaneramey has the disadvantage that it relies on A generic resource e.g. A problem of a generic resource would be that it would not be possible to define the fields natively in HCL. To my understanding, Terraform requires all fields of a resource to be defined explicitly in the implementation. For this reason, the manifest must be provided in either YAML or JSON format inside a field of the resource. Terraform would be able to detect changes based on the content of this manifest field. As a proposal, a generic
As an alternative, the manifest property could be populated from an external file.
To extend the list of pro arguments:
|
For an MVP, I could also live with a small dependency to kubectl to be available on the system, as long as I can provide the cluster configuration via the provider. |
Hi folks 👋 Supporting YAML/JSON was considered before (the very first proposal was exactly that) and during the initial implementation of this provider and we decided not to do it. For that reason I'm going to close this issue as we have no intentions of implementing it nor accepting PRs which accept raw configs in JSON/YAML. Feel free to use @ericchiang's provider or kubectl if you wish. Full discussion: hashicorp/terraform#3132 TL;DR version (summary): hashicorp/terraform#3453 (comment)
We plan to support alpha/beta resources eventually, but those are likely going to be implemented the same way as all existing resources for the reasons mentioned under the above links.
We plan to address that on a slightly different level, we might generate some or most of the code that is currently maintained manually. This is however a long-term goal, not something we're currently looking into - just to set expectations. Thanks for understanding and sorry for (potentially) bad news. |
The idea of code generation sounds promising especially in cases of well defined/specified APIs such as the K8s API. Is there a more general approach Hashicorp is currently working on such as resource/provider code generation from Swagger API definitions etc? From such an approach I am sure more providers could benefit. Also in the light of the counter arguments, in my opinion it is valuable for the provider to support a generic resource as fallback mechanism. The documentation can state clearly which of the usual Terraform features to expect and which are not supported. |
Now that Kubernetes it being extended with Custom Resource Definitions extensively by common projects (Istio, Helm 3.0, and others) can this issue be revisited? I don't think that it will be feasible for this provider to implement every CRD which people may want to use. Also the Kubernetes APIs change relatively quickly and updating this provider to match the latest features is impractical in my opinion. This is a very significant limitation for me as my use case is to use Helm for deploying services and to manage the k8s resources which configure those services in Terraform. |
In GKE, custom resources are used for configuring the details of load balancing (see BackendConfig), and as a Kubernetes application developer, I plan to use the controller/custom resource pattern throughout my app. Without any support for custom resources, this provider is unusable, for me (and at least twelve others, judging from the reactions above). The answer can't be to bake in knowledge of all custom resources because that's not a enumerable set -- many of those custom resources are application-specific. Please don't construe this as an argument for heredocs piped to |
This is also an issue with EKS to apply the k8s CNI update. One of my colleagues (@thommaa) also encountered problem with Helm Chart and certmanager. |
Up! issue needs to be fixed for multiple deployment use cases. |
@ericchiang's provider is archived by now. |
any reason this issue was closed? was it addressed? |
For those following this issue, these are the open issues representing the same issue: The answer is here: #215 (comment)
|
@maltefiala we (Banzai Cloud) will continue supporting @ericchiang's terraform-provider-k8s We also plan to improve the provider (for example by implement a better diff check). Follow the issue tracker for more information! |
Terraform already supports |
Any update on this? |
@theomessin .. I am currently using (with success) https://github.com/banzaicloud/terraform-provider-k8s |
As far as I can tell the most compelling reason not to support any manifest in the official provider is that Kubernetes can change the objects themselves after sending them to the API server, either by the API server itself or through mutating webhooks which would mean that terraform wouldn't work optimally, there would also be a diff with the remote state. On the other hand sometimes it's just unavoidable to use Terraform, therefore we support and use the forked version. |
|
Any chance to reopen this issue ? |
That is why |
it would be great if there would be a generic kubernetes resource, which does "$ kubectl apply" on whatever json or yaml file given.
This would greatly simplify the support for not officially supported kubernetes objects and it would allow to keep the yaml format of kubernetes whenever it makes sense (e.g. the object to create is something taken from a readme, something not worth to be converted to the terraform format)
The text was updated successfully, but these errors were encountered: