When I first set out to create a golden pyramid in Minecraft using Terraform, I began with the obvious approach: a solid structure. But almost immediately, I started running into performance issues. As the base of the pyramid expanded, so did the build time — exponentially.

The number of blocks required for each layer increases arithmetically as the pyramid grows, which made the process increasingly inefficient. This isn’t something we typically worry about in Infrastructure as Code (IaC), where most cloud APIs are optimized for bulk operations. But Terraforming Minecraft introduces a new constraint: the build actually happens, block by block, in the game world. I don’t want to wait forever for my pyramid to rise — especially when Terraform is already leagues faster than strip mining and placing every block manually in-game.

From Solid to Hollow

My solution was to hollow out the pyramid. Instead of constructing each layer as a solid cuboid, I built only the perimeter — a square frame for each layer. This drastically reduced the number of blocks required without changing the external appearance.

Alt

a hollow pyramid replaces the solid layers with a square frame.

Alt

as the pyramid gets bigger, for example a 20x20 the number of blocks to create the structure gets bigger.

Alt

To put this into perspective:

  • A solid 20x20 pyramid required 1,540 blocks. It took 4 minutes and 11 seconds to build, and the same amount of time to destroy.
  • A hollow 20x20 pyramid used just 760 blocks. It took 1 minute and 52 seconds to build, with teardown time doubling that.

Designing the Square Frame Module

To make this work, I created a new Terraform module to build square frames instead of solid layers. The inputs remained the same:

variable "start_position" {
  type = object({
    x = number
    y = number
    z = number
  })
}

variable "material" {
  description = "Material used for the frame (e.g. dirt)"
  type        = string
}
variable "length" {
  type = number
}

But instead of filling a volume, I constructed four directional pillars to define the square frame. Here’s how that looks in code:

module "north_side" {
  source = "../pillar"
  start_position = {
    x = var.start_position.x
    y = var.start_position.y
    z = var.start_position.z
  }
  length    = var.length
  direction = "E"
  material  = var.material
}

module "south_side" {
  source = "../pillar"
  start_position = {
    x = var.start_position.x
    y = var.start_position.y
    z = var.start_position.z + var.length - 1
  }
  length    = var.length
  direction = "E"
  material  = var.material
}

module "west_side" {
  source = "../pillar"
  start_position = {
    x = var.start_position.x
    y = var.start_position.y
    z = var.start_position.z
  }
  length    = var.length
  direction = "S"
  material  = var.material
}

module "east_side" {
  source = "../pillar"
  start_position = {
    x = var.start_position.x + var.length - 1
    y = var.start_position.y
    z = var.start_position.z
  }
  length    = var.length
  direction = "S"
  material  = var.material
}

Each of these four modules defines a side of the square frame. Together, they make up the perimeter of a layer in the pyramid — without any unnecessary interior blocks.

When Performance Becomes a Feature

This leads to an interesting design consideration that rarely comes up in traditional IaC: optimizing for performance at the block level. In cloud infrastructure, I often advise teams not to over-optimize Terraform apply times. New developers sometimes fixate on speed, when they should instead be thinking about architectural cohesion. A long second apply can be a sign your root module is trying to do too much. Maybe your system has too broad a blast radius. Maybe it’s time to split it up.

But in Minecraft, it’s different. The change you’re making is visible. It’s tangible. And speed becomes a feature. The faster we can create and destroy structures, the more interactive and useful they become.

Terraforming Minecraft via the Java Edition provider executes commands using RCON. Every block placement is effectively a call to the following command:

setblock %d %d %d %s

Each of these calls takes time. While it might be possible to parallelize them, it appears RCON processes commands serially. That means the fewer commands, the faster the build.

Eliminating the Invisible

So I began asking myself: which blocks can I remove without affecting the structure? The answer is simple — the ones you don’t see and don’t know are there. That insight drove the change from solid cuboids to skeletal frames.

Not only does this cut the block count dramatically, but it also results in a visually interesting internal structure. You get the same outer form with less time and fewer resources. And if you’re watching the build happen in-game, the hollow pyramid even feels more dynamic as it rises — exposing its scaffolding-like interior until the next layer encloses it.

Conclusion

Terraforming Minecraft forces us to reconsider what matters in IaC. It’s kind of weird and as a result it’s a little bit different. We need to remember that. In this context, performance isn’t just a nice-to-have metric — it directly shapes the player’s experience. Hollowing out the golden pyramid was a design optimization based on the unique nature in which I am using Terraform with a radically different control plane: Minecraft.

This shows how flexible Terraform and HCL can be with its balance of human readability and programming prowess. When the “infrastructure” you’re building is a physical object in a digital world, speed matters. Efficiency matters. And the best optimizations are the ones you never see — just like the blocks I didn’t place.

However, when we are using Terraform to provision our cloud environments, speed is not the most important concern. Like with Minecraft we are limited by how fast the control plane is we are automating. That means, its rarely Terraform that is the bottleneck — it’s Azure or it’s AWS’s APIs. That’s why its important to remember — and to channel your feedback to the right place — don’t shoot the messenger. If you have a “performance issue” with Terraform its more likely a performance issue with the cloud platform itself.

Alt