Errata

Terraform: Up and Running

Errata for Terraform: Up and 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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Other Digital Version chapter 5
Loops with for_each Expressions

"The for_each expression allows you to loop over lists, sets, and maps"

"COLLECTION is a set or map to loop over (lists are not supported when using for_each on a resource)"

i suppose there is a contradiction

Michele Sartor  Sep 22, 2022 
Printed Page chapter 1, page 5,
page 5, 1st paragraph

There is a very obvious error in this section, when talking about the ad hoc script, the author says it “great ” and "terrible".

Jiakang  Oct 28, 2022 
Other Digital Version Chapter 2, Deploying a Configurable Web Server
3rd terraform apply snippet

It might worth to mention that the first time `terraform apply` is used after output variable is declared (with no changes to any resources) the question to save new output value to the Terraform state is appeared.

```
$ terraform apply
aws_security_group.instance: Refreshing state... [id=sg-0942e8axxxxxxxxxx]
aws_instance.example: Refreshing state... [id=i-085601cxxxxxxxxxx]

Changes to Outputs:
+ public_ip = "16.xx.xx.xx"

You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.

Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.

Enter a value: yes


Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

public_ip = "16.xx.xx.xx"
```

Michael Loginovsky  Mar 11, 2023 
Other Digital Version Chapter 3, Limitations with Terraform’s Backends
2nd paragraph

It seems that for terraform version 1.4.0, to copy the Terraform state back to local disk after removing the `backend` configuration from `main.tf`, it is necessary to run the mentioned command with `-migrate-state` flag, like: `terraform init -migrate-state`

Michael Loginovsky  Mar 12, 2023 
Printed Page Chapter 2
pages 73-75

while following along in chapter 2 I did not see an instruction to create or use the variable.tf or output.tf files
Also with the creation of the load balancer I had errors which were only resolved when I checked the code against the code in Git I saw that there were some differences that I could not see where they were stated within the book. These were around the creation of the load balancer from page 73 onwards.

Resource "aws_lb" "example" setting the name:
Book value "terraform-asg-example" Git code: var.alb_name

Resource "aws_lb_target_group" setting the name
Book value "terraform-asg-example" Git code: var.alb_name

resource "aws_security_group" "alb" Setting the name
Book value "terraform-example-alb" Git code: var.alb_security_group_name

Steven Robbins  Jul 15, 2023 
Chapter 4, Module basics
Fourth paragraph

Both the provider definition and the backend need to be removed and added to the environment-specific main.tf files. Running the module with the backend in the module configuration will generate an error, and the configuration will be saved locally.

Grant Palmer  Aug 08, 2023 
Printed Page 268
examples/kubernetes-eks/main.tf

As of 10/8/23, this section fails to include this snippet or even allude to it being necessary to run the example (it hangs otherwise and fails to deploy to EKS), you'd only find this after reviewing the companion github repo:

```
terraform {
required_version = ">= 1.0.0, < 2.0.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.0"
}
}
}
```

Michael Hadam  Oct 08, 2023 
PDF Page 284
The first list in the page (resources needed to be moved)

The list of resources that need to be moved contains "aws_cloudwatch_metric_alarm (both of them)" but this resource hasn't been created anywhere in the book. It seems this was created in Chapter 5 in the 2nd edition while it isn't in the 3rd edition. Note that the sample code for the 3rd edition also contains the resource aws_cloudwatch_metric_alarm.

Hayato Matsuura  Jul 29, 2023