Skip to content

Commit ddb2514

Browse files
authored
Migrate the provider from the legacy SDKv2 plugin to the newer terraform plugin framework (#20)
* Migrate the provider to the terraform plugin framework * Fix the server configuration inconsistencies * Implemented better configuration reconciliation logic
1 parent 17fbe59 commit ddb2514

22 files changed

+2967
-1874
lines changed

examples/complete-gcp/main.tf

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ terraform {
55
version = "~> 5.0"
66
}
77
zenml = {
8-
source = "zenml-io/zenml"
8+
source = "zenml-io/zenml"
99
}
1010
}
1111
}
@@ -33,16 +33,16 @@ resource "google_project_service" "common_services" {
3333
"storage-api.googleapis.com",
3434
"aiplatform.googleapis.com",
3535
])
36-
service = each.key
36+
service = each.key
3737
disable_on_destroy = false
3838
}
3939

4040
# Create GCS bucket for ZenML artifacts
4141

4242
resource "google_storage_bucket" "artifacts" {
43-
name = "${var.project_id}-zenml-artifacts-${var.environment}"
44-
location = var.region
45-
depends_on = [google_project_service.common_services]
43+
name = "${var.project_id}-zenml-artifacts-${var.environment}"
44+
location = var.region
45+
depends_on = [google_project_service.common_services]
4646
force_destroy = true
4747
}
4848

@@ -104,8 +104,8 @@ resource "zenml_service_connector" "gcp" {
104104
auth_method = "service-account"
105105

106106
configuration = {
107-
project_id = var.project_id
108-
region = var.region
107+
project_id = var.project_id
108+
region = var.region
109109
service_account_json = google_service_account_key.zenml_sa_key.private_key
110110
}
111111

@@ -174,11 +174,32 @@ resource "zenml_stack" "gcp_stack" {
174174
components = {
175175
artifact_store = zenml_stack_component.artifact_store.id
176176
container_registry = zenml_stack_component.container_registry.id
177-
orchestrator = zenml_stack_component.orchestrator.id
177+
orchestrator = zenml_stack_component.orchestrator.id
178178
}
179179

180180
labels = {
181181
environment = var.environment
182182
managed_by = "terraform"
183183
}
184-
}
184+
}
185+
186+
187+
data "zenml_service_connector" "gcp" {
188+
id = zenml_service_connector.gcp.id
189+
}
190+
191+
data "zenml_stack_component" "artifact_store" {
192+
id = zenml_stack_component.artifact_store.id
193+
}
194+
195+
data "zenml_stack_component" "container_registry" {
196+
id = zenml_stack_component.container_registry.id
197+
}
198+
199+
data "zenml_stack_component" "orchestrator" {
200+
id = zenml_stack_component.orchestrator.id
201+
}
202+
203+
data "zenml_stack" "gcp_stack" {
204+
id = zenml_stack.gcp_stack.id
205+
}

go.mod

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
module terraform-provider-zenml
22

3-
go 1.23.2
3+
go 1.24.0
4+
5+
toolchain go1.24.7
46

57
require (
8+
github.com/hashicorp/go-version v1.7.0
69
github.com/hashicorp/terraform-plugin-docs v0.19.4
7-
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
10+
github.com/hashicorp/terraform-plugin-framework v1.16.1
11+
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
12+
github.com/hashicorp/terraform-plugin-go v0.29.0
13+
github.com/hashicorp/terraform-plugin-log v0.9.0
14+
github.com/hashicorp/terraform-plugin-testing v1.13.3
815
)
916

