github.com/tarrant/terraform@v0.3.8-0.20150402012457-f68c9eee638e/website/source/docs/provisioners/connection.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Provisioner Connections" 4 sidebar_current: "docs-provisioners-connection" 5 description: |- 6 Many provisioners require access to the remote resource. For example, a provisioner may need to use ssh to connect to the resource. 7 --- 8 9 # Provisioner Connections 10 11 Many provisioners require access to the remote resource. For example, 12 a provisioner may need to use ssh to connect to the resource. 13 14 Terraform uses a number of defaults when connecting to a resource, but these 15 can be overridden using `connection` block in either a `resource` or `provisioner`. 16 Any `connection` information provided in a `resource` will apply to all the 17 provisioners, but it can be scoped to a single provisioner as well. One use case 18 is to have an initial provisioner connect as root to setup user accounts, and have 19 subsequent provisioners connect as a user with more limited permissions. 20 21 ## Example usage 22 23 ``` 24 # Copies the file as the root user using a password 25 provisioner "file" { 26 source = "conf/myapp.conf" 27 destination = "/etc/myapp.conf" 28 connection { 29 user = "root" 30 password = "${var.root_password}" 31 } 32 } 33 ``` 34 35 ## Argument Reference 36 37 The following arguments are supported: 38 39 * `type` - The connection type that should be used. This defaults to "ssh". The type 40 of connection supported depends on the provisioner. 41 42 * `user` - The user that we should use for the connection. This defaults to "root". 43 44 * `password` - The password we should use for the connection. 45 46 * `key_file` - The SSH key to use for the connection. This takes preference over the 47 password if provided. 48 49 * `agent` - Set to true to enable using ssh-agent to authenticate. 50 51 * `host` - The address of the resource to connect to. This is provided by the provider. 52 53 * `port` - The port to connect to. This defaults to 22. 54 55 * `timeout` - The timeout to wait for the connection to become available. This defaults 56 to 5 minutes. Should be provided as a string like "30s" or "5m". 57