A cloud containing an open door showing gears inside, being tinkered at by an engineer wearing a hard hat against an abstract background of code

Devlog: 002 - Building Terraform Custom Types

Terraform Plugin Framework Custom Types One of the great new things the Terraform Plugin Framework provides is a stronger focus on strict typing and with that, the ability to develop custom types. One of the first issues I discovered straight out of the gate when attempting to build a new Terraform Provider with the Plugin Framework was that the data I was modelling for a resource used UUIDs for its record ids....

July 22, 2023 · 3 min · Matthew Hartstonge
A cloud being constructed by programmers climbing over it with ladders against an abstract background of code

Devlog: 001 - Building Terraform Providers

Terraform If you’ve been living under a rock or happen to be a newcomer in the DevOps/Site Reliability Engineering space, Hashicorp’s Terraform enables provisioning and managing cloud infrastructure. It’s essentially a glorified diffing tool for any cloud resource that, as long as a Terraform Provider exists, can ensure the state of your infrastructure is as expected when written in Hashicorp Config Language (HCL). As a forewarning before digging deeper, it has been common to hear some Linuxy sysadmin-looking neckbeards in-passing talking about infrastructure as code, better known as IaC, being the bee’s knees and how they keep managing to give Dave a good ribbing after causing the Great Network failure of ‘22 after performing a Git force push…...

July 12, 2023 · 5 min · Matthew Hartstonge
a programmer at a laptop panicking over having a substantial amount of code abstract in the background

Else Is Evil

Take the following Go code as an example: package main type CodeType int const ( CodeA CodeType = iota + 10 CodeB ) func calculateCodes(codeType CodeType) int { var value int if codeType == CodeA { value = 10 } else { value = 20 } return value } func main() { fmt.Println(calculateCodes(CodeA)) } Why is else evil? There are a number of things that can cause an issue as code gets maintained over its lifecycle which can be dangerous:...

May 30, 2023 · 3 min · Matthew Hartstonge
A writer sits at a table with a pencil drawing art with an abstract background containing security iconography

Nginx, Varnish and Wordpress with SSL Termination

TL;DR Assuming you’ve already got your reverse proxy running, in wp-config.php add the following: <?php /** TLS/HTTPS fixes **/ // in some setups HTTP_X_FORWARDED_PROTO might contain a comma-separated list // e.g. http,https so check for https existence. if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) { // update HTTPS server variable to always 'pretend' incoming requests were // performed via the HTTPS protocol. $_SERVER['HTTPS']='on'; } If you’re getting desperate: // If you ever get stuck, you can override the database set site URIs as well....

July 6, 2020 · 7 min · Matthew Hartstonge
A writer with a pencil drawing art around a track while sitting in a formula one car

Superfast WordPress

Introduction WordPress is clearly one of the world’s most used Content Management Systems (CMS) commanding over 35% of the internet, and over 60% of the CMS market [1]. Working in Operations (ops), you see your fair share of friends, family and businesses that ask you to set up a WordPress site as their go to blogging platform. This really comes down to WordPress’ ease of use, massive library of themes and it’s modular nature that enables the extension of it’s core via the use of plugins....

March 29, 2020 · 5 min · Matthew Hartstonge
A squirrel driving a ship on the sea with docker containers in the back

Just Ship It

A while back, I met up with a friend where we started conversing about side projects and how we find it so hard to find the time and motivation to get into them. Moreover, how do we find our way into starting something and keeping at it? Yet, this felt like a rather common dilemma, as you can always find another ’life hack’ or ‘yet another self-help’ book on the matter....

September 10, 2018 · 3 min · Matthew Hartstonge