Skip to content

Commit

Permalink
Updating resource and data source documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JaylonmcShan03 committed Jan 13, 2025
1 parent 6e7b135 commit c896dd7
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 79 deletions.
48 changes: 29 additions & 19 deletions docs/data-sources/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,22 @@ data "helm_template" "mariadb_instance" {
chart = "mariadb"
version = "7.1.0"
set {
name = "service.port"
value = "13306"
}
set_sensitive {
name = "rootUser.password"
value = "s3cr3t!"
}
set = [
{
name = "service.port"
value = "13306"
}
]
set_sensitive = [
{
name = "rootUser.password"
value = "s3cr3t!"
}
]
}
resource "local_file" "mariadb_manifests" {
for_each = data.helm_template.mariadb_instance.manifests
Expand Down Expand Up @@ -188,18 +193,23 @@ data "helm_template" "mariadb_instance" {
"templates/master-statefulset.yaml",
"templates/master-svc.yaml",
]
set {
name = "service.port"
value = "13306"
}
set_sensitive {
name = "rootUser.password"
value = "s3cr3t!"
}
set = [
{
name = "service.port"
value = "13306"
}
]
set_sensitive = [
{
name = "rootUser.password"
value = "s3cr3t!"
}
]
}
resource "local_file" "mariadb_manifests" {
for_each = data.helm_template.mariadb_instance.manifests
Expand Down
62 changes: 36 additions & 26 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,35 @@ Try the [hands-on tutorial](https://learn.hashicorp.com/tutorials/terraform/helm

```terraform
provider "helm" {
kubernetes {
kubernetes = {
config_path = "~/.kube/config"
}
# localhost registry with password protection
registry {
url = "oci://localhost:5000"
username = "username"
password = "password"
}
# private registry
registry {
url = "oci://private.registry"
username = "username"
password = "password"
}
registries = [
{
url = "oci://localhost:5000"
username = "username"
password = "password"
},
{
url = "oci://private.registry"
username = "username"
password = "password"
}
]
}
resource "helm_release" "nginx_ingress" {
name = "nginx-ingress-controller"
repository = "https://charts.bitnami.com/bitnami"
chart = "nginx-ingress-controller"
set {
name = "service.type"
value = "ClusterIP"
}
set = [
{
name = "service.type"
value = "ClusterIP"
}
]
}
```

Expand Down Expand Up @@ -80,7 +80,7 @@ The easiest way is to supply a path to your kubeconfig file using the `config_pa

```terraform
provider "helm" {
kubernetes {
kubernetes = {
config_path = "~/.kube/config"
}
}
Expand All @@ -90,7 +90,7 @@ The provider also supports multiple paths in the same way that kubectl does usin

```terraform
provider "helm" {
kubernetes {
kubernetes = {
config_paths = [
"/path/to/config_a.yaml",
"/path/to/config_b.yaml"
Expand All @@ -104,7 +104,7 @@ provider "helm" {
You can also configure the host, basic auth credentials, and client certificate authentication explicitly or through environment variables.

```terraform
provider "helm" {
provider "helm" = {
kubernetes {
host = "https://cluster_endpoint:port"
Expand All @@ -127,7 +127,7 @@ Some cloud providers have short-lived authentication tokens that can expire rela

```terraform
provider "helm" {
kubernetes {
kubernetes = {
host = var.cluster_endpoint
cluster_ca_certificate = base64decode(var.cluster_ca_cert)
exec {
Expand All @@ -143,7 +143,7 @@ For example, to [authenticate with GKE](https://registry.terraform.io/providers/

```terraform
provider "helm" {
kubernetes{
kubernetes = {
host = "https://${data.google_container_cluster.my_cluster.endpoint}"
token = data.google_client_config.provider.access_token
cluster_ca_certificate = base64decode(
Expand All @@ -168,7 +168,7 @@ The following arguments are supported:
* `helm_driver` - (Optional) "The backend storage driver. Valid values are: `configmap`, `secret`, `memory`, `sql`. Defaults to `secret`. Note: Regarding the sql driver, as of helm v3.2.0 SQL support exists only for the postgres dialect. The connection string can be configured by setting the `HELM_DRIVER_SQL_CONNECTION_STRING` environment variable e.g. `HELM_DRIVER_SQL_CONNECTION_STRING=postgres://username:password@host/dbname` more info [here](https://pkg.go.dev/github.com/lib/pq).
* `burst_limit` - (Optional) The helm burst limit to use. Set this value higher if your cluster has many CRDs. Default: `100`
* `kubernetes` - Kubernetes configuration block.
* `registry` - Private OCI registry configuration block. Can be specified multiple times.
* `registries` - Private OCI registry configuration block. Can be specified multiple times.

The `kubernetes` block supports:

Expand All @@ -191,7 +191,7 @@ The `kubernetes` block supports:
* `args` - (Optional) List of arguments to pass when executing the plugin.
* `env` - (Optional) Map of environment variables to set when executing the plugin.

The `registry` block has options:
The `registries` block has options:

* `url` - (Required) url to the registry in format `oci://host:port`
* `username` - (Required) username to registry
Expand All @@ -202,3 +202,13 @@ The `registry` block has options:
The provider takes an `experiments` block that allows you enable experimental features by setting them to `true`.

* `manifest` - Enable storing of the rendered manifest for `helm_release` so the full diff of what is changing can been seen in the plan.

```terraform
provider "helm" {
experiments = [
{
manifest = true
}
]
}
```
75 changes: 41 additions & 34 deletions docs/resources/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,25 +144,24 @@ resource "helm_release" "example" {
chart = "redis"
version = "6.0.1"
values = [
"${file("values.yaml")}"
set = [
{
name = "cluster.enabled"
value = "true"
},
{
name = "metrics.enabled"
value = "true"
}
]
set {
name = "cluster.enabled"
value = "true"
}
set {
name = "metrics.enabled"
value = "true"
}
set {
name = "service.annotations.prometheus\\.io/port"
value = "9127"
type = "string"
}
set = [
{
name = "service.annotations.prometheus\\.io/port"
value = "9127"
type = "string"
}
]
}
```

Expand Down Expand Up @@ -194,16 +193,17 @@ Provider supports grabbing charts from an OCI repository:

```terraform
provider "helm" {
kubernetes {
kubernetes = {
config_path = "~/.kube/config"
}
# localhost registry with password protection
registry {
url = "oci://localhost:5000"
username = "username"
password = "password"
}
registries = [
{
url = "oci://localhost:5000"
username = "username"
password = "password"
}
]
}
resource "helm_release" "example" {
Expand Down Expand Up @@ -295,17 +295,21 @@ The `set`, `set_list`, and `set_sensitive` blocks support:
Since Terraform Utilizes HCL as well as Helm using the Helm Template Language, it's necessary to escape the `{}`, `[]`, `.`, and `,` characters twice in order for it to be parsed. `name` should also be set to the `value path`, and `value` is the desired value that will be set.

```terraform
set {
name = "grafana.ingress.annotations.alb\\.ingress\\.kubernetes\\.io/group\\.name"
value = "shared-ingress"
}
set = [
{
name = "grafana.ingress.annotations.alb\\.ingress\\.kubernetes\\.io/group\\.name"
value = "shared-ingress"
}
]
```

```terraform
set_list {
name = "hashicorp"
value = ["terraform", "nomad", "vault"]
}
set_list = [
{
name = "hashicorp"
value = ["terraform", "nomad", "vault"]
}
]
```

```terraform
Expand All @@ -316,10 +320,13 @@ controller:
```

```terraform
set {
set = [
{
name = "controller.pod.annotations.status\\.kubernetes\\.io/restart-on-failure"
value = "\\{\"timeout\": \"30s\"\\}"
}
}
]
```

The `postrender` block supports two attributes:
Expand Down

0 comments on commit c896dd7

Please sign in to comment.