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