Week notes 23/11/2026

What happened this week

Thoughts of the week

Data vs. Code

I've been thinking about when to expose systems as data rather than code. Here's an example.

Code Approach:

locals {
  users = [
    {
      id                  = "emp001"
      display_name        = "Alice Jones"
      user_principal_name = "[email protected]"
    },
    {
      id                  = "emp002"
      display_name        = "Ben Smith"
      user_principal_name = "[email protected]"
    }
  ]
}

resource "azuread_user" "employee" {
  for_each = { for user in local.users : user.id => user }

  display_name          = each.value.display_name
  user_principal_name   = each.value.user_principal_name
  password              = var.initial_passwords[each.key]
  force_password_change = true
}

Data Approach:

users:
  - id: emp001
    display_name: Alice Jones
    user_principal_name: [email protected]

  - id: emp002
    display_name: Ben Smith
    user_principal_name: [email protected]
locals {
  users = yamldecode(file("${path.module}/users.yaml")).users
}

resource "azuread_user" "employee" {
  for_each = { for user in local.users : user.id => user }

  display_name          = each.value.display_name
  user_principal_name   = each.value.user_principal_name
  password              = var.initial_passwords[each.key]
  force_password_change = true
}

What is the right abstraction? Both approaches can work well, depending on the context.

  • Do you need users to be able to modify this?
  • If yes, do the users have access and knowledge to modify the code?

The important one:

  • Do you need this to be represented in a way that would be inconvenient in data?

Are you limiting the capabilities of the implementation to make it easier to represent? a data-driven abstraction can look appealing at first, but edge cases may force you to add conditional logic for interpreting the data.

Interesting Reads

Most reviews should be approvals

Interesting article as always from Sean Goedecke who states that most teams should favour approval rather than blocking a PR.