Setting up Development for the Minecraft Terraform Provider
As part of my participation in the Microsoft Global Hackathon, I decided to take on a project that would let me explore something I’ve always wanted to learn: Terraform provider development. Rather than build something abstract, I wanted to apply this learning toward an idea that could have real impact — helping kids and young people get excited about coding, math, and cloud technology by making the learning process more fun and immersive. And what better way to do that than through Minecraft?
Minecraft is already a favorite among young learners, and combining it with infrastructure as code opens up creative possibilities. This article walks through how I set up a local development environment for the Minecraft Terraform Provider, a key step in enabling Terraform to programmatically interact with a Minecraft world.
Along the way, I learned a lot about provider development, build tooling, and configuration — all in service of making learning more playful and engaging.
Install Go
Terraform providers are written in Go, so the first step was to get Go installed on my development machine. I’m using Ubuntu for this project, and I found the simplest way to install Go was via the package manager.
https://documentation.ubuntu.com/ubuntu-for-developers/howto/go-setup/
It was pretty simple. I followed the instructions from Ubuntu’s documentation and ran the following commands:
sudo apt update
sudo apt install golang-go
go version
Cloning the Provider Repository
To keep my development environment clean and reproducible, I set up a fresh Linux virtual machine. This way, I could isolate the provider build from the rest of my system and work in a consistent environment.
I cloned the Minecraft provider source into a local directory:
cd ~/src
git clone https://github.com/markti/terraform-provider-minecraft.git
This gave me a local path to work from:
Building the Provider Binary
Once the code was cloned, I opened the terminal in Visual Studio Code and built the provider using the Go toolchain. This command compiles the provider and outputs a binary into the bin directory:
go build -o ./bin/terraform-provider-minecraft
After running this, I had a working binary located at:
~/src/terraform-provider-minecraft/bin/terraform-provider-minecraft
Configuring Terraform to Use the Local Binary
In order for Terraform to use the locally-built provider binary, I had to configure a special file: ~/.terraformrc. This is a configuration file used by provider developers (or advanced users) to tell Terraform to load a local binary instead of downloading one from the registry.
To create and edit this file, I ran:
touch ~/.terraformrc
vi ~/.terraformrc
Inside, I added the following:
provider_installation {
dev_overrides {
"registry.terraform.io/markti/minecraft" = "/home/$USER/src/terraform-provider-minecraft/bin"
}
direct {}
}
This tells Terraform to look in the specified path for the markti/minecraft provider.
Initial Provider Configuration and Errors
In my test project, I originally used a configuration that specified a version of the provider:
terraform {
required_providers {
minecraft = {
source = "markti/minecraft"
version = "~> 0.0.22"
}
}
}
I assumed I could run terraform init at this point, but Terraform threw an error. It tried to reconcile the provider version from the public registry with my local override, leading to a conflict.
Here’s a summarized version of the error:
parallels@ubuntu-linux-2404:~/src/labs/minecraft-example-labs$ terraform init Initializing the backend…
Initializing provider plugins…
— Reusing previous version of markti/minecraft from the dependency lock file
Warning: Provider development overrides are in effect
The following provider development overrides are set in the CLI configuration: — markti/minecraft in /home/parallels/src/terraform-provider-minecraft/bin
Skip terraform init when using provider development overrides. It is not necessary and may error unexpectedly.
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider markti/minecraft: locked provider registry.terraform.io/markti/minecraft 0.0.22 does not match configured version constraint 0.0.0; must use terraform init -upgrade to allow selection of new versions
To see which modules are currently depending on markti/minecraft and what versions are specified, run the following command: terraform providers
This happened because of the .terraform.lock.hcl file, which still had the previous version pinned. Terraform expected a versioned provider from the registry and rejected the local one.
Fixing the Lock File Conflict
To resolve this, I deleted the .terraform.lock.hcl file and removed the hidden .terraform directory:
rm .terraform.lock.hcl
rm -rf .terraform
I also removed the version constraint from my Terraform configuration, leaving it like this:
terraform {
required_providers {
minecraft = {
source = "markti/minecraft"
}
}
}
After that, running terraform init succeeded without issue. Terraform recognized the local binary and skipped trying to fetch from the registry.
Conclusion
Working on this project during the Microsoft Global Hackathon gave me the opportunity to dig into Terraform provider development, something I’ve been curious about for a long time. By combining that learning with a playful goal — bringing coding and cloud concepts into Minecraft — I was able to create a development setup that supports experimentation with features under development.
The process involved learning the Go dev environment, configuring Terraform to use a local binaries, debugging provider version issues, and ultimately creating a working environment where new resources could be tested live against a Minecraft server.
If you’re interested in provider development check out the Terraform provider for Minecraft — it’s a lot of fun!
https://registry.terraform.io/providers/markti/minecraft/latest
