github.com/atsaki/terraform@v0.4.3-0.20150919165407-25bba5967654/website/source/docs/provisioners/chef.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Provisioner: chef" 4 sidebar_current: "docs-provisioners-chef" 5 description: |- 6 The `chef` provisioner invokes a Chef Client run on a remote resource after first installing and configuring Chef Client on the remote resource. The `chef` provisioner supports both `ssh` and `winrm` type connections. 7 --- 8 9 # Chef Provisioner 10 11 The `chef` provisioner invokes a Chef Client run on a remote resource after first installing 12 and configuring Chef Client on the remote resource. The `chef` provisioner supports both `ssh` 13 and `winrm` type [connections](/docs/provisioners/connection.html). 14 15 ## Requirements 16 17 In order for the `chef` provisioner to work properly, you need either `cURL` (when using 18 a `ssh` type connection) or `PowerShell 2.0` (when using a `winrm` type connection) to be 19 available on the target machine. 20 21 ## Example usage 22 23 ``` 24 # Start a initial chef run on a resource 25 resource "aws_instance" "web" { 26 ... 27 provisioner "chef" { 28 attributes { 29 "key" = "value" 30 "app" { 31 "cluster1" { 32 "nodes" = ["webserver1", "webserver2"] 33 } 34 } 35 } 36 environment = "_default" 37 run_list = ["cookbook::recipe"] 38 node_name = "webserver1" 39 secret_key_path = "../encrypted_data_bag_secret" 40 server_url = "https://chef.company.com/organizations/org1" 41 validation_client_name = "chef-validator" 42 validation_key_path = "../chef-validator.pem" 43 version = "12.4.1" 44 } 45 } 46 ``` 47 48 ## Argument Reference 49 50 The following arguments are supported: 51 52 * `attributes (map)` - (Optional) A map with initial node attributes for the new node. 53 See example. 54 55 * `environment (string)` - (Optional) The Chef environment the new node will be joining 56 (defaults `_default`). 57 58 * `log_to_file (boolean)` - (Optional) If true, the output of the initial Chef Client run 59 will be logged to a local file instead of the console. The file will be created in a 60 subdirectory called `logfiles` created in your current directory. The filename will be 61 the `node_name` of the new node. 62 63 * `http_proxy (string)` - (Optional) The proxy server for Chef Client HTTP connections. 64 65 * `https_proxy (string)` - (Optional) The proxy server for Chef Client HTTPS connections. 66 67 * `no_proxy (array)` - (Optional) A list of URLs that should bypass the proxy. 68 69 * `node_name (string)` - (Required) The name of the node to register with the Chef Server. 70 71 * `ohai_hints (array)` - (Optional) A list with 72 [Ohai hints](https://docs.chef.io/ohai.html#hints) to upload to the node. 73 74 * `os_type (string)` - (Optional) The OS type of the node. Valid options are: `linux` and 75 `windows`. If not supplied the connection type will be used to determine the OS type (`ssh` 76 will assume `linux` and `winrm` will assume `windows`). 77 78 * `prevent_sudo (boolean)` - (Optional) Prevent the use of sudo while installing, configuring 79 and running the initial Chef Client run. This option is only used with `ssh` type 80 [connections](/docs/provisioners/connection.html). 81 82 * `run_list (array)` - (Required) A list with recipes that will be invoked during the initial 83 Chef Client run. The run-list will also be saved to the Chef Server after a successful 84 initial run. 85 86 * `secret_key_path (string)` - (Optional) The path to the secret key that is used 87 by the client to decrypt data bags on the Chef Server. The key will be uploaded to the remote 88 machine. 89 90 * `server_url (string)` - (Required) The URL to the Chef server. This includes the path to 91 the organization. See the example. 92 93 * `skip_install (boolean)` - (Optional) Skip the installation of Chef Client on the remote 94 machine. This assumes Chef Client is already installed when you run the `chef` 95 provisioner. 96 97 * `ssl_verify_mode (string)` - (Optional) Use to set the verify mode for Chef Client HTTPS 98 requests. 99 100 * `validation_client_name (string)` - (Required) The name of the validation client to use 101 for the initial communication with the Chef Server. 102 103 * `validation_key_path (string)` - (Required) The path to the validation key that is needed 104 by the node to register itself with the Chef Server. The key will be uploaded to the remote 105 machine. 106 107 * `version (string)` - (Optional) The Chef Client version to install on the remote machine. 108 If not set the latest available version will be installed.