TRITON-2494

Upgrade triton terraform provider to SDK v2

Status:
Resolved
Created:
2025-07-23T06:25:26.345-0400
Updated:
2025-08-15T08:29:41.335-0400

Description

Summary

Follow v2-upgrade-guide to upgradeterraform-provider-triton to SDK v2.

The goal is to make the triton terraform provider (aka plugin) and all tests work with SDK v2 first, then continue to migrate the provider to the latest terraform plugin framework.

Migration path

terraform plugin SDK v1 (current status) → terraform plugin SDK v2 → terraform plugin framework

Why upgrade?

While it would be possible to maintain the provider with SDKv2, the ecosystem has moved on and critical parts did not exist when this SDK was written. One important example I came across is that terraform today can distinguish between a value that is null (not set) and a value that is empty. This feature did not exist before, and only the terraform plugin framework supports it.

Comments (1)

Jhonas Wernery commented on 2025-07-23T07:11:32.321-0400 (edited 2025-07-23T11:27:30.920-0400):

Testing notes

Confirmed that all tests pass on the latest commit in 142

❯ make test
==> Checking that code complies with gofmt requirements...
go test -i $(go list ./...) || exit 1
?   	github.com/TritonDataCenter/terraform-provider-triton	[no test files]
echo $(go list ./...) | \
	xargs -t -n4 go test  -timeout=30s -parallel=4
go test '-timeout=30s' '-parallel=4' github.com/TritonDataCenter/terraform-provider-triton github.com/TritonDataCenter/terraform-provider-triton/triton
?   	github.com/TritonDataCenter/terraform-provider-triton	[no test files]
ok  	github.com/TritonDataCenter/terraform-provider-triton/triton	0.067s

