2 Terraform HCL components
This chapter covers
- How to configure a Workspace and its Providers
- The basic syntax of Terraform Blocks
- How to lookup data with Data Source
- Managing infrastructure with Resource blocks
- Changing the behavior of Resources with Meta Arguments
- Using Modules for reusable components
In the last chapter we talked a bit about Terraform and Declarative languages. Using Terraform’s Declarative Language you define how you want your systems to look, and then Terraform builds and updates your systems based on that language. One way to look at it is to compare it to construction; an architect creates a plan and then a construction team builds it based on that plan. In this scenario, you’re the systems architect and Terraform is your construction crew.
In this chapter, we’re going to talk about how to define those plans. Just like construction workers, Terraform has its own language that it reads and interprets to build things. In this case, we’re not creating buildings, but rather systems of interconnected resources hosted by vendors such as Cloud Providers like AWS, GCP, or Azure. As the systems grow and evolve the “blueprints” can be updated, which then allows Terraform to upgrade the running systems until they line up with those blueprints.