Skip to content

Instantly share code, notes, and snippets.


Dirk Avery YakDriver

View GitHub Profile
YakDriver /
Created Jan 25, 2022
ECS Cluster, Capacity Provider Destroy Error
provider "aws" {}
locals {
// cluster_name is a local to avoid the cyclical dependency:
// cluster -> capacity provider -> asg -> launch template -> user data -> cluster.
cluster_name =
data "aws_availability_zones" "current" {
state = "available"
View auto_schema.txt
In Terraform provider development, if you were going to automate assigning characteristics of schema elements:
Check where element appears:
i = input (i.e., CreateObjectInput)
u = update (i.e., UpdateObjectInput)
o = output (i.e., DescribeObjectOutput)
This chart tells you when you need computed and forcenew.
View compare_string_slices.go
func compareStringSlices(a []string, b []string) bool {
if len(a) != len(b) {
return false
for i := range b {
if a[i] != b[i] {
return false
YakDriver /
Created Sep 23, 2020
AWS Provider - Lists vs. sets

TypeSet vs. TypeList for Arguments and Attributes

General rule:

  1. Use TypeSet when collection elements should be unique and order doesn't matter
  2. Use TypeList otherwise

Special considerations:

  1. If the argument needs to be optional and computed, only TypeList is supported (probably)
  2. For configuration blocks where there can be only one, use TypeList MaxItems 1 to simplify things in the code/testing
YakDriver /
Created Sep 23, 2020
Pillars of AWS Provider development
  1. Best is the enemy of good
  2. The purpose of the provider is not to clean up the API
  3. Even when the API seems wrong, follow it. It might actually be right and, if not, you can pass the blame.
YakDriver /
Created May 13, 2020
Makefile help - figure out which commands you use most and might want to move to a makefile
history | awk '{print $2 " " $3}' | sort | uniq -c | sort -nr
YakDriver / terraform12_clean_upgrade.txt
Last active Sep 18, 2019
Helpful Visual Studio Code REGEXes to upgrade and clean up Terraform 0.12 config
View terraform12_clean_upgrade.txt
- Terraform 0.12 tool has already been run
- Variables fields are in the order: type, description, default (if any)
Transform 0.11 string booleans to native bool
View panic.log
$ terraform apply
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_s3_bucket.encrypted will be created
+ resource "aws_s3_bucket" "encrypted" {
View crash.log
2019/05/24 17:44:02 [INFO] Terraform version: 0.12.0
2019/05/24 17:44:02 [INFO] Go runtime version: go1.12.4
2019/05/24 17:44:02 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2019/05/24 17:44:02 [DEBUG] Attempting to open CLI config file: /Users/maviemarcos/.terraformrc
2019/05/24 17:44:02 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/05/24 17:44:02 [INFO] CLI command args: []string{"apply"}
2019/05/24 17:44:02 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/05/24 17:44:02 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/05/24 17:44:02 [DEBUG] New state was assigned lineage "0eb1377e-4a69-a17b-5ddf-f4d25de5d570"
2019/05/24 17:44:02 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
YakDriver /
Created Nov 8, 2018
Get names of Terraform tests from a test file
awk '/^func Test/' aws/structure_test.go | sed "s/func \(Test[a-zA-Z0-9_]*\)(.*$/make testacc TESTARGS='-run=\1'/" >