2014-07-23 11:40:15 -05:00
---
layout: "docs"
page_title: "Provisioner: local-exec"
sidebar_current: "docs-provisioners-local"
2014-10-21 22:21:56 -05:00
description: |-
The `local-exec` provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on the resource. See the `remote-exec` provisioner to run commands on the resource.
2014-07-23 11:40:15 -05:00
---
# local-exec Provisioner
2017-04-05 10:29:27 -05:00
The `local-exec` provisioner invokes a local executable after a resource is
created. This invokes a process on the machine running Terraform, not on the
resource. See the `remote-exec`
[provisioner ](/docs/provisioners/remote-exec.html ) to run commands on the
resource.
2014-07-23 11:40:15 -05:00
2017-04-05 10:29:27 -05:00
Note that even though the resource will be fully created when the provisioner is
run, there is no guarantee that it will be in an operable state - for example
system services such as `sshd` may not be started yet on compute resources.
2016-08-30 04:24:36 -05:00
2014-07-23 11:40:15 -05:00
## Example usage
2017-04-05 10:29:27 -05:00
```hcl
2014-07-23 11:40:15 -05:00
resource "aws_instance" "web" {
2017-02-18 16:48:50 -06:00
# ...
2017-04-05 10:29:27 -05:00
2017-02-18 16:48:50 -06:00
provisioner "local-exec" {
command = "echo ${aws_instance.web.private_ip} >> private_ips.txt"
}
2014-07-23 11:40:15 -05:00
}
```
## Argument Reference
2014-07-29 01:51:24 -05:00
The following arguments are supported:
2014-07-23 11:40:15 -05:00
* `command` - (Required) This is the command to execute. It can be provided
as a relative path to the current working directory or as an absolute path.
It is evaluated in a shell, and can use environment variables or Terraform
variables.