0Pricing
Terraform Infrastructure as Code · Lesson

Local and Remote Exec Provisioners

Implement `local-exec` and `remote-exec` provisioners to run commands on the machine running Terraform or on the created resources respectively.

Meet Terraform Provisioners

What if you need to run a script or command after Terraform creates a resource? That's where provisioners come in!

Provisioners allow you to execute actions on the local machine or on a remote resource as part of its lifecycle. They bridge the gap between infrastructure creation and initial software setup.

Think of them as hooks that let you customize your resources right after they're born.

`local-exec`: Run Locally

The local-exec provisioner runs commands on the machine where Terraform is being executed.

This is useful for tasks like:

  • Generating configuration files locally.
  • Triggering local scripts or tools.
  • Performing cleanup operations after resource destruction.

It's perfect for actions that don't need to happen on the cloud resource itself.

All lessons in this course

  1. Querying Data with Data Sources
  2. Local and Remote Exec Provisioners
  3. Null Resources and Triggers
  4. Using External Data and Templates
← Back to Terraform Infrastructure as Code