Run code-generation pipeline - you need to do this everytime you change the linode-terraform-provider version, to update CRDs
make generate
Run against a Kubernetes cluster:
export KUBECONFIG=<kubeconfig>
make run
Build, push, and install:
make all
Build binary:
make build
- Find the resource (not data source) that was added in Terraform Provider for Linode. Newer resources are usually implemented through the
framework
plugin, and you can find them inlinode/framework_provider.go
underResources
. Older resources may be implemented withSDKv2
. - In this repo, add the name of the provider to the appropriate list in
config/externalname.go
. Ifframework
based, this will be in theterraformPluginFrameworkExternalNameConfigs
list; make sure there is a 1:1 mapping with the list fromlinode/framework_provider.go
. - Create a directory for the new resource group in
config/
. - Add a file
config.go
implementing theConfigure
method (see config/vpc/config.go for an example). The minimum change needed is overriding theShortGroup
. - Add the configure method to the loop at
config/provider.go:GetProvider()
method. - Change the terraform provider version in the
Makefile
and thego.mod
file. - Run
make submodules
andmake generate
. - Check the new CRDs created in
examples-generated/
. If you need to make any changes, go back to step 4 and edit the config, thenmake generate
again. - Run
make local-deploy
. This will create a Kind cluster set up with Crossplane and Provider Linode. - Create a ProviderConfig and a secret with your Linode API token
apiVersion: linode.upbound.io/v1beta1
kind: ProviderConfig
metadata:
name: default
spec:
credentials:
source: Secret
secretRef:
name: linode-api-token
namespace: default
key: credentials
The Linode API token secret needs to be in the form echo '{"token": "$LINODE_API_TOKEN", "api_version": "v4beta"}' | base64
. Take that value and input it here:
apiVersion: v1
data:
credentials: PUT THE SECRET HERE
kind: Secret
metadata:
name: linode-api-token
namespace: default
type: Opaque
- Create a manifest for your resource, or use the generated example depending on what you are testing.
k apply
the new resource, the ProviderConfig, and the linode API token secret. Test that it works!
-
Review the terraform-provider-linode release notes, and verify if there are is any migration from sdk->plugin framework. k ge a. If there's a migration, update the list in
config/externalname.go
b. If there's a new resource follow steps under Add a new resource -
Change
TERRAFORM_PROVIDER_VERSION
in makefile -
Change
github.com/linode/terraform-provider-linode/v2
in go.mod -
Run
go mod tidy
-
Run
make generate
-
Test changes locally with
make local-deploy
- create a manifest for your resource and test that it works.
- use
make run
to run the provider locally dlv attach <pid>
to begin a debug session