github.com/wikibal01/hashicorp-terraform@v0.11.12-beta1/website/docs/provisioners/remote-exec.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Provisioner: remote-exec" 4 sidebar_current: "docs-provisioners-remote" 5 description: |- 6 The `remote-exec` provisioner invokes a script on a remote resource after it is created. This can be used to run a configuration management tool, bootstrap into a cluster, etc. To invoke a local process, see the `local-exec` provisioner instead. The `remote-exec` provisioner supports both `ssh` and `winrm` type connections. 7 --- 8 9 # remote-exec Provisioner 10 11 The `remote-exec` provisioner invokes a script on a remote resource after it 12 is created. This can be used to run a configuration management tool, bootstrap 13 into a cluster, etc. To invoke a local process, see the `local-exec` 14 [provisioner](/docs/provisioners/local-exec.html) instead. The `remote-exec` 15 provisioner supports both `ssh` and `winrm` type [connections](/docs/provisioners/connection.html). 16 17 18 ## Example usage 19 20 ```hcl 21 resource "aws_instance" "web" { 22 # ... 23 24 provisioner "remote-exec" { 25 inline = [ 26 "puppet apply", 27 "consul join ${aws_instance.web.private_ip}", 28 ] 29 } 30 } 31 ``` 32 33 ## Argument Reference 34 35 The following arguments are supported: 36 37 * `inline` - This is a list of command strings. They are executed in the order 38 they are provided. This cannot be provided with `script` or `scripts`. 39 40 * `script` - This is a path (relative or absolute) to a local script that will 41 be copied to the remote resource and then executed. This cannot be provided 42 with `inline` or `scripts`. 43 44 * `scripts` - This is a list of paths (relative or absolute) to local scripts 45 that will be copied to the remote resource and then executed. They are executed 46 in the order they are provided. This cannot be provided with `inline` or `script`. 47 48 ## Script Arguments 49 50 You cannot pass any arguments to scripts using the `script` or 51 `scripts` arguments to this provisioner. If you want to specify arguments, 52 upload the script with the 53 [file provisioner](/docs/provisioners/file.html) 54 and then use `inline` to call it. Example: 55 56 ```hcl 57 resource "aws_instance" "web" { 58 # ... 59 60 provisioner "file" { 61 source = "script.sh" 62 destination = "/tmp/script.sh" 63 } 64 65 provisioner "remote-exec" { 66 inline = [ 67 "chmod +x /tmp/script.sh", 68 "/tmp/script.sh args", 69 ] 70 } 71 } 72 ```