Vermyndax / Google's Terraform is Nonsense

Created Fri, 30 Aug 2024 13:47:11 +0000 Modified Tue, 31 Dec 2024 18:25:52 +0000

Why does this work:

private_ipv4_google_access = "true"

…but this doesn’t:

private_ipv6_google_access = "true"

This anomaly comes to you courtesy of Google’s “google_compute_subnetwork” Terraform resource. A gander at the documentation says this:

Ok. What are the acceptable inputs there? The examples in the documentation provide exactly zero guidance. You either have to go look at the Go code for the resource or do a lot of trial and error. The trial and error is especially fun because they didn’t put any checking around that field whatsoever. It would happily accept “true” but then set it to “DISABLE_GOOGLE_ACCESS” after your Terraform runs. Then on your next apply, you’d see this:

~ private_ipv6_google_access = "DISABLE_GOOGLE_ACCESS" -> "true"

…well, that’s a clue I guess. I tried setting it to “ENABLE_GOOGLE_ACCESS” which is what I wanted anyway, so that’s what we got.

Google tries to pretend that Terraform is the way to do Infrastructure as Code, but their patterns are really nonsense. There’s more where this came from, I just thought I’d pick out this minor nit.