Skip to content

Commit

Permalink
doc: Updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rlinstorres committed Nov 13, 2024
1 parent 2ae763c commit 265409a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 69 deletions.
44 changes: 10 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Kubernetes "kubectl" Provider

![Build Status](https://github.com/gavinbunney/terraform-provider-kubectl/actions/workflows/build.yml/badge.svg) [![user guide](https://img.shields.io/badge/-user%20guide-blue)](https://registry.terraform.io/providers/gavinbunney/kubectl)

This provider is the best way of managing Kubernetes resources in Terraform, by allowing you to use the thing
Kubernetes loves best - yaml!

Expand All @@ -25,46 +23,24 @@ terraform {
required_providers {
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.7.0"
source = "FindHotel/kubectl"
version = ">= 1.14.1"
}
}
}
```

### Terraform 0.12

#### Install latest version

The following one-liner script will fetch the latest provider version and download it to your `~/.terraform.d/plugins` directory.

```bash
$ mkdir -p ~/.terraform.d/plugins && \
curl -Ls https://api.github.com/repos/gavinbunney/terraform-provider-kubectl/releases/latest \
| jq -r ".assets[] | select(.browser_download_url | contains(\"$(uname -s | tr A-Z a-z)\")) | select(.browser_download_url | contains(\"amd64\")) | .browser_download_url" \
| xargs -n 1 curl -Lo ~/.terraform.d/plugins/terraform-provider-kubectl.zip && \
pushd ~/.terraform.d/plugins/ && \
unzip ~/.terraform.d/plugins/terraform-provider-kubectl.zip -d terraform-provider-kubectl-tmp && \
mv terraform-provider-kubectl-tmp/terraform-provider-kubectl* . && \
chmod +x terraform-provider-kubectl* && \
rm -rf terraform-provider-kubectl-tmp && \
rm -rf terraform-provider-kubectl.zip && \
popd
```

#### Install manually

If you don't want to use the one-liner above, you can download a binary for your system from the [release page](https://github.com/gavinbunney/terraform-provider-kubectl/releases),
then either place it at the root of your Terraform folder or in the Terraform plugin folder on your system.

## Quick Start

```hcl
provider "kubectl" {
host = var.eks_cluster_endpoint
cluster_ca_certificate = base64decode(var.eks_cluster_ca)
token = data.aws_eks_cluster_auth.main.token
load_config_file = false
exec {
api_version = "client.authentication.k8s.io/v1beta1"
args = ["eks", "get-token", "--cluster-name", var.cluster_name]
command = "aws"
}
}
resource "kubectl_manifest" "test" {
Expand Down Expand Up @@ -96,7 +72,7 @@ YAML
}
```

See [User Guide](https://registry.terraform.io/providers/gavinbunney/kubectl/latest) for details on installation and all the provided data and resource types.
See [User Guide](https://registry.terraform.io/providers/FindHotel/kubectl/latest) for details on installation and all the provided data and resource types.

---

Expand All @@ -110,13 +86,13 @@ To compile the provider, run `make build`. This will build the provider and put
### Building The Provider

```sh
$ go get github.com/gavinbunney/terraform-provider-kubectl
$ go get github.com/FindHotel/terraform-provider-kubectl
```

Enter the provider directory and build the provider

```sh
$ cd $GOPATH/src/github.com/gavinbunney/terraform-provider-kubectl
$ cd $GOPATH/src/github.com/FindHotel/terraform-provider-kubectl
$ make build
```

Expand Down
42 changes: 8 additions & 34 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,51 +23,26 @@ terraform {
required_providers {
kubectl = {
source = "gavinbunney/kubectl"
version = ">= 1.7.0"
source = "FindHotel/kubectl"
version = ">= 1.14.1"
}
}
}
```

### Terraform 0.12

#### Install latest version

The following one-liner script will fetch the latest provider version and download it to your `~/.terraform.d/plugins` directory.

```bash
$ mkdir -p ~/.terraform.d/plugins && \
curl -Ls https://api.github.com/repos/gavinbunney/terraform-provider-kubectl/releases/latest \
| jq -r ".assets[] | select(.browser_download_url | contains(\"$(uname -s | tr A-Z a-z)\")) | select(.browser_download_url | contains(\"amd64\")) | .browser_download_url" \
| xargs -n 1 curl -Lo ~/.terraform.d/plugins/terraform-provider-kubectl.zip && \
pushd ~/.terraform.d/plugins/ && \
unzip ~/.terraform.d/plugins/terraform-provider-kubectl.zip -d terraform-provider-kubectl-tmp && \
mv terraform-provider-kubectl-tmp/terraform-provider-kubectl* . && \
chmod +x terraform-provider-kubectl* && \
rm -rf terraform-provider-kubectl-tmp && \
rm -rf terraform-provider-kubectl.zip && \
popd
```

#### Install manually

If you don't want to use the one-liner above, you can download a binary for your system from the [release page](https://github.com/gavinbunney/terraform-provider-kubectl/releases),
then either place it at the root of your Terraform folder or in the Terraform plugin folder on your system.

## Configuration

The provider supports the same configuration parameters as the [Kubernetes Terraform Provider](https://www.terraform.io/docs/providers/kubernetes/index.html),
with the addition of `load_config_file` and `apply_retry_count`.

> Note: Unlike the Terraform Kubernetes Provider, this provider will load the `KUBECONFIG` file if the environment variable is set.
The provider supports the same configuration parameters as the [Kubernetes Terraform Provider](https://www.terraform.io/docs/providers/kubernetes/index.html).

```hcl
provider "kubectl" {
host = var.eks_cluster_endpoint
cluster_ca_certificate = base64decode(var.eks_cluster_ca)
token = data.aws_eks_cluster_auth.main.token
load_config_file = false
exec {
api_version = "client.authentication.k8s.io/v1beta1"
args = ["eks", "get-token", "--cluster-name", var.cluster_name]
command = "aws"
}
}
```

Expand Down Expand Up @@ -132,7 +107,6 @@ provider "kubectl" {
}
```


## Example

Loading a raw yaml manifest into kubernetes is simple, just set the `yaml_body` argument:
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/kubectl_manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This resource handles creation, deletion and even updating your kubernetes resou
Behind the scenes, this provider uses the same capability as the `kubectl apply` command, that is, you can update the YAML inline and the resource will be updated in place in kubernetes.

> **TIP:** This resource only supports a single yaml resource. If you have a list of documents in your yaml file,
> use the [kubectl_path_documents](https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/data-sources/kubectl_path_documents) data source to split the files into individual resources.
> use the [kubectl_path_documents](https://registry.terraform.io/providers/FindHotel/kubectl/latest/docs/data-sources/kubectl_path_documents) data source to split the files into individual resources.
## Example Usage

Expand Down

0 comments on commit 265409a

Please sign in to comment.