|
| 1 | +--- |
| 2 | +layout: "helm" |
| 3 | +page_title: "Helm: Upgrade Guide for Helm Provider v3.0.0" |
| 4 | +description: |- |
| 5 | + This guide covers the changes introduced in v3.0.0 of the Helm provider and what you may need to do to upgrade your configuration. |
| 6 | +--- |
| 7 | + |
| 8 | +# Upgrading to v3.0.0 of the Helm provider |
| 9 | + |
| 10 | + |
| 11 | +This guide covers the changes introduced in v3.0.0 of the Helm provider and what you may need to do to upgrade your configuration. |
| 12 | + |
| 13 | +## Changes in v3.0.0 |
| 14 | + |
| 15 | +### Adoption of the Terraform Plugin Framework |
| 16 | + |
| 17 | +The Helm provider has been migrated from the legacy [Terraform Plugin SDKv2](https://github.com/hashicorp/terraform-plugin-sdk) to the [Terraform Plugin Framework](https://github.com/hashicorp/terraform-plugin-framework). This migration introduces structural changes to the schema, affecting nested blocks, attribute names, and how configurations are represented. Users must update their configurations to align with the new framework. Key changes include: |
| 18 | + |
| 19 | +- **Blocks to Nested Objects**: Blocks like `kubernetes`, `registry`, and `experiments` are now represented as nested objects. |
| 20 | +- **List Syntax for Nested Attributes**: Attributes like `set`, `set_list`, and `set_sensitive` in `helm_release` and `helm_template` are now lists of nested objects instead of blocks. |
| 21 | + |
| 22 | +### Terraform Version Compatability |
| 23 | + |
| 24 | +The new framework code uses [Terraform Plugin Protocol Version 6](https://developer.hashicorp.com/terraform/plugin/terraform-plugin-protocol#protocol-version-6) which is compatible with Terraform versions 1.0 and aboove. Users of earlier versions of Terraform can continue to use the Helm provider by pinning their configuration to the 2.x version. |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +### Changes to Provider Attributes |
| 29 | + |
| 30 | +#### Kubernetes Configuration (`kubernetes`) |
| 31 | + |
| 32 | +The `kubernetes` block has been updated to a single nested object. |
| 33 | + |
| 34 | +**Old SDKv2 Configuration:** |
| 35 | + |
| 36 | +```hcl |
| 37 | +provider "helm" { |
| 38 | + kubernetes { |
| 39 | + config_path = "~/.kube/config" |
| 40 | + } |
| 41 | +
|
| 42 | + registry { |
| 43 | + url = "oci://localhost:5000" |
| 44 | + username = "username" |
| 45 | + password = "password" |
| 46 | + } |
| 47 | +
|
| 48 | + registry { |
| 49 | + url = "oci://private.registry" |
| 50 | + username = "username" |
| 51 | + password = "password" |
| 52 | + } |
| 53 | +} |
| 54 | +``` |
| 55 | + |
| 56 | +**New Plugin Framework Configuration:** |
| 57 | + |
| 58 | +```hcl |
| 59 | +provider "helm" { |
| 60 | + kubernetes = { |
| 61 | + config_path = "~/.kube/config" |
| 62 | + } |
| 63 | +
|
| 64 | + registries = [ |
| 65 | + { |
| 66 | + url = "oci://localhost:5000" |
| 67 | + username = "username" |
| 68 | + password = "password" |
| 69 | + }, |
| 70 | + { |
| 71 | + url = "oci://private.registry" |
| 72 | + username = "username" |
| 73 | + password = "password" |
| 74 | + } |
| 75 | + ] |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +**What Changed?** |
| 80 | + |
| 81 | +- `kubernetes` is now a single nested object attribute using `{ ... }`. |
| 82 | +- `registry` blocks have been replaced by a `registries` list attribute. |
| 83 | + |
| 84 | +#### Experiments Configuration (experiments) |
| 85 | + |
| 86 | +The `experiments` block has been updated to a list of nested objects. |
| 87 | + |
| 88 | +**Old SDKv2 Configuration:** |
| 89 | + |
| 90 | +```hcl |
| 91 | +provider "helm" { |
| 92 | + experiments { |
| 93 | + manifest = true |
| 94 | + } |
| 95 | +} |
| 96 | +``` |
| 97 | + |
| 98 | +**New Plugin Framework Configuration:** |
| 99 | + |
| 100 | +```hcl |
| 101 | +provider "helm" { |
| 102 | + experiments = { |
| 103 | + manifest = true |
| 104 | + } |
| 105 | +} |
| 106 | +``` |
| 107 | + |
| 108 | +**What Changed?** |
| 109 | + |
| 110 | +- `experiments` is now a single nested object attribute using `{ ... }`. |
| 111 | + |
| 112 | +### Changes to helm_release Resource |
| 113 | + |
| 114 | +#### `set`, `set_list`, and `set_sensitive` Configuration |
| 115 | + |
| 116 | +Attributes `set`, `set_list`, and `set_sensitive` are now represented as lists of nested objects instead of individual blocks. |
| 117 | + |
| 118 | +**Old SDKv2 Configuration:** |
| 119 | + |
| 120 | +```hcl |
| 121 | +resource "helm_release" "nginx_ingress" { |
| 122 | + name = "nginx-ingress-controller" |
| 123 | +
|
| 124 | + repository = "https://charts.bitnami.com/bitnami" |
| 125 | + chart = "nginx-ingress-controller" |
| 126 | +
|
| 127 | + set { |
| 128 | + name = "service.type" |
| 129 | + value = "ClusterIP" |
| 130 | + } |
| 131 | +
|
| 132 | + set_list { |
| 133 | + name = "allowed.hosts" |
| 134 | + value = ["host1", "host2"] |
| 135 | + } |
| 136 | +
|
| 137 | + set_sensitive { |
| 138 | + name = "api.key" |
| 139 | + value = "super-secret-key" |
| 140 | + } |
| 141 | +} |
| 142 | +``` |
| 143 | + |
| 144 | +**New Plugin Framework Configuration:** |
| 145 | + |
| 146 | +```hcl |
| 147 | +resource "helm_release" "nginx_ingress" { |
| 148 | + name = "nginx-ingress-controller" |
| 149 | +
|
| 150 | + repository = "https://charts.bitnami.com/bitnami" |
| 151 | + chart = "nginx-ingress-controller" |
| 152 | +
|
| 153 | + set = [ |
| 154 | + { |
| 155 | + name = "service.type" |
| 156 | + value = "ClusterIP" |
| 157 | + } |
| 158 | + ] |
| 159 | +
|
| 160 | + set_list = [ |
| 161 | + { |
| 162 | + name = "allowed.hosts" |
| 163 | + value = ["host1", "host2"] |
| 164 | + } |
| 165 | + ] |
| 166 | +
|
| 167 | + set_sensitive = [ |
| 168 | + { |
| 169 | + name = "api.key" |
| 170 | + value = "super-secret-key" |
| 171 | + } |
| 172 | + ] |
| 173 | +} |
| 174 | +``` |
| 175 | + |
| 176 | +**What Changed?** |
| 177 | + |
| 178 | +- `set`, `set_list`, and `set_sensitive` is now a list of nested objects using `[ { ... } ]`. |
| 179 | + |
| 180 | +### Changes to helm_template Data Source |
| 181 | + |
| 182 | +#### `set`, `set_list`, and `set_sensitive` Configuration |
| 183 | + |
| 184 | +Attributes `set`, `set_list`, and `set_sensitive` are now represented as lists of nested objects instead of individual blocks. |
| 185 | + |
| 186 | +**Old SDKv2 Configuration:** |
| 187 | + |
| 188 | +```hcl |
| 189 | +data "helm_template" "example" { |
| 190 | + name = "my-release" |
| 191 | + chart = "my-chart" |
| 192 | + namespace = "my-namespace" |
| 193 | + values = ["custom-values.yaml"] |
| 194 | +
|
| 195 | + set { |
| 196 | + name = "image.tag" |
| 197 | + value = "1.2.3" |
| 198 | + } |
| 199 | +
|
| 200 | + set_list { |
| 201 | + name = "allowed.hosts" |
| 202 | + value = ["host1", "host2"] |
| 203 | + } |
| 204 | +
|
| 205 | + set_sensitive { |
| 206 | + name = "api.key" |
| 207 | + value = "super-secret-key" |
| 208 | + } |
| 209 | +} |
| 210 | +``` |
| 211 | + |
| 212 | +**New Plugin Framework Configuration:** |
| 213 | + |
| 214 | +```hcl |
| 215 | +data "helm_template" "example" { |
| 216 | + name = "my-release" |
| 217 | + chart = "my-chart" |
| 218 | + namespace = "my-namespace" |
| 219 | + values = ["custom-values.yaml"] |
| 220 | +
|
| 221 | + set = [ |
| 222 | + { |
| 223 | + name = "image.tag" |
| 224 | + value = "1.2.3" |
| 225 | + } |
| 226 | + ] |
| 227 | +
|
| 228 | + set_list = [ |
| 229 | + { |
| 230 | + name = "allowed.hosts" |
| 231 | + value = ["host1", "host2"] |
| 232 | + } |
| 233 | + ] |
| 234 | +
|
| 235 | + set_sensitive = [ |
| 236 | + { |
| 237 | + name = "api.key" |
| 238 | + value = "super-secret-key" |
| 239 | + } |
| 240 | + ] |
| 241 | +} |
| 242 | +``` |
| 243 | + |
| 244 | +**What Changed?** |
| 245 | + |
| 246 | +- `set`, `set_list`, and `set_sensitive` is now a list of nested objects using `[ { ... } ]`. |
0 commit comments