github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/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 = "${file("../encrypted_data_bag_secret")}" 40 server_url = "https://chef.company.com/organizations/org1" 41 validation_client_name = "chef-validator" 42 validation_key = "${file("../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 (string)` - (Optional) The contents of 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. These can be loaded from a file on disk using the [`file()` interpolation 89 function](/docs/configuration/interpolation.html#file_path_). 90 91 * `server_url (string)` - (Required) The URL to the Chef server. This includes the path to 92 the organization. See the example. 93 94 * `skip_install (boolean)` - (Optional) Skip the installation of Chef Client on the remote 95 machine. This assumes Chef Client is already installed when you run the `chef` 96 provisioner. 97 98 * `ssl_verify_mode (string)` - (Optional) Use to set the verify mode for Chef Client HTTPS 99 requests. 100 101 * `validation_client_name (string)` - (Required) The name of the validation client to use 102 for the initial communication with the Chef Server. 103 104 * `validation_key (string)` - (Required) The contents of the validation key that is needed 105 by the node to register itself with the Chef Server. The key will be uploaded to the remote 106 machine. These can be loaded from a file on disk using the [`file()` 107 interpolation function](/docs/configuration/interpolation.html#file_path_). 108 109 * `version (string)` - (Optional) The Chef Client version to install on the remote machine. 110 If not set the latest available version will be installed. 111 112 These are supported for backwards compatibility and may be removed in a 113 future version: 114 115 * `validation_key_path (string)` - __Deprecated: please use `validation_key` instead__. 116 * `secret_key_path (string)` - __Deprecated: please use `secret_key` instead__.