- Best is the enemy of good
- The purpose of the provider is not to clean up the API
- Even when the API seems wrong, follow it. It might actually be right and, if not, you can pass the blame.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
awk '/^func Test/' aws/structure_test.go | sed "s/func \(Test[a-zA-Z0-9_]*\)(.*$/make testacc TESTARGS='-run=\1'/" > tests.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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" { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Assumptions: | |
- Terraform 0.12 tool has already been run | |
- Variables fields are in the order: type, description, default (if any) | |
--------------------------------------------- | |
BOOL | |
Transform 0.11 string booleans to native bool | |
--------------------------------------------- | |
Find:(type\s+=\s*)string(\n\s+description.*\n\s+default\s+=\s+)"(false|true)" | |
Replace:$1bool$2$3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
history | awk '{print $2 " " $3}' | sort | uniq -c | sort -nr |
General rule:
- Use TypeSet when collection elements should be unique and order doesn't matter
- Use TypeList otherwise
Special considerations:
- If the argument needs to be optional and computed, only TypeList is supported (probably)
- For configuration blocks where there can be only one, use TypeList MaxItems 1 to simplify things in the code/testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func compareStringSlices(a []string, b []string) bool { | |
if len(a) != len(b) { | |
return false | |
} | |
sort.Strings(a) | |
sort.Strings(b) | |
for i := range b { | |
if a[i] != b[i] { | |
return false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" {} | |
locals { | |
// cluster_name is a local to avoid the cyclical dependency: | |
// cluster -> capacity provider -> asg -> launch template -> user data -> cluster. | |
cluster_name = random_pet.name.id | |
} | |
data "aws_availability_zones" "current" { | |
state = "available" |