Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to terraform plugin framework #1379

Merged
merged 74 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
c22dd4b
Added provider configure function
JaylonmcShan03 Jun 4, 2024
52a96f9
Added GetHelmConfiguration, and it's helper functions
JaylonmcShan03 Jun 5, 2024
388ef65
updates
JaylonmcShan03 Jun 5, 2024
a4af42e
Removed extra comments, utilized calling expandStringSlice
JaylonmcShan03 Jun 6, 2024
ee8b910
Defined the schema, and data models for the resource_release
JaylonmcShan03 Jun 7, 2024
101c66a
data_template data source
JaylonmcShan03 Jun 7, 2024
0dc3727
Updated OCIRegistryLogin call and added descriptions to the structs d…
JaylonmcShan03 Jun 13, 2024
ea4785e
Adding test file for data_template
JaylonmcShan03 Jun 24, 2024
73212e4
Committing changes for resource testing
JaylonmcShan03 Jul 8, 2024
5586c0c
adding working tree for debugging purposes
JaylonmcShan03 Jul 22, 2024
ff8b9a5
Up to date version of migration work
JaylonmcShan03 Aug 19, 2024
184f534
Tidying up
JaylonmcShan03 Aug 21, 2024
0ac3ca0
Release tidy (#1465)
jrhouston Aug 21, 2024
4ee3c14
FIX: use correct split delimiter on KUBE_CONFIG_PATHS value (#1466)
jrhouston Aug 21, 2024
0bd53da
Tidying up during code review (#1467)
jrhouston Aug 26, 2024
7b6c65a
Fix acronyms in struct field names in kubeConfig.go and provider.go (…
JaylonmcShan03 Aug 28, 2024
3a229e2
Creating bool debug (#1469)
JaylonmcShan03 Aug 28, 2024
8d76a02
refactor: rename 'registry' field to 'registries' for consistency wit…
JaylonmcShan03 Aug 29, 2024
d17ecd2
Refactor `ModifyPlan` function in `helm_release.go` (1/2) (#1471)
BBBmau Aug 30, 2024
dda5489
refactor: alphabetize schema attributes in HelmReleaseResource (#1473)
JaylonmcShan03 Sep 4, 2024
1a08700
Rename resolveChartName to buildChartNameWithRepository for clarity (…
JaylonmcShan03 Sep 4, 2024
0585e0b
Refactor: Change model references from 'd' to 'model' for consistency…
JaylonmcShan03 Sep 5, 2024
f96b0be
Refactor: Rename struct fields in HelmReleaseModel to CamelCase (#1479)
JaylonmcShan03 Sep 5, 2024
9c6cca3
Refactor: Rename SetListList to SetListSlice (#1480)
JaylonmcShan03 Sep 5, 2024
e3be2ca
Sort defaultAttributes map and improve schema default handling (#1482)
JaylonmcShan03 Sep 10, 2024
8c0a73c
`framework-migration`: m.lock removal and more (#1490)
BBBmau Sep 18, 2024
e90d17a
Rename resource names (#1494)
JaylonmcShan03 Oct 4, 2024
402c55a
Remove old state upgrader code (#1505)
jrhouston Oct 23, 2024
906ade5
Tidy up import function (#1506)
jrhouston Oct 23, 2024
1736961
Remove blocks from helm_release resource and data source schemas (#1507)
jrhouston Oct 23, 2024
1f41f6e
Add godoc comments to structs (#1508)
jrhouston Oct 23, 2024
b8c5d3b
Including mutex as part of meta
JaylonmcShan03 Oct 23, 2024
a5adaac
Fixing Mut > Mutex
JaylonmcShan03 Oct 23, 2024
b8ccb31
Tidying up struct names, AddError message, and Schema
JaylonmcShan03 Oct 24, 2024
200a4d8
Tidying up IncludeCrds > IncludeCRDs
JaylonmcShan03 Oct 24, 2024
335aa4c
add first_deployed and last_deployed timestamp fields to Helm release…
JaylonmcShan03 Oct 25, 2024
182ef70
`helm-framework`: refactor `metadata` from `ListNestedAttribute` -> `…
BBBmau Oct 25, 2024
911a327
`helm-framework`: ModifyPlan refactor 2 (#1514)
BBBmau Oct 25, 2024
96559f7
Fix failing template tests (#1512)
jrhouston Oct 25, 2024
fbcf22d
Removing fmt.Println
JaylonmcShan03 Oct 24, 2024
cdfd17f
Updated function to hash and replace sensitive values using
JaylonmcShan03 Oct 25, 2024
82f3522
Removing set_sensitiveResourceModel
JaylonmcShan03 Oct 28, 2024
537e2a3
Add custom default for namespace
JaylonmcShan03 Oct 28, 2024
ecfd80f
Removing an attribute that is not defined in the schema from HelmTemp…
JaylonmcShan03 Nov 11, 2024
0a934ed
Update set and set_list blocks to use list-of-maps in test configurat…
JaylonmcShan03 Nov 11, 2024
bd56c7b
Removing marshaling and unmarshaling and replacing with maps.clone
JaylonmcShan03 Oct 29, 2024
6714731
Adding documentation strings for the config_context fields
JaylonmcShan03 Oct 29, 2024
4d9c7cf
Refactor exec block from List to SingleNestedAttribute in KubernetesC…
JaylonmcShan03 Jan 7, 2025
905cf39
The current state of helm_template with test passing (#1532)
JaylonmcShan03 Jan 7, 2025
65ed46c
Remove binary file
jrhouston Jan 7, 2025
f8d14e8
Fix import state test. ListUnkown > ListNull
JaylonmcShan03 Jan 7, 2025
9de6787
Fix updateAfterFail test
jrhouston Jan 7, 2025
1caa9ae
Removing sdkv2 code, and replacing with framework
JaylonmcShan03 Jan 10, 2025
9d786c9
Adding headers to framework files
JaylonmcShan03 Jan 10, 2025
6ba4877
Migration guide (Documentation)
JaylonmcShan03 Jan 13, 2025
6e7b135
Update v3-upgrade-guide.md
iBrandyJackson Jan 13, 2025
c896dd7
Updating resource and data source documentation
JaylonmcShan03 Jan 13, 2025
bd21dee
Fixing documentation lint failures
JaylonmcShan03 Jan 14, 2025
1cd343a
Change experiments from List to Object
jrhouston Jan 14, 2025
2c3d527
Fix typing issue
jrhouston Jan 14, 2025
94874e6
Remove documentation check
jrhouston Jan 14, 2025
a334109
Add back testing and test-infra directories
jrhouston Jan 14, 2025
4bd51c7
Add version argument to provider.New
jrhouston Jan 14, 2025
d303454
Fix missing version in tests
jrhouston Jan 14, 2025
7abf3f5
Fix deferred actions test fixture
jrhouston Jan 15, 2025
1c4864f
Add changelog entry
jrhouston Jan 15, 2025
7caeb6b
Enable deferred actions in provider.Configure
jrhouston Jan 15, 2025
88de95a
Fix experiments syntax in tests
jrhouston Jan 15, 2025
5d92f94
Fix experiments schema
jrhouston Jan 15, 2025
e06e7b2
Remove helm-framework branch from acctest action
jrhouston Jan 15, 2025
47e6b74
Set TF_ACC_TEMP_DIR in acctest action
jrhouston Jan 15, 2025
f7482a3
Add note about protocol v6 to upgrade guide
jrhouston Jan 16, 2025
959e4da
Fix markdown linter issue
jrhouston Jan 16, 2025
56f44a8
Refactor parallelism test
jrhouston Jan 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/1379.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:dependency
Provider project ported from `terraform-plugin-sdk/v2` to `terraform-plugin-framework`
```
42 changes: 0 additions & 42 deletions .github/workflows/documentation-check.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ on:
push:
branches:
- main
- helm-framework
pull_request:
branches:
- main
- helm-framework

env:
KUBECONFIG: ${{ github.workspace }}/.kube/config
Expand Down Expand Up @@ -59,6 +57,7 @@ jobs:
env:
KUBE_CONFIG_PATH: ${{ env.KUBECONFIG }}
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform_version }}
TF_ACC_TEMP_DIR: ${{ runner.temp }}
TESTARGS: "-parallel 1"
run: |
make testacc
1 change: 0 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ ifneq ($(origin TRAVIS_TAG), undefined)
BRANCH := $(TRAVIS_TAG)
VERSION := $(TRAVIS_TAG)
endif

# For changelog generation, default the last release to the last tag on
# any branch, and this release to just be the current branch we're on.
LAST_RELEASE?=$$(git describe --tags $$(git rev-list --tags --max-count=1))
Expand Down
49 changes: 30 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 All @@ -219,3 +229,4 @@ output "mariadb_instance_notes" {
value = data.helm_template.mariadb_instance.notes
}
```

246 changes: 246 additions & 0 deletions docs/guides/v3-upgrade-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
---
layout: "helm"
page_title: "Helm: Upgrade Guide for Helm Provider v3.0.0"
description: |-
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.
---

# Upgrading to v3.0.0 of the Helm provider


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.

## Changes in v3.0.0

### Adoption of the Terraform Plugin Framework

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:

- **Blocks to Nested Objects**: Blocks like `kubernetes`, `registry`, and `experiments` are now represented as nested objects.
- **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.

### Terraform Version Compatability

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.

---

### Changes to Provider Attributes

#### Kubernetes Configuration (`kubernetes`)

The `kubernetes` block has been updated to a single nested object.

**Old SDKv2 Configuration:**

```hcl
provider "helm" {
kubernetes {
config_path = "~/.kube/config"
}

registry {
url = "oci://localhost:5000"
username = "username"
password = "password"
}

registry {
url = "oci://private.registry"
username = "username"
password = "password"
}
}
```

**New Plugin Framework Configuration:**

```hcl
provider "helm" {
kubernetes = {
config_path = "~/.kube/config"
}

registries = [
{
url = "oci://localhost:5000"
username = "username"
password = "password"
},
{
url = "oci://private.registry"
username = "username"
password = "password"
}
]
}
```

**What Changed?**

- `kubernetes` is now a single nested object attribute using `{ ... }`.
- `registry` blocks have been replaced by a `registries` list attribute.

#### Experiments Configuration (experiments)

The `experiments` block has been updated to a list of nested objects.

**Old SDKv2 Configuration:**

```hcl
provider "helm" {
experiments {
manifest = true
}
}
```

**New Plugin Framework Configuration:**

```hcl
provider "helm" {
experiments = {
manifest = true
}
}
```

**What Changed?**

- `experiments` is now a single nested object attribute using `{ ... }`.

### Changes to helm_release Resource

#### `set`, `set_list`, and `set_sensitive` Configuration

Attributes `set`, `set_list`, and `set_sensitive` are now represented as lists of nested objects instead of individual blocks.

**Old SDKv2 Configuration:**

```hcl
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_list {
name = "allowed.hosts"
value = ["host1", "host2"]
}

set_sensitive {
name = "api.key"
value = "super-secret-key"
}
}
```

**New Plugin Framework Configuration:**

```hcl
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_list = [
{
name = "allowed.hosts"
value = ["host1", "host2"]
}
]

set_sensitive = [
{
name = "api.key"
value = "super-secret-key"
}
]
}
```

**What Changed?**

- `set`, `set_list`, and `set_sensitive` is now a list of nested objects using `[ { ... } ]`.

### Changes to helm_template Data Source

#### `set`, `set_list`, and `set_sensitive` Configuration

Attributes `set`, `set_list`, and `set_sensitive` are now represented as lists of nested objects instead of individual blocks.

**Old SDKv2 Configuration:**

```hcl
data "helm_template" "example" {
name = "my-release"
chart = "my-chart"
namespace = "my-namespace"
values = ["custom-values.yaml"]

set {
name = "image.tag"
value = "1.2.3"
}

set_list {
name = "allowed.hosts"
value = ["host1", "host2"]
}

set_sensitive {
name = "api.key"
value = "super-secret-key"
}
}
```

**New Plugin Framework Configuration:**

```hcl
data "helm_template" "example" {
name = "my-release"
chart = "my-chart"
namespace = "my-namespace"
values = ["custom-values.yaml"]

set = [
{
name = "image.tag"
value = "1.2.3"
}
]

set_list = [
{
name = "allowed.hosts"
value = ["host1", "host2"]
}
]

set_sensitive = [
{
name = "api.key"
value = "super-secret-key"
}
]
}
```

**What Changed?**

- `set`, `set_list`, and `set_sensitive` is now a list of nested objects using `[ { ... } ]`.
Loading
Loading