Skip to content

Commit b328cfa

Browse files
jaylonmcshan19-xBBBmaujrhoustoniBrandyJackson
authored
Migrate to terraform plugin framework (#1379)
Co-authored-by: Mauricio Alvarez Leon <[email protected]> Co-authored-by: John Houston <[email protected]> Co-authored-by: Brandy Jackson <[email protected]>
1 parent afc64ed commit b328cfa

27 files changed

+5141
-4176
lines changed

.changelog/1379.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:dependency
2+
Provider project ported from `terraform-plugin-sdk/v2` to `terraform-plugin-framework`
3+
```

.github/workflows/documentation-check.yaml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/tests.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ on:
33
push:
44
branches:
55
- main
6-
- helm-framework
76
pull_request:
87
branches:
98
- main
10-
- helm-framework
119

1210
env:
1311
KUBECONFIG: ${{ github.workspace }}/.kube/config
@@ -59,6 +57,7 @@ jobs:
5957
env:
6058
KUBE_CONFIG_PATH: ${{ env.KUBECONFIG }}
6159
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform_version }}
60+
TF_ACC_TEMP_DIR: ${{ runner.temp }}
6261
TESTARGS: "-parallel 1"
6362
run: |
6463
make testacc

GNUmakefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ ifneq ($(origin TRAVIS_TAG), undefined)
1515
BRANCH := $(TRAVIS_TAG)
1616
VERSION := $(TRAVIS_TAG)
1717
endif
18-
1918
# For changelog generation, default the last release to the last tag on
2019
# any branch, and this release to just be the current branch we're on.
2120
LAST_RELEASE?=$$(git describe --tags $$(git rev-list --tags --max-count=1))

docs/data-sources/template.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,22 @@ data "helm_template" "mariadb_instance" {
140140
chart = "mariadb"
141141
version = "7.1.0"
142142
143-
set {
144-
name = "service.port"
145-
value = "13306"
146-
}
147-
148-
set_sensitive {
149-
name = "rootUser.password"
150-
value = "s3cr3t!"
151-
}
143+
set = [
144+
{
145+
name = "service.port"
146+
value = "13306"
147+
}
148+
]
149+
150+
set_sensitive = [
151+
{
152+
name = "rootUser.password"
153+
value = "s3cr3t!"
154+
}
155+
]
152156
}
153157
158+
154159
resource "local_file" "mariadb_manifests" {
155160
for_each = data.helm_template.mariadb_instance.manifests
156161
@@ -188,18 +193,23 @@ data "helm_template" "mariadb_instance" {
188193
"templates/master-statefulset.yaml",
189194
"templates/master-svc.yaml",
190195
]
191-
192-
set {
193-
name = "service.port"
194-
value = "13306"
195-
}
196-
197-
set_sensitive {
198-
name = "rootUser.password"
199-
value = "s3cr3t!"
200-
}
196+
197+
set = [
198+
{
199+
name = "service.port"
200+
value = "13306"
201+
}
202+
]
203+
204+
set_sensitive = [
205+
{
206+
name = "rootUser.password"
207+
value = "s3cr3t!"
208+
}
209+
]
201210
}
202211
212+
203213
resource "local_file" "mariadb_manifests" {
204214
for_each = data.helm_template.mariadb_instance.manifests
205215
@@ -219,3 +229,4 @@ output "mariadb_instance_notes" {
219229
value = data.helm_template.mariadb_instance.notes
220230
}
221231
```
232+

docs/guides/v3-upgrade-guide.md

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
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

Comments
 (0)