Nested for_each with Terraform

Terraform provides a for_each iterator which allows you to loop over elements of a list, and perform an operation with each element. For example, to grant multiple permissions for myself on a Snowflake schema, I could do something like this: resource "snowflake_schema_grant" "write_permissions" { for_each = toset(["CREATE TABLE", "CREATE VIEW", "USAGE"]) database_name = "MY_DATABASE" privilege = each.key roles = "DAVE" schema_name = "MY_SCHEMA" } This loops over each element in the for_each list, and substitutes it as the privilege using each....

August 19, 2021 · 2 min · Dave Perrett

Working with local Terraform providers

I recently submitted a small fix to @chronark’s Vercel provider. The fix itself was pretty trivial, but it took me quite a while to figure out how to actually run Terraform against a local copy of the provider in order to make sure it actually worked. I found the answer eventually in the Terraform CLI documentation. As a convenience for provider development, Terraform supports a special additional block dev_overrides in provider_installation blocks....

August 19, 2021 · 2 min · Dave Perrett

An update to exif-orientation-examples

I was surprised to discover recently that my exif-orientation-examples repository has quietly collected almost 300 stars on github. The sample images were created over 5 years ago now, and are pretty low-resolution and unsuitable for testing on modern displays and websites. With that in mind, I’ve replaced the sample images with 1200x1800 pixel images (previously they were 600x450 pixels), and automated the process of generating new images. ...

August 5, 2017 · 2 min · Dave Perrett

Importing a Pivotal Tracker project into Trello

I’m currently in the middle of migrating a project from Pivotal Tracker to Trello, and couldn’t find any easy method of importing the data, so I spent this morning putting together a gem to do exactly that. ...

January 13, 2014 · 4 min · Dave Perrett

EXIF orientation handling is a ghetto

One of my favourite services at the moment is Transloadit, who provide an image processing API that works a treat on top of platforms like Heroku, where there are strict request timeout limits that make large uploads difficult. They handle auto-orientation of images automagically by default, and normally I’m not even aware of it happening during testing since my camera and OSX also handle auto-orientation transparently. ...

July 28, 2012 · 7 min · Dave Perrett

Messing around with ruby-processing, take 5

I’ve been spending quite a bit of time playing with ruby-processing (and processing in general) recently. It’s also been my first exposure to JRuby which has been a bit of an eye-opener, in terms of the sheer number of Java libraries that it makes available in Ruby. All the fun stuff in processing seems to be OpenGL-related, and after a lot of research the easiest way to dig in ended up being the GLGraphics Java library, which was made specifically for use in processing. ...

May 31, 2012 · 2 min · Dave Perrett

Underscores are stupid? Get a Japanese keyboard

There was a surprising amount of discussion on Hacker News today on whether or not underscores are stupid, with suggestions ranging from changing key bindings to using the Dvorak layout. Here’s an alternative (although possibly slightly drastic) solution - get a Japanese keyboard: ...

May 16, 2012 · 3 min · Dave Perrett

'405 Not Allowed' error serving Facebook apps with nginx

I’ve spent the last couple of evenings playing around with some Hello World-type stuff for Facebook app development in preparation for an up-coming Facebook/Rails gig. After creating a new app on Facebook, you are presented with the code for a basic starter-page for the app: ...

May 20, 2011 · 2 min · Dave Perrett

Continuous integration for PHP with phpUnderControl

Whenever I start a new PHP project for a client, one of the first things I set up is usually phpUnderControl - a CI (continuous integration) server specifically for PHP built on top of CruiseControl. ...

May 13, 2011 · 11 min · Dave Perrett

Time Out In NZ

I’ve been flat out with a couple of contracting projects recently - apologies for the four-month blogging hiatus! One of these projects (albeit a quickie) was a weekend spent making a rails site for a couple of New Zealand organizations to help the victims of the Japanese quakes and tsunami relocate themselves and/or their children to New Zealand temporarily. ...

May 4, 2011 · 2 min · Dave Perrett