Creating Resources in terraform
Create Resource Dependencies
Infrastructure as Code with Terraform
This lab was developed with our partner, Hashicorp. Your personal information may be shared with Hashicorp, the lab sponsor, if you have opted-in to receive product updates, announcements, and offers in your Account Profile.
Terraform is the infrastructure as code offering from HashiCorp. It is a tool for building, changing, and managing infrastructure in a safe, repeatable way. Operators and Infrastructure teams can use Terraform to manage environments with a configuration language called the HashiCorp Configuration Language (HCL) for human-readable, automated deployments.
Infrastructure as code is the process of managing infrastructure in a file or files rather than manually configuring resources in a user interface. A resource in this instance is any piece of infrastructure in a given environment, such as a virtual machine, security group, network interface, etc. At a high level, Terraform allows operators to use HCL to author files containing definitions of their desired resources on almost any provider (AWS, Google Cloud, GitHub, Docker, etc.) and automates the creation of those resources at the time of apply.
A simple workflow for deployment will follow closely to the steps below:
Scope - Confirm what resources need to be created for a given project.
Author - Create the configuration file in HCL based on the scoped parameters.
Initialize - Run
terraform initin the project directory with the configuration files. This will download the correct provider plug-ins for the project.
Plan & Apply - Run
terraform planto verify creation process and then
terraform applyto create real resources as well as the state file that compares future changes in your configuration files to what actually exists in your deployment environment.
In this lab you will learn how to perform the following tasks:
Build, change, and destroy infrastructure with Terraform
Create Resource Dependencies with Terraform
Provision infrastructure with Terraform
Join Qwiklabs to read the rest of this lab...and more!
- Get temporary access to the Google Cloud Console.
- Over 200 labs from beginner to advanced levels.
- Bite-sized so you can learn at your own pace.