Created
April 8, 2015 01:10
-
-
Save DoctorVin/12c3c845452baa968025 to your computer and use it in GitHub Desktop.
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
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec suscipit faucibus gravida. | |
Morbi lobortis consectetur ligula, et consequat enim interdum non. Sed gravida lacus id | |
ornare molestie. Duis placerat metus at lobortis porttitor. Praesent malesuada scelerisque | |
leo a vestibulum. Fusce finibus, mauris ut ultricies blandit, lacus mauris laoreet odio, | |
nec elementum nibh orci et lectus. Duis ullamcorper arcu augue, eget sagittis lacus | |
pellentesque et. Proin eu pretium est. Vestibulum quis malesuada amet. |
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" { | |
access_key = "key" | |
secret_key = "secret" | |
region = "us-east-1" | |
} | |
resource "aws_instance" "web" { | |
ami = "ami-7f89a64f" | |
instance_type = "t1.micro" | |
count = "3" | |
user_data = "${file(\"lorem.txt\")}" | |
tags { | |
Name = "Web-${count.index}" | |
Serial = "${count.index}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test case for a weird sort-of race in terraform resource parsing. The problem is at line 11 of resource.tf, where we open a file and pull the contents into a variable. In hindsight, doing things this way is not efficient at all, as the file is read on every iteration. However, it's probably a typical "new guy mistake" in that you might not realize that file() is a function and doing IO while the parser is setting up your resources.
The problem in this test case manifests as weird, non-deterministic values in the tags for name and serial number. These values are internally consistent, but instead of consistently generating Web-0, Web-1, Web-2, you get (for example):