❯ make testacc
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./...) -v  -timeout 120m
?   	github.com/TritonDataCenter/terraform-provider-triton	[no test files]
=== RUN   TestAccTritonAccount
--- PASS: TestAccTritonAccount (7.40s)
=== RUN   TestAccTritonDataCenter
--- PASS: TestAccTritonDataCenter (5.32s)
=== RUN   TestAccTritonFabricNetwork_MissingArguments
--- PASS: TestAccTritonFabricNetwork_MissingArguments (0.11s)
=== RUN   TestAccTritonFabricNetwork_BadArguments
--- PASS: TestAccTritonFabricNetwork_BadArguments (0.11s)
=== RUN   TestAccTritonFabricNetwork_NotFound
--- PASS: TestAccTritonFabricNetwork_NotFound (7.49s)
=== RUN   TestAccTritonFabricNetwork_Basic
--- PASS: TestAccTritonFabricNetwork_Basic (22.69s)
=== RUN   TestAccTritonFabricVLAN_MissingArguments
--- PASS: TestAccTritonFabricVLAN_MissingArguments (0.34s)
=== RUN   TestAccTritonFabricVLAN_BadArguments
--- PASS: TestAccTritonFabricVLAN_BadArguments (0.11s)
=== RUN   TestAccTritonFabricVLAN_Basic
--- PASS: TestAccTritonFabricVLAN_Basic (12.79s)
=== RUN   TestAccTritonFabricVLAN_WildCard
--- PASS: TestAccTritonFabricVLAN_WildCard (13.30s)
=== RUN   TestAccTritonFabricVLAN_Filters
--- PASS: TestAccTritonFabricVLAN_Filters (13.94s)
=== RUN   TestAccTritonFabricVLAN_NotFound
--- PASS: TestAccTritonFabricVLAN_NotFound (1.00s)
=== RUN   TestAccTritonFabricVLAN_FiltersNotFound
--- PASS: TestAccTritonFabricVLAN_FiltersNotFound (8.61s)
=== RUN   TestAccTritonFabricVLAN_MultipleFound
--- PASS: TestAccTritonFabricVLAN_MultipleFound (8.47s)
=== RUN   TestAccTritonImage_multipleResults
--- PASS: TestAccTritonImage_multipleResults (0.92s)
=== RUN   TestAccTritonImage_noResults
--- PASS: TestAccTritonImage_noResults (0.94s)
=== RUN   TestAccTritonImage_mostRecent
--- PASS: TestAccTritonImage_mostRecent (5.62s)
=== RUN   TestAccTritonImage_nameVersionAndMostRecent
--- PASS: TestAccTritonImage_nameVersionAndMostRecent (4.98s)
=== RUN   TestAccTritonNetwork_Basic
--- PASS: TestAccTritonNetwork_Basic (14.40s)
=== RUN   TestAccTritonNetwork_NotFound
--- PASS: TestAccTritonNetwork_NotFound (1.36s)
=== RUN   TestAccTritonPackage_basic
--- PASS: TestAccTritonPackage_basic (5.37s)
=== RUN   TestAccTritonDataVolume_basic
--- PASS: TestAccTritonDataVolume_basic (94.41s)
=== RUN   TestAccTritonDataVolume_noResults
--- PASS: TestAccTritonDataVolume_noResults (0.94s)
=== RUN   TestAccTritonDataVolume_BadSize
--- PASS: TestAccTritonDataVolume_BadSize (0.11s)
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestFabricMigrateState
--- PASS: TestFabricMigrateState (0.00s)
=== RUN   TestAccTritonFabric_basic
--- PASS: TestAccTritonFabric_basic (23.00s)
=== RUN   TestAccTritonFirewallRule_basic
--- PASS: TestAccTritonFirewallRule_basic (7.01s)
=== RUN   TestAccTritonFirewallRule_update
--- PASS: TestAccTritonFirewallRule_update (13.59s)
=== RUN   TestAccTritonFirewallRule_enable
--- PASS: TestAccTritonFirewallRule_enable (13.84s)
=== RUN   TestAccTritonFirewallRule_heredoc
--- PASS: TestAccTritonFirewallRule_heredoc (6.27s)
=== RUN   TestAccTritonKey_basic
--- PASS: TestAccTritonKey_basic (23.54s)
=== RUN   TestAccTritonKey_noKeyName
--- PASS: TestAccTritonKey_noKeyName (16.95s)
=== RUN   TestAccTritonMachine_basic
--- PASS: TestAccTritonMachine_basic (131.00s)
=== RUN   TestAccTritonMachine_affinity
--- PASS: TestAccTritonMachine_affinity (93.79s)
=== RUN   TestAccTritonMachine_dns
--- PASS: TestAccTritonMachine_dns (132.52s)
=== RUN   TestAccTritonMachine_nic
--- PASS: TestAccTritonMachine_nic (112.24s)
=== RUN   TestAccTritonMachine_addNIC
--- PASS: TestAccTritonMachine_addNIC (348.21s)
=== RUN   TestAccTritonMachine_firewall
--- PASS: TestAccTritonMachine_firewall (119.56s)
=== RUN   TestAccTritonMachine_metadata
--- PASS: TestAccTritonMachine_metadata (240.83s)
=== RUN   TestAccTritonMachine_cns
--- PASS: TestAccTritonMachine_cns (151.97s)
=== RUN   TestAccTritonMachine_locality
--- PASS: TestAccTritonMachine_locality (204.13s)
=== RUN   TestAccTritonMachine_deletionProtection
--- PASS: TestAccTritonMachine_deletionProtection (145.34s)
=== RUN   TestAccTritonMachine_volume
--- PASS: TestAccTritonMachine_volume (169.38s)
=== RUN   TestAccTritonSnapshot_basic
--- PASS: TestAccTritonSnapshot_basic (124.43s)
=== RUN   TestAccTritonVLAN_basic
--- PASS: TestAccTritonVLAN_basic (6.92s)
=== RUN   TestAccTritonVLAN_update
--- PASS: TestAccTritonVLAN_update (13.60s)
=== RUN   TestAccTritonVolume_basic
--- PASS: TestAccTritonVolume_basic (95.46s)
=== RUN   TestAccTritonVolume_singleNetwork
--- PASS: TestAccTritonVolume_singleNetwork (87.55s)
=== RUN   TestWildcardMatch
--- PASS: TestWildcardMatch (0.00s)
=== RUN   TestValidateVLANIdentifier
--- PASS: TestValidateVLANIdentifier (0.00s)
PASS
ok	github.com/TritonDataCenter/terraform-provider-triton/triton	2494.780s

Related Links