Search⌘ K
AI Features

Local Provisioners

Explore how to use Terraform local provisioners to execute commands on your local machine. Understand applying environment variables to resources, installing packages remotely, and extracting outputs like IP addresses. This lesson helps you manage resource configuration efficiently using local-exec provisioners in Terraform.

We'll cover the following...

Working with local provisioners

Local or local-exec provisioners are used to run commands on the local machine where the Terraform CLI is. We can do a handful of things with local provisioners. Let’s consider three scenarios where local-exec provisioners shine:

  1. Passing environment variables into a resource we create: Let’s consider a scenario where we have some variables that we need for our EC2 instance. We can define these variables in our configuration file and then export them to the instance while creating it. A code snippet that exemplifies this is shown
...