Terraform: Up & Running

Errata for Terraform: Up & Running

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Safari Books Online
?
Chapter 7, Section "Integration Tests"

In the code snippet at the end of the section for testing TestHelloAppWorldStage: $ go test -v -timeout 30m -v "TestHelloWorldAppStage" Typo: the second "-v" flag should be "-run"

Note from the Author or Editor:
I have fixed this in master

Jaime Fontanoza  Sep 21, 2019  Oct 04, 2019
Safari Books Online
?
Chapter 7, Section "Running Tests in Parallel"

The maximum number of tests run in parallel is limited by default to the value of CPUs available (the value of GOMAXPROCS), so running the example as-is: go test -v -timeout 30m on a system with a default GOMAXPROCS value of 1 (eg., a 1 CPU/1 core VM) will run the tests serially instead of in parallel. This can be fixed without changing the system's properties by either manually setting a GOMAXPROCS environment variable to something greater than 1: export GOMAXPROCS=2 or by adding the "-parallel" flag to "go test" with a value greater than 1: go test -v -timeout 30m -parallel 2 Serial test behavior on a multi-CPU system can be forced by setting GOMAXPROCS or the parallel flag explicitly to 1.

Note from the Author or Editor:
I've updated the book with a note about this

Jaime Fontanoza  Sep 20, 2019  Oct 04, 2019
Safari Books Online
?
Chapter 7, Section "Unit Testing Basics"

The initial alb_example_test.go and other tests generate a "not enough arguments" error, as the function signatures for all of http_helper.HttpGet* functions were changed in terratest v0.19.0 to include a pointer to a TLSConfig struct as the third parameter. Adding a reference to a new, empty TLSConfig struct in all of the http_helper.HttpGet* functions allows the tests to compile successfully. For example: http_helper.HttpGetWithRetry( t, url, &tls.Config{}, expectedStatus, expectedBody, maxRetries, timeBetweenRetries, ) "crypto/tls" also needs to be added to the import list accordingly.

Note from the Author or Editor:
I will fix this in master

Jaime Fontanoza  Sep 19, 2019  Oct 04, 2019
Safari Books Online
?
Chapter 7, Section "Dependency Injection"

The initial run of TestHelloWorldAppExample fails because the expected response body is: Hello, World However, the user-data.sh script in the hello-world-app module used up to now (and in the github source repo) is generating formatted output that doesn't match: <h1>Hello, World</h1> <p>DB address: mock-value-for-test</p> <p>DB port: 3306</p> To fix the problem, either the user-data.sh script can be modified to store only the server_text value in index.html, or the expectedBody value in the test can be changed to match in a variety of ways: serverText := "Hello, World" mysqlAddress := "mock-value-for-test" mysqlPort := 3306 ... expectedBody := fmt.Sprintf("<h1>%s</h1>\n<p>DB Address: %s</p>\n<p>DB Port: %d</p>", serverText, mysqlAddress, mysqlPort)

Note from the Author or Editor:
I will fix this in master.

Jaime Fontanoza  Sep 20, 2019  Oct 04, 2019
Safari Books Online
?
Chapter 6, "Small Modules"

The list of resources to move from webserver-cluster/main.tf to asg-rolling-deploy/main.tf includes the following: * aws_security_group_rule (both of the rules for the Instances, but not those for the ALB) However, there is only one security group rule for instances, as refactored in Chapter 4 and seen in the sample code: resource "aws_security_group_rule" "allow_server_http_inbound" The "both" here implies there are two rule resources, which is correct for the ALB, but not for the instances.

Note from the Author or Editor:
I will fix this in master

Jaime Fontanoza  Sep 14, 2019  Oct 04, 2019
Safari Books Online
?
Loops with for_each Expressions

In the section "Loops with for_each Expressions" of Chapter 5, a code snippet for the module "webserver_cluster" in which the new "custom_tags" section is added includes the statement: enable_autoscaling = true Running the subsequent "terraform apply" with this statement errors out as the variable is unexpected in the module definition at that point. "enable_autoscaling" is not actually defined until later in the chapter, in the section "Conditionals with the count Parameter." Commenting out or removing the "enable_autoscaling = true" line from the snippet allows "terraform apply" to run successfully.

Note from the Author or Editor:
I'll fix this in master

Jaime Fontanoza  Sep 12, 2019  Oct 04, 2019
Safari Books Online
???
below sentence "You can also use for expressions to output a map rather than a list using the following syntax:"

On Chapter 5: Below the sentence, "You can also use for expressions to output a map rather than a list using the following syntax:", It shows: # For looping over lists {for <ITEM> in <MAP> : <OUTPUT_KEY> => <OUTPUT_VALUE>} # For looping over maps {for <KEY>, <VALUE> in <MAP> : <OUTPUT_KEY> => <OUTPUT_VALUE>} -------------------------------------------- I believe, it is supposed to be: # For looping over lists [for <ITEM> in <MAP> : <OUTPUT_KEY> => <OUTPUT_VALUE>] # For looping over maps {for <KEY>, <VALUE> in <MAP> : <OUTPUT_KEY> => <OUTPUT_VALUE>} as [ ] is for list and { } is for map.

Note from the Author or Editor:
I'll fix this in master

cartigayane k  Sep 10, 2019  Oct 04, 2019
Safari Books Online
end of chapter 2
Code snipped

