brikis98 / terraform-up-and-running-code

Code samples for the book "Terraform: Up & Running" by Yevgeniy Brikman
http://www.terraformupandrunning.com/
MIT License
2.83k stars 1.9k forks source link

Deprecated warnings when initialized with Terraform v0.15.3 #73

Closed KingAndrew closed 1 year ago

KingAndrew commented 3 years ago

Warning: Version constraints inside provider configuration blocks are deprecated │ │ on main.tf line 9, in provider "aws": │ 9: version = "~> 2.0"

Terraform 0.13 and earlier allowed provider version constraints inside the provider configuration block, but that is │ now deprecated and will be removed in a future version of Terraform. To silence this warning, move the provider │ version constraint into the required_providers block.

At this point in the book, I'm not sure where required_providers block is at.

gtoolit commented 3 years ago

@KingAndrew you need to remove the 9: version = "~> 2.0" from the provider version. This will get rid of the deprecated warning

brikis98 commented 3 years ago

As is listed multiple times in the book and this repo, the code examples are only tested with Terraform 0.12. Versions 0.13, 0.14, and 0.15 all introduced backwards incompatible changes, and the book/examples have not yet been updated to take those into account.

brikis98 commented 1 year ago

This has been updated in the 3rd edition of the book.