mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Updating the docs
This commit is contained in:
parent
4a29c714e5
commit
907eee24f2
@ -3,13 +3,13 @@ layout: "docs"
|
||||
page_title: "Provisioner Connections"
|
||||
sidebar_current: "docs-provisioners-connection"
|
||||
description: |-
|
||||
Many provisioners require access to the remote resource. For example, a provisioner may need to use ssh to connect to the resource.
|
||||
Many provisioners require access to the remote resource. For example, a provisioner may need to use SSH or WinRM to connect to the resource.
|
||||
---
|
||||
|
||||
# Provisioner Connections
|
||||
|
||||
Many provisioners require access to the remote resource. For example,
|
||||
a provisioner may need to use ssh to connect to the resource.
|
||||
a provisioner may need to use SSH or WinRM to connect to the resource.
|
||||
|
||||
Terraform uses a number of defaults when connecting to a resource, but these
|
||||
can be overridden using `connection` block in either a `resource` or `provisioner`.
|
||||
@ -21,7 +21,7 @@ subsequent provisioners connect as a user with more limited permissions.
|
||||
## Example usage
|
||||
|
||||
```
|
||||
# Copies the file as the root user using a password
|
||||
# Copies the file as the root user using SSH
|
||||
provisioner "file" {
|
||||
source = "conf/myapp.conf"
|
||||
destination = "/etc/myapp.conf"
|
||||
@ -30,28 +30,53 @@ provisioner "file" {
|
||||
password = "${var.root_password}"
|
||||
}
|
||||
}
|
||||
|
||||
# Copies the file as the Administrator user using WinRM
|
||||
provisioner "file" {
|
||||
source = "conf/myapp.conf"
|
||||
destination = "C:/App/myapp.conf"
|
||||
connection {
|
||||
type = "winrm"
|
||||
user = "Administrator"
|
||||
password = "${var.admin_password}"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
**The following arguments are supported by all connection types:**
|
||||
|
||||
* `type` - The connection type that should be used. This defaults to "ssh". The type
|
||||
of connection supported depends on the provisioner.
|
||||
* `type` - The connection type that should be used. Valid types are "ssh" and "winrm"
|
||||
This defaults to "ssh".
|
||||
|
||||
* `user` - The user that we should use for the connection. This defaults to "root".
|
||||
* `user` - The user that we should use for the connection. Defaults to "root" when
|
||||
using type "ssh" and defaults to "Administrator" when using type "winrm".
|
||||
|
||||
* `password` - The password we should use for the connection.
|
||||
|
||||
* `key_file` - The SSH key to use for the connection. This takes preference over the
|
||||
password if provided.
|
||||
|
||||
* `agent` - Set to true to enable using ssh-agent to authenticate.
|
||||
* `password` - The password we should use for the connection. In some cases this is
|
||||
provided by the provider.
|
||||
|
||||
* `host` - The address of the resource to connect to. This is provided by the provider.
|
||||
|
||||
* `port` - The port to connect to. This defaults to 22.
|
||||
* `port` - The port to connect to. Defaults to 22 when using type "ssh" and defaults
|
||||
to 5985 when using type "winrm".
|
||||
|
||||
* `timeout` - The timeout to wait for the connection to become available. This defaults
|
||||
to 5 minutes. Should be provided as a string like "30s" or "5m".
|
||||
to 5 minutes. Should be provided as a string like "30s" or "5m".
|
||||
|
||||
* `script_path` - The path used to copy scripts to meant for remote execution.
|
||||
|
||||
**Additional arguments only supported by the "ssh" connection type:**
|
||||
|
||||
* `key_file` - The SSH key to use for the connection. This takes preference over the
|
||||
password if provided.
|
||||
|
||||
* `agent` - Set to true to enable using ssh-agent to authenticate.
|
||||
|
||||
**Additional arguments only supported by the "winrm" connection type:**
|
||||
|
||||
* `https` - Set to true to connect using HTTPS instead of HTTP.
|
||||
|
||||
* `insecure` - Set to true to not validate the HTTPS certificate chain.
|
||||
|
||||
* `cacert` - The CA certificate to validate against.
|
||||
|
@ -9,8 +9,8 @@ description: |-
|
||||
# File Provisioner
|
||||
|
||||
The `file` provisioner is used to copy files or directories from the machine
|
||||
executing Terraform to the newly created resource. The `file` provisioner only
|
||||
supports `ssh` type [connections](/docs/provisioners/connection.html).
|
||||
executing Terraform to the newly created resource. The `file` provisioner
|
||||
supports both `ssh` and `winrm` type [connections](/docs/provisioners/connection.html).
|
||||
|
||||
## Example usage
|
||||
|
||||
@ -29,6 +29,12 @@ resource "aws_instance" "web" {
|
||||
source = "conf/configs.d"
|
||||
destination = "/etc"
|
||||
}
|
||||
|
||||
# Copies all files and folders in apps/app1 to D:/IIS/webapp1
|
||||
provisioner "file" {
|
||||
source = "apps/app1/"
|
||||
destination = "D:/IIS/webapp1"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -47,8 +53,10 @@ The following arguments are supported:
|
||||
The file provisioner is also able to upload a complete directory to the remote machine.
|
||||
When uploading a directory, there are a few important things you should know.
|
||||
|
||||
First, the destination directory must already exist. If you need to create it,
|
||||
use a remote-exec provisioner just prior to the file provisioner in order to create the directory.
|
||||
First, when using the `ssh` connection type the destination directory must already exist.
|
||||
If you need to create it, use a remote-exec provisioner just prior to the file provisioner
|
||||
in order to create the directory. When using the `winrm` connection type the destination
|
||||
directory will be created for you if it doesn't already exist.
|
||||
|
||||
Next, the existence of a trailing slash on the source path will determine whether the
|
||||
directory name will be embedded within the destination, or whether the destination will
|
||||
@ -63,4 +71,3 @@ If the source, however, is `/foo/` (a trailing slash is present), and the destin
|
||||
|
||||
This behavior was adopted from the standard behavior of rsync. Note that under the covers,
|
||||
rsync may or may not be used.
|
||||
|
||||
|
@ -12,7 +12,7 @@ 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](/docs/provisioners/local-exec.html) instead. The `remote-exec`
|
||||
provisioner only supports `ssh` type [connections](/docs/provisioners/connection.html).
|
||||
provisioner supports both `ssh` and `winrm` type [connections](/docs/provisioners/connection.html).
|
||||
|
||||
|
||||
## Example usage
|
||||
|
Loading…
Reference in New Issue
Block a user