Creating an EC2 instance with Terraform

Resources are components of your infrastructure. They can be something as complex as a complete virtual server, or something as simple as a DNS record. Each resource belongs to a provider, and the type of the resource is suffixed with the provider name. The configuration of a resource takes the following form:

resource "provider-name_resource-type" "resource-name" { 
  parameter_name = parameter_value 
} 

The combination of resource type and resource name must be unique in your template; otherwise Terraform will complain.

There are three types of things you can configure inside a resource block: resource-specific parameters, meta-parameters, and provisioners. For now, let's focus on resource-specific parameters. ...

Get Getting Started with Terraform - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.