1017
require (
@@ -13,39 +20,40 @@ require (
1320
github.com/Masterminds/goutils v1.1.1 // indirect
1421
github.com/Masterminds/semver/v3 v3.2.0 // indirect
1522
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
16-
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
23+
github.com/ProtonMail/go-crypto v1.1.6 // indirect
1724
github.com/agext/levenshtein v1.2.2 // indirect
1825
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
1926
github.com/armon/go-radix v1.0.0 // indirect
2027
github.com/bgentry/speakeasy v0.1.0 // indirect
2128
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
22-
github.com/cloudflare/circl v1.3.7 // indirect
29+
github.com/cloudflare/circl v1.6.1 // indirect
2330
github.com/fatih/color v1.16.0 // indirect
2431
github.com/golang/protobuf v1.5.4 // indirect
25-
github.com/google/go-cmp v0.6.0 // indirect
32+
github.com/google/go-cmp v0.7.0 // indirect
2633
github.com/google/uuid v1.6.0 // indirect
27-
github.com/hashicorp/cli v1.1.6 // indirect
34+
github.com/hashicorp/cli v1.1.7 // indirect
2835
github.com/hashicorp/errwrap v1.1.0 // indirect
2936
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
3037
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
31-
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
32-
github.com/hashicorp/go-hclog v1.5.0 // indirect
38+
github.com/hashicorp/go-cty v1.5.0 // indirect
39+
github.com/hashicorp/go-hclog v1.6.3 // indirect
3340
github.com/hashicorp/go-multierror v1.1.1 // indirect
34-
github.com/hashicorp/go-plugin v1.6.0 // indirect
41+
github.com/hashicorp/go-plugin v1.7.0 // indirect
42+
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
3543
github.com/hashicorp/go-uuid v1.0.3 // indirect
36-
github.com/hashicorp/go-version v1.7.0 // indirect
37-
github.com/hashicorp/hc-install v0.7.0 // indirect
38-
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
44+
github.com/hashicorp/hc-install v0.9.2 // indirect
45+
github.com/hashicorp/hcl/v2 v2.23.0 // indirect
3946
github.com/hashicorp/logutils v1.0.0 // indirect
40-
github.com/hashicorp/terraform-exec v0.21.0 // indirect
41-
github.com/hashicorp/terraform-json v0.22.1 // indirect
42-
github.com/hashicorp/terraform-plugin-go v0.23.0 // indirect
43-
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
44-
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
47+
github.com/hashicorp/terraform-exec v0.23.1 // indirect
48+
github.com/hashicorp/terraform-json v0.27.1 // indirect
49+
github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1 // indirect
50+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 // indirect
51+
github.com/hashicorp/terraform-registry-address v0.4.0 // indirect
4552
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
46-
github.com/hashicorp/yamux v0.1.1 // indirect
53+
github.com/hashicorp/yamux v0.1.2 // indirect
4754
github.com/huandu/xstrings v1.3.3 // indirect
4855
github.com/imdario/mergo v0.3.15 // indirect
56+
github.com/kr/pretty v0.3.1 // indirect
4957
github.com/mattn/go-colorable v0.1.13 // indirect
5058
github.com/mattn/go-isatty v0.0.20 // indirect
5159
github.com/mattn/go-runewidth v0.0.9 // indirect
@@ -54,28 +62,31 @@ require (
5462
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
5563
github.com/mitchellh/mapstructure v1.5.0 // indirect
5664
github.com/mitchellh/reflectwalk v1.0.2 // indirect
57-
github.com/oklog/run v1.0.0 // indirect
65+
github.com/oklog/run v1.1.0 // indirect
5866
github.com/posener/complete v1.2.3 // indirect
67+
github.com/rogpeppe/go-internal v1.14.1 // indirect
5968
github.com/shopspring/decimal v1.3.1 // indirect
6069
github.com/spf13/cast v1.5.0 // indirect
6170
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
6271
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
6372
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
6473
github.com/yuin/goldmark v1.7.1 // indirect
6574
github.com/yuin/goldmark-meta v1.1.0 // indirect
66-
github.com/zclconf/go-cty v1.14.4 // indirect
75+
github.com/zclconf/go-cty v1.17.0 // indirect
6776
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
68-
golang.org/x/crypto v0.23.0 // indirect
69-
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
70-
golang.org/x/mod v0.17.0 // indirect
71-
golang.org/x/net v0.23.0 // indirect
72-
golang.org/x/sys v0.20.0 // indirect
73-
golang.org/x/text v0.15.0 // indirect
74-
golang.org/x/tools v0.13.0 // indirect
77+
golang.org/x/crypto v0.42.0 // indirect
78+
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
79+
golang.org/x/mod v0.27.0 // indirect
80+
golang.org/x/net v0.43.0 // indirect
81+
golang.org/x/sync v0.17.0 // indirect
82+
golang.org/x/sys v0.36.0 // indirect
83+
golang.org/x/text v0.29.0 // indirect
84+
golang.org/x/tools v0.36.0 // indirect
7585
google.golang.org/appengine v1.6.8 // indirect
76-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
77-
google.golang.org/grpc v1.63.2 // indirect
78-
google.golang.org/protobuf v1.34.0 // indirect
86+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
87+
google.golang.org/grpc v1.75.1 // indirect
88+
google.golang.org/protobuf v1.36.9 // indirect
89+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
7990
gopkg.in/yaml.v2 v2.3.0 // indirect
8091
gopkg.in/yaml.v3 v3.0.1 // indirect
8192
)

0 commit comments

Comments
 (0)