This repository contains a sample Terraform provider. Can be used for learning purposes. It is a fully working solution. Uses dodo-go client library to interact with the Dodo Global API v2.
For more information about how to write a custom terraform provider, please check out my article:
My Path for Terraform Provider Creation
This terraform provider is available for both repositories: terraform and opentofu.
cat provider.tf
terraform {
required_providers {
dodo = {
source = "Nmishin/dodo"
version = "0.0.1"
}
}
}
provider "dodo" {}
cat main.tf
data "dodo_brand" "test" {}
cat outputs.tf
output "brands" {
value = data.dodo_brand.test.names
}
tofu plan
data.dodo_brand.test: Reading...
data.dodo_brand.test: Read complete after 1s [id=bf4b2096fab07279e4a6a9db5fb704b5]
Changes to Outputs:
+ brands = [
+ "dodopizza",
+ "doner42",
+ "drinkit",
]
You can apply this plan to save these new output values to the OpenTofu state, without changing any real infrastructure.