github.com/jrasell/terraform@v0.6.17-0.20160523115548-2652f5232949/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_json = <<EOF 29 { 30 "key": "value", 31 "app": { 32 "cluster1": { 33 "nodes": [ 34 "webserver1", 35 "webserver2" 36 ] 37 } 38 } 39 } 40 EOF 41 environment = "_default" 42 run_list = ["cookbook::recipe"] 43 node_name = "webserver1" 44 secret_key = "${file("../encrypted_data_bag_secret")}" 45 server_url = "https://chef.company.com/organizations/org1" 46 validation_client_name = "chef-validator" 47 validation_key = "${file("../chef-validator.pem")}" 48 version = "12.4.1" 49 } 50 } 51 ``` 52 53 ## Argument Reference 54 55 The following arguments are supported: 56 57 * `attributes_json (string)` - (Optional) A raw JSON string with initial node attributes 58 for the new node. These can also be loaded from a file on disk using the [`file()` 59 interpolation function](/docs/configuration/interpolation.html#file_path_). 60 61 * `client_options (array)` - (Optional) A list of optional Chef Client configuration 62 options. See the [Chef Client ](https://docs.chef.io/config_rb_client.html) documentation for all available options. 63 64 * `disable_reporting (boolean)` - (Optional) If true the Chef Client will not try to send 65 reporting data (used by Chef Reporting) to the Chef Server (defaults false) 66 67 * `environment (string)` - (Optional) The Chef environment the new node will be joining 68 (defaults `_default`). 69 70 * `fetch_chef_certificates (boolean)` (Optional) If true the SSL certificates configured 71 on your Chef server will be fetched and trusted. See the knife [ssl_fetch](https://docs.chef.io/knife_ssl_fetch.html) 72 documentation for more details. 73 74 * `log_to_file (boolean)` - (Optional) If true, the output of the initial Chef Client run 75 will be logged to a local file instead of the console. The file will be created in a 76 subdirectory called `logfiles` created in your current directory. The filename will be 77 the `node_name` of the new node. 78 79 * `http_proxy (string)` - (Optional) The proxy server for Chef Client HTTP connections. 80 81 * `https_proxy (string)` - (Optional) The proxy server for Chef Client HTTPS connections. 82 83 * `no_proxy (array)` - (Optional) A list of URLs that should bypass the proxy. 84 85 * `node_name (string)` - (Required) The name of the node to register with the Chef Server. 86 87 * `ohai_hints (array)` - (Optional) A list with 88 [Ohai hints](https://docs.chef.io/ohai.html#hints) to upload to the node. 89 90 * `os_type (string)` - (Optional) The OS type of the node. Valid options are: `linux` and 91 `windows`. If not supplied the connection type will be used to determine the OS type (`ssh` 92 will assume `linux` and `winrm` will assume `windows`). 93 94 * `prevent_sudo (boolean)` - (Optional) Prevent the use of sudo while installing, configuring 95 and running the initial Chef Client run. This option is only used with `ssh` type 96 [connections](/docs/provisioners/connection.html). 97 98 * `run_list (array)` - (Required) A list with recipes that will be invoked during the initial 99 Chef Client run. The run-list will also be saved to the Chef Server after a successful 100 initial run. 101 102 * `secret_key (string)` - (Optional) The contents of the secret key that is used 103 by the client to decrypt data bags on the Chef Server. The key will be uploaded to the remote 104 machine. These can be loaded from a file on disk using the [`file()` interpolation 105 function](/docs/configuration/interpolation.html#file_path_). 106 107 * `server_url (string)` - (Required) The URL to the Chef server. This includes the path to 108 the organization. See the example. 109 110 * `skip_install (boolean)` - (Optional) Skip the installation of Chef Client on the remote 111 machine. This assumes Chef Client is already installed when you run the `chef` 112 provisioner. 113 114 * `ssl_verify_mode (string)` - (Optional) Use to set the verify mode for Chef Client HTTPS 115 requests. 116 117 * `validation_client_name (string)` - (Required) The name of the validation client to use 118 for the initial communication with the Chef Server. 119 120 * `validation_key (string)` - (Required) The contents of the validation key that is needed 121 by the node to register itself with the Chef Server. The key will be uploaded to the remote 122 machine. These can be loaded from a file on disk using the [`file()` 123 interpolation function](/docs/configuration/interpolation.html#file_path_). 124 125 * `version (string)` - (Optional) The Chef Client version to install on the remote machine. 126 If not set the latest available version will be installed. 127 128 These are supported for backwards compatibility and may be removed in a 129 future version: 130 131 * `attributes (map)` - __Deprecated: please use `attributes_json` instead__. 132 * `secret_key_path (string)` - __Deprecated: please use `secret_key` instead__. 133 * `validation_key_path (string)` - __Deprecated: please use `validation_key` instead__.