Skip to content

Commit

Permalink
feat: Creating the v2 version of the provider
Browse files Browse the repository at this point in the history
  • Loading branch information
rlinstorres committed Nov 21, 2024
1 parent 0584fd6 commit f237cea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Kubernetes "kubectl" Provider

This provider is the best way of managing Kubernetes resources in Terraform, by allowing you to use the thing
Kubernetes loves best - yaml!
This provider offers the most effective method for handling Kubernetes resources in Terraform. It empowers you to leverage what Kubernetes values most - YAML!

This core of this provider is the `kubectl_manifest` resource, allowing free-form yaml to be processed and applied against Kubernetes.
This yaml object is then tracked and handles creation, updates and deleted seamlessly - including drift detection!
At the heart of this provider lies the kubectl_manifest resource, enabling the processing and application of free-form YAML directly to Kubernetes. This YAML object is meticulously monitored and manages the entire lifecycle, from creation and updates to seamless deletion, including drift detection.

A set of helpful data resources to process directories of yaml files and inline templating is available.
The terraform-provider-kubectl has gained widespread adoption in numerous extensive Kubernetes installations, serving as the primary tool for orchestrating the complete lifecycle of Kubernetes resources

This terraform-provider-kubectl provider has been originally forked from `gavinbunney/kubectl` and synced with `alekc/kubectl`.

Expand Down Expand Up @@ -118,3 +116,7 @@ In order to run the full suite of Acceptance tests, run `make testacc`.
```sh
$ make testacc
```

### Inspiration

Thanks to the original provider by [gavinbunney](https://github.com/gavinbunney/terraform-provider-kubectl) on the original base of this provider. Current version has been forked from 1.14.
8 changes: 4 additions & 4 deletions docs/data-sources/kubectl_path_documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This gives you the flexibility of parameterizing your manifests, and loading & t

## Example Usage

### Load all manifest documents via for_each (recommended)
### Load all manifest documents from a folder via for_each (recommended)

The recommended approach is to use the `manifests` attribute and a `for_each` expression to apply the found manifests.
This ensures that any additional yaml documents or removals do not cause a large amount of terraform changes.
Expand All @@ -19,14 +19,15 @@ data "kubectl_path_documents" "docs" {
}
resource "kubectl_manifest" "test" {
for_each = toset(data.kubectl_path_documents.docs.documents)
for_each = data.kubectl_path_documents.docs.manifests
yaml_body = each.value
}
```

### Load all manifest documents via count

Raw documents can also be accessed via the `documents` attribute.
Raw documents can also be accessed via the `documents` attribute. Not that if the document order is changed (i.e. a new file is added),
then it would trigger destruction and recreation of related documents.

```hcl
data "kubectl_path_documents" "docs" {
Expand Down Expand Up @@ -163,7 +164,6 @@ metadata:
## Argument Reference

* `pattern` - Required. Glob pattern to search for.
* `force_new` - Optional. Forces delete & create of resources if the `yaml_body` changes. Default `false`.
* `vars` - Optional. Map of variables to use when rendering the loaded documents as templates. Currently only strings are supported.
* `sensitive_vars` - Optional. Map of sensitive variables to use when rendering the loaded documents as templates. Merged with the `vars` attribute. Currently only strings are supported.
* `disable_template` - Optional. Flag to disable template parsing of the loaded documents.
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ This yaml object is then tracked and handles creation, updates and deleted seaml

A set of helpful data resources to process directories of yaml files and inline templating is available.

This `terraform-provider-kubectl` provider has been used by many large Kubernetes installations to completely
manage the lifecycle of Kubernetes resources.
This `terraform-provider-kubectl` provider has been used by many large Kubernetes installations to completely manage the lifecycle of Kubernetes resources.

## Installation

Expand All @@ -24,7 +23,7 @@ terraform {
required_providers {
kubectl = {
source = "FindHotel/kubectl"
version = ">= 1.14.1"
version = ">= 2.0.0"
}
}
}
Expand Down Expand Up @@ -66,6 +65,7 @@ The following arguments are supported:
* `config_context_cluster` - (Optional) Cluster context of the kube config (name of the kubeconfig cluster, `--cluster` flag in `kubectl`). Can be sourced from `KUBE_CTX_CLUSTER`.
* `token` - (Optional) Token of your service account. Can be sourced from `KUBE_TOKEN`.
* `proxy_url` - (Optional) URL to the proxy to be used for all API requests. URLs with "http", "https", and "socks5" schemes are supported. Can be sourced from `KUBE_PROXY_URL`.
* `tls_server_name` - (Optional) Server name passed to the server for SNI and is used in the client to check server certificates against.
* `exec` - (Optional) Configuration block to use an [exec-based credential plugin] (https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins), e.g. call an external command to receive user credentials.
* `api_version` - (Required) API version to use when decoding the ExecCredentials resource, e.g. `client.authentication.k8s.io/v1beta1`.
* `command` - (Required) Command to execute.
Expand Down

0 comments on commit f237cea

Please sign in to comment.