resource "aws_lb_listener_rule" "asg" { listener_arn = aws_lb_listener.http.arn priority = 100 condition { field = "path-pattern" values = ["*"] } The above path-pattern is deprecated. Updated code: condition { path_pattern { values = ["*"] } }

Note from the Author or Editor:
I fixed this issue in the code in multiple places and pushed the fix to master branch (commit ID: ed7aac8).

Jesse Ahluwalia  May 19, 2020  Jul 10, 2020
Safari Books Online
4-4
Below Figure 4-4.

And there you have it: code reuse in multiple environments that involves minimal copying and pastiing. Typo error: It should be "pasting".

cartigayane k  Oct 31, 2019  Nov 15, 2019
PDF
Page 20
Footnote 7

The official documentation for Chef Provisioning is no longer available in https://docs.chef.io/provisioning.html as it was officially end-of-life according to https://github.com/chef-boneyard/chef-provisioning

Note from the Author or Editor:
This is correct. This link/mention will need to be removed.

Hayato Matsuura  Dec 08, 2019  Jul 10, 2020
Printed, PDF, ePub
Page 28
figure 1-8 notes

masterless, agent-only architecture should be masterless, agentless architecture

Note from the Author or Editor:
Ah, yes, the book uses agentless everywhere else, so "agent-only" should indeed be replaced with "agentless".

Bryan Bai  Dec 14, 2019  Jul 10, 2020
Printed, PDF, ePub
Page 135
4th paragraph

If you run the plan command on the preceding code, you will see that Terraform wants to create three IAM users, each with a different name ("neo", "morpheus", "trinity"): should be: If you run the plan command on the preceding code, you will see that Terraform wants to create three IAM users, each with a different name ("neo.0", "neo.1", "neo.2"):

Note from the Author or Editor:
Replace: ("neo", "morpheus", "trinity"): With: ("neo.0", "neo.1", "neo.2"):

Bryan Bai  Jan 02, 2020  Jul 10, 2020
Printed, PDF, ePub
Page 179
first line of comment

# You should change this to the username of an IAM user that already # exists so you can practice using the terraform import command >>>>>>>>>>>>>>>>>>> this code here is not a practice of terraform import command. so the comment above is a little bit confusing.

Note from the Author or Editor:
I removed this confusing comment and pushed the changes to master (commit ID: fa93241).

Bryan Bai  Jan 06, 2020  Jul 10, 2020
Printed, PDF, ePub
Page 244
1st paragraph

The updated Handlers class now handles the /web-service URL by calling a new method call web_service, which makes an HTTP GET should be The updated Handlers class now handles the /web-service URL by making an HTTP GET..."

Note from the Author or Editor:
Original sentence: "The updated Handlers class now handles the /web-service URL by calling a new method call web_service, which makes an HTTP GET to example.org and proxies the response." Needs to be updated to: "The updated Handlers class now handles the /web-service URL by making an HTTP GET to example.org and proxying the response."

Bryan  Dec 14, 2019  Jul 10, 2020
PDF
Page 263
createDbOpts code snippet

bucketRegionForTesting := "YOUR_S3_BUCKET_FOR_TESTING" should be bucketRegionForTesting := "YOUR_S3_BUCKET_REGION_FOR_TESTING"

Yevgeniy (Jim) Brikman
Yevgeniy (Jim) Brikman
 
Sep 28, 2019  Oct 04, 2019
Printed, PDF, ePub
Page 268
2nd paragraph

This function uses test_structure.LoadTerraformOptions to load the dbOps data. should be This function uses test_structure.LoadTerraformOptions to load the dbOpts data.

Note from the Author or Editor:
"dbOps" needs to be changed to "dbOpts"

Bryan Bai  Dec 14, 2019  Jul 10, 2020
Printed, PDF, ePub
Page 270
1st paragraph

so that the only things that execute are terraform apply and the validations for the hello-world-app module: should be : so that the only things that execute are deploy app and the validations for the hello-world-app module:

Note from the Author or Editor:
Replace "terraform apply" with "deploy app"

Bryan Bai  Dec 14, 2019  Jul 10, 2020
Printed, PDF, ePub
Page 280
2nd paragraph

The advantage of these tools is that the DLSs should be: The advantage of these tools is that the DSLs

Note from the Author or Editor:
Replace "DLSs" with "DSLs"

Bryan Bai  Dec 14, 2019  Jul 10, 2020
PDF
Page 289
Item 3 in the list

"3. The, the inevitable happens" should be "3. Then, the inevitable happens"

Yevgeniy (Jim) Brikman
Yevgeniy (Jim) Brikman
 
Sep 28, 2019  Oct 04, 2019
Mobi
Page 1331
Deploy a Single Web Server - Figure 2.7

The dependency graph has twice "aws_security_group.instance", where it should instead have "aws_instance.example" and "aws_security_group.instance". This is what I get when I copy/paste the DOT output from the book into Graphviz online.

Note from the Author or Editor:
Figure 2-7 does indeed have a mistake. There are two boxes that both say "aws_security_group.instance" whereas the top one of those boxes should actually say "aws_instance.example"

David Dieulivol  May 03, 2020  Jul 10, 2020
Mobi
Page 2261
bottom of page

Chapter 3 - Figure 3.8 has the name of the file set to "var.tf" for the terraform file holding the variables definitions, but it is said in the conventions a page before to name it "variables.tf". The "var.tf" file should most probably be renamed to "variables.tf" in that figure.

Note from the Author or Editor:
This is an error in several images. Any image that has "var.tf" or "vars.tf" should actually be "variables.tf". This includes the following images in the images folder: tur2_0404.png tur2_0310.png tur2_0308.png tur2_0307.png

David Dieulivol  May 10, 2020  Jul 10, 2020
ePub
Page 4231
4231

"one to tow weeks" Brikman, Yevgeniy. Terraform: Up & Running (Kindle Location 4231). O'Reilly Media. Kindle Edition.

Note from the Author or Editor:
Thanks for reporting! We'll get this typo fixed.

Collin Tobin  Sep 25, 2019  Oct 04, 2019