Clean up and add docs
Signed-off-by: Brian Dwyer <Brian.Dwyer@broadridge.com>
This commit is contained in:
parent
4701ed2e02
commit
2f4067cf70
|
@ -98,6 +98,7 @@ type provisioner struct {
|
|||
PolicyName string
|
||||
HTTPProxy string
|
||||
HTTPSProxy string
|
||||
MaxRetries int
|
||||
NamedRunList string
|
||||
NOProxy []string
|
||||
NodeName string
|
||||
|
@ -105,6 +106,7 @@ type provisioner struct {
|
|||
OSType string
|
||||
RecreateClient bool
|
||||
PreventSudo bool
|
||||
RetryOnExitCode []int
|
||||
RunList []string
|
||||
SecretKey string
|
||||
ServerURL string
|
||||
|
@ -115,9 +117,7 @@ type provisioner struct {
|
|||
UserKey string
|
||||
Vaults map[string][]string
|
||||
Version string
|
||||
RetryOnExitCode []int
|
||||
WaitForRetry int
|
||||
MaxRetries int
|
||||
|
||||
cleanupUserKeyCmd string
|
||||
createConfigFiles provisionFn
|
||||
|
@ -201,6 +201,11 @@ func Provisioner() terraform.ResourceProvisioner {
|
|||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
"max_retries": &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Default: 1,
|
||||
},
|
||||
"no_proxy": &schema.Schema{
|
||||
Type: schema.TypeList,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
|
@ -219,12 +224,17 @@ func Provisioner() terraform.ResourceProvisioner {
|
|||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
"prevent_sudo": &schema.Schema{
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
},
|
||||
"recreate_client": &schema.Schema{
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
},
|
||||
"prevent_sudo": &schema.Schema{
|
||||
Type: schema.TypeBool,
|
||||
"retry_on_exit_code": &schema.Schema{
|
||||
Type: schema.TypeList,
|
||||
Elem: &schema.Schema{Type: schema.TypeInt},
|
||||
Optional: true,
|
||||
},
|
||||
"run_list": &schema.Schema{
|
||||
|
@ -256,18 +266,6 @@ func Provisioner() terraform.ResourceProvisioner {
|
|||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
// Same defaults as Test-Kitchen
|
||||
// https://github.com/test-kitchen/test-kitchen/blob/e5998e0dd1aa42601c55659da78f9b112ff9f8ee/lib/kitchen/provisioner/base.rb#L36-38
|
||||
"retry_on_exit_code": &schema.Schema{
|
||||
Type: schema.TypeList,
|
||||
Elem: &schema.Schema{Type: schema.TypeInt},
|
||||
Optional: true,
|
||||
},
|
||||
"max_retries": &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Default: 1,
|
||||
},
|
||||
"wait_for_retry": &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
|
@ -790,12 +788,14 @@ func decodeConfig(d *schema.ResourceData) (*provisioner, error) {
|
|||
HTTPProxy: d.Get("http_proxy").(string),
|
||||
HTTPSProxy: d.Get("https_proxy").(string),
|
||||
NOProxy: getStringList(d.Get("no_proxy")),
|
||||
MaxRetries: d.Get("max_retries").(int),
|
||||
NamedRunList: d.Get("named_run_list").(string),
|
||||
NodeName: d.Get("node_name").(string),
|
||||
OhaiHints: getStringList(d.Get("ohai_hints")),
|
||||
OSType: d.Get("os_type").(string),
|
||||
RecreateClient: d.Get("recreate_client").(bool),
|
||||
PreventSudo: d.Get("prevent_sudo").(bool),
|
||||
RetryOnExitCode: getIntList(d.Get("retry_on_exit_code")),
|
||||
RunList: getStringList(d.Get("run_list")),
|
||||
SecretKey: d.Get("secret_key").(string),
|
||||
ServerURL: d.Get("server_url").(string),
|
||||
|
@ -805,9 +805,7 @@ func decodeConfig(d *schema.ResourceData) (*provisioner, error) {
|
|||
UserName: d.Get("user_name").(string),
|
||||
UserKey: d.Get("user_key").(string),
|
||||
Version: d.Get("version").(string),
|
||||
RetryOnExitCode: getIntList(d.Get("retry_on_exit_code")),
|
||||
WaitForRetry: d.Get("wait_for_retry").(int),
|
||||
MaxRetries: d.Get("max_retries").(int),
|
||||
}
|
||||
|
||||
// Make sure the supplied URL has a trailing slash
|
||||
|
|
|
@ -57,9 +57,11 @@ resource "aws_instance" "web" {
|
|||
recreate_client = true
|
||||
user_name = "bork"
|
||||
user_key = "${file("../bork.pem")}"
|
||||
version = "12.4.1"
|
||||
version = "15.10.13"
|
||||
# If you have a self signed cert on your chef server change this to :verify_none
|
||||
ssl_verify_mode = ":verify_peer"
|
||||
# Gracefully handle Chef upgrades, reboots, etc.
|
||||
retry_on_exit_code = [35, 213]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -109,6 +111,8 @@ The following arguments are supported:
|
|||
|
||||
* `https_proxy (string)` - (Optional) The proxy server for Chef Client HTTPS connections.
|
||||
|
||||
* `max_retries (integer)` - (Optional) The number of times to retry the provisioning process after receiving an exit code in the `retry_on_error` list. Defaults to `1`
|
||||
|
||||
* `named_run_list (string)` - (Optional) The name of an alternate run-list to invoke during the
|
||||
initial Chef Client run. The run-list must already exist in the Policyfile that defines
|
||||
`policy_name`. Only applies when `use_policyfile` is `true`.
|
||||
|
@ -131,6 +135,8 @@ The following arguments are supported:
|
|||
* `recreate_client (boolean)` - (Optional) If `true`, first delete any existing Chef Node and
|
||||
Client before registering the new Chef Client.
|
||||
|
||||
* `retry_on_error (list of integers)` - (Optional) The error codes upon which Terraform should gracefully retry the provisioning process. Intended for use with [Chef RFC062 codes.](https://github.com/chef-boneyard/chef-rfc/blob/69a19f632cceffe965bafaad6765e3376068fd5b/rfc062-exit-status.md)
|
||||
|
||||
* `run_list (array)` - (Optional) A list with recipes that will be invoked during the initial
|
||||
Chef Client run. The run-list will also be saved to the Chef Server after a successful
|
||||
initial run. Required if `use_policyfile` is `false`; ignored when `use_policyfile` is `true`
|
||||
|
@ -169,3 +175,5 @@ The following arguments are supported:
|
|||
|
||||
* `version (string)` - (Optional) The Chef Client version to install on the remote machine.
|
||||
If not set, the latest available version will be installed.
|
||||
|
||||
* `wait_for_retry (integer)` - (Optional) - Amount of time in seconds to wait before retrying the provisionining process after receiving an exit code in the `retry_on_error` list. Defaults to `30`.
|
||||
|
|
Loading…
Reference in New Issue