RSSAmplifier

Blog

Brendan Thompson

Cloud Engineering, Software Engineering & Leadership

brendanthompson.comRSS feed ↗59 posts

Latest posts

Schema validation for Terraform input configuration

Learn how to validate input configuration using CUE for Terraform. This guide covers creating a manifest in yaml, a schema with CUE and validating it. Enhance readability, control, and ensure correctness in your Terraform projects. Dive in to streamline your workflow!

How to structure Terraform code

Explore the evolving best practices for structuring Terraform code. This guide covers essential files like main.tf, variables.tf, and outputs.tf, offering rules and strategies to enhance your projects. Improve code quality, set standards, and streamline collaboration. Dive in to learn more!

What is Terraform state?

What is Terraform state exactly and what does it do? If we consider the below diagram which shows us all the Parts of Terraform State is the final piece of the flow. This is where every action we perform in Terraform records its results. It allows us to store a

Constrained Extension Methods in Swift

Learn how to implement extension methods in Swift with specific constraints. This technique ensures that added functionalities are only available under certain conditions, enhancing code safety and reusability.

2022, that's a wrap

Reflecting on a productive year filled with achievements, including writing 15 blog posts and becoming a HashiCorp Ambassador. The post outlines personal and professional goals for the future, emphasizing continuous learning, community engagement, and expanding technical skills.

Terraform Moved Block

Have you ever had a Terraform resource that you thought would look the same through its whole lifecycle only to find that you now need to either rename it, move it into a module or maybe have multiple instances of it using for_each or count (ideally not count). If

Terraform Dynamic Blocks

In this post, we will cover the Terraform dynamic Blocks expression, and how to use it. The dynamic block works in a very similar way to for_each meta-argument, instead of producing n instances of a whole resource will produce n instances of a particular block within a resource.

Manage Azure Policy with Terraform

Today we are going to talk about managing Azure Policy using Terraform. Azure Policy has a few components to it; Policy Definition, Policy Definition Set (also known as an Initiative), policy assignment, policy exemption and policy remediation. We will talk about all of these except for policy remediation. I am

Terraform For Expressions

The for expression in the Terraform configuration language allows us to construct complex objects out of pieces of information from multiple sources! The result of a for expression can either be a map or a list as well as any combination of those two things. These expressions can be very

Terraform Local Variables

What are local variables? Local variables are blocks of code within Terraform that allow us to store static pieces of data that we might want to refer to at a later date, or deeply dynamic pieces of data that can be manipulated by the state of our resources, data sources,

Getting Started with Terraform Modules

Modules are a foundational feature of Terraform and one of the most widely used features at that, this does not mean however that when they are used their use is well thought out. During my professional time working with Terraform I have seen some pretty interesting things when it comes

Post Terraform v1.0 features I love

There are a few features that have been introduced into Terraform since the release of v1 which I think are extremely exciting. Those features are: * precondition & postcondition * nullable * optional Today's post is going to go through these three features and show you how you can use them

Terraform Configuration Ingestion

Introduction One problem I see crop up pretty regularly with Terraform codebases is a lot of repeated code, this repeated code is usually to facilitate the deployment of environments or multiple instances of the codebase. An example of this might be some networking and a virtual machine that hosts a

Microsoft and their Terraform providers, what's next?

This week I met with the new Program Manager for Microsoft's Terraform providers. They recently asked for feedback from the community on what it's like working with the provider and where there were areas for improvement. For me, one of my biggest concerns with the provider

How to create PR based environments in GitHub

Introduction This post will talk through the process to create a temporary environment for each PR that developers raise against your repository using the power of GitHub Actions. These ephemeral environments are extremely useful when multiple teams consume different codebase versions. We will be using a mix of Terraform and

Using GitHub Actions to publish container images to Azure Container Registry

Introduction As containers continue to explode in popularity, we need to understand how to build the containers from their manifest and push them into a registry so that our users can consume them! GitHub Actions (GHA)is an excellent choice for this process, especially if you're already storing

How to use Terraform remote backends

* What is a Backend * Backend Types * Local * Remote * Terraform Cloud * Scalr * Cloud Specific Backends * Azure: azurerm * GCP: gcs * AWS: s3 * Closing Out What is a Backend The primary function of a backend is to store the state created by Terraform runs after provisioning our resources. This gives Terraform a single

Kicking off 2022

Well, we are two weeks into 2022, and the year is already off with a bang! I took some time off this year and genuinely unplugged, except for my PS5. I was well and truly plugged into that! For me, it was fantastic to get some time off and spend

2021, that's a wrap

Well, that has been 2021, and this will be my last post of the year. The last 2-years have been a trying and difficult time for everyone, everywhere. However, it does feel like we are starting to see some light at the end of the tunnel when it comes

CoreDNS on macOS for Local Development

Over the years, I have tried a few different ways of managing DNS on my local laptop, sometimes with dnsmasq sometimes just with hosts file, and other times using public DNS. CoreDNS seems to be all the rage these days (as it should be), so I thought I would give

Module Workspace with Scalr

In this post, I am going to look at using a frankly pretty awesome feature of Scalr, the Module Registry Workspace. Scalr is a competitor to HashiCorp's Terraform Cloud (TFC) product, I won't go into any comparison of the two in this post as I want

Terraform Conditionals

What is a conditional? Terraform, like many programming languages or Domain-Specific Languages (DSL), has the concept of Conditional Expressions, this uses the value of a boolean expression to select two values. The syntax for a conditional is: condition ? true : false Some expression that must return a boolean result is

Terraform Variable Validation

In the past, I have spoken about Terraform variable validation in a TIL post. I thought I would expand on that a little more, given that it has been out for a while now. Variable validation is compelling, but it has some downfalls that we will discuss later. In order

My Terraform Standards

Following on from my last post My Terraform Development Workflow, I felt it might be a good idea to talk a little about the standards that I employ when writing Terraform. I will break this post up into a few sections: * Naming * Input Variables * Local Values * Constraints * Meta-arguments * Code

My Terraform Development Workflow

In this post, I will take you through my standard workflow when I am developing Terraform code. This workflow stays the same no matter what cloud or service I am coding against or how complex the code might get, I always start the same way! I take a four-phased

Cloud-native Compute on Azure

import Azure from 'src/../public/images/cloud-icons/azure.svg' import ContainerInstances from 'src/../public/images/cloud-icons/container-instances.svg' import FunctionApps from 'src/../public/images/cloud-icons/function-apps.svg' import LogicApps from 'src/../public/images/cloud-icons/logic-apps.svg&

Microsoft Ignite 2021 Azure Container Apps

I wouldn't call myself a Microsoft fanboy, but I can appreciate when they release a product that is going to be truly impactful. That product, from Microsoft Ignite 2021, is Azure Container Apps (ACA). ACA allows you to easily create API endpoints backed by a truly PaaS Kubernetesimplementation.

Announcing my Scratch Terraform provider

Since the advent of the for expression, and for_each meta-argument in 2018 as part of Terraform 0.12 Preview I have created many weird and wonderful loops. Terraform 0.12was released to GA in May 2019, which meant the adoption of these features increased heavily and saw the

Anatomy of a service running in Kubernetes on Azure

This post will take us on a journey of discovery, a journey where we look into what constitutes a Kubernetes Service, how that maps make to resources in Azure as well as the Kubernetes cluster on Azure itself using Azure Kubernetes Services. First, let's define what a Service

The cost of takeaway food over the pandemic

This post is certainly going to be left of the field from what I would typically write about. Over the past week or so, I have started thinking about how much money I have spent over the past two years on takeaway food; truth be told, I have thought about

How to set Terraform backend configuration dynamically

Terraform backend configuration can be a somewhat confusing topic, especially for the uninitiated. In this post, I will run through how we can set backend configuration and do it dynamically without using external tools like Terragrunt. There are myriad choice of storage options for a Terraform backend, the two most

Inspiration for writing my Working with Me page

A little while ago, I came across this fantastic post on LinkedIn talking about the idea of a Working with Me page. That post got me thinking about what it is like working with me and my different mannerisms and quirks. So, I started to understand more about this Working

Triggering Terraform Cloud runs from GitHub

There are two primary ways that you can trigger a run in Terraform Cloud (TFC) from code that lives in a GitHub repository, these are: * Explicit Triggering - is when an API/CLI call triggers the TFC workspace to run. In this instance, the CI/CD tool (GitHub Actions) calls TFC

Getting started with Terratest on Azure

During my time working with Terraform over the years I find one thing that is always forgottenwhen writing a module is testing! I feel like this is a problem in a lot of development scenarios and is especially prevalent when the Developer comes from an infrastructure or cloud engineering background.

Github Actions self-hosted runner on Azure

This guide will take you through steps to deploying a self-hosted Github Actions runner on Azure, using our favorite infrastructure-as-code tool Terraform. Github actions are progressively becoming more and more popular, especially after Travis CI's pricing change. And, to be honest, I think it is

Databricks on Azure with Terraform

Overview This post aims to provide a walk-through of how to deploy a Databricks cluster on Azure with its supporting infrastructure using Terraform. At the end of this post, you will have all the components required to be able to complete the Tutorial: Extract, transform, and load data by

Oh my ZSH has a ZSH stats tool

As I was reviewing my Twitter feed this morning I came across something pretty neat from Robby Russel the creator of Oh my ZSH. Execute the following command inside oh a zsh shell to see the stats: zsh_stats This is what my stats currently look like:

Remove a user from FileVault

This TIL ties in with my post from yesterday on TIL: Multi-user Homebrew. If you have multiple user accounts on your Mac there it is likely that they all have access to be able to unlock FileVault. As a general rule I would recommend only having a single non-

Homebrew on multi-user systems

If you're like me and you've followed the macOS Security and Privacy Guidethen you will likely have a standard user account, and an admin account. This is perfect in the majority of cases but what happens if you have a multi-user system? Simply, homebrew dies

Bridgecrew

There is an excellent product called Bridgecrew that allows to execute security and compliance checks on your Infrastructure as Code, such as Terraform. There is a Use Case written by Bridgecrew around how it could work with TF.

Rollback Terraform Cloud/Enterprise State

When you're dealing with Terraform Cloud/Enterprise (TFC/E) and something has gone wrong with state it becomes a complex situation to deal with as there is no easy way to rollback state to a different version. This blog post aims to guide you on the pathway to

Linux script shebang

Now, this TIL is also rather an old one, I would say this goes all the way back into the early days of my career in the IT industry. However, today I needed to look into shebang lines again which is why I thought it would be a good idea

Disable App Review Prompt on iOS

Today I Learned, that it is actually possible to stop iOS/iPadOS apps from prompting you to review them. This is done by the sneaky little setting under App Store. The following image shows what it looks like.

Kubernetes in Space - Azure

This is the first installment of a 3 (potentially 4) part series around deploying Kubernetes (k8s) to the major public clouds, the other posts will show how to deploy k8s on GCP and AWS. Once they've been posted I will update this post to ensure there are links

Terraform variable validation

As of Terraform 0.13.0 it is now possible to run a level of validation over your input variables to ensure they match what you'd expect them to be. There are some limitations to this, which I wont go into right now. Today I groked how it

Auto sudo bash scripts

This is an old piece of knowledge that I recently needed to extract from my head. There are many situations where the execution of a script requires sudo to be able to operate correctly, as we are all humans sometimes we forget to sudo scripts. Just because we might forget

HCL TFE Variable resources don't work the way you expect them to

If like many people you are using the TFE Providerto manage your TFE/C workspaces the it will come as no surprise to you that you can manage your terraform variables and environment variables through the use of tfe_variable. One argument this gives you is the ability to mark

Terraform Enterprise/Cloud workspace types

Terraform Enterprise/Cloud (TFE/C) has three different ways of dealing with workspaces: * VCS Backed - Workspaces are triggered and directly linked to a VCS repository * API Driven - Triggered by an API call * CLI Driven - Triggered by the use of the TF binary, which will essentially then hit the API An

Terraform Enterprise/Cloud workspace types

Terraform Enterprise/Cloud (TFE/C) has three different ways of dealing with workspaces: * VCS Backed - Workspaces are triggered and directly linked to a VCS repository * API Driven - Triggered by an API call * CLI Driven - Triggered by the use of the TF binary, which will essentially then hit the API An

The best Slack notification sound

I was looking through my Slack settings earlier trying to stop it from making those hideous notification sounds. Whilst I was on this adventure I noticed something truly glorious! As can be seen in the screen shot below Slack actually offers the ability to set the notification sound to be