github.com/hs0210/hashicorp-terraform@v0.11.12-beta1/website/docs/provisioners/habitat.html.markdown (about) 1 --- 2 layout: "docs" 3 page_title: "Provisioner: habitat" 4 sidebar_current: "docs-provisioners-habitat" 5 description: |- 6 The `habitat` provisioner installs the Habitat supervisor, and loads configured services. 7 --- 8 9 # Habitat Provisioner 10 11 The `habitat` provisioner installs the [Habitat](https://habitat.sh) supervisor and loads configured services. This provisioner only supports Linux targets using the `ssh` connection type at this time. 12 ## Requirements 13 14 The `habitat` provisioner has some prerequisites for specific connection types: 15 16 - For `ssh` type connections, we assume a few tools to be available on the remote host: 17 * `curl` 18 * `tee` 19 * `setsid` - Only if using the `unmanaged` service type. 20 21 Without these prerequisites, your provisioning execution will fail. 22 23 ## Example usage 24 25 ```hcl 26 resource "aws_instance" "redis" { 27 count = 3 28 29 provisioner "habitat" { 30 peer = "${aws_instance.redis.0.private_ip}" 31 use_sudo = true 32 service_type = "systemd" 33 34 service { 35 name = "core/redis" 36 topology = "leader" 37 user_toml = "${file("conf/redis.toml")}" 38 } 39 } 40 } 41 42 ``` 43 44 ## Argument Reference 45 46 There are 2 configuration levels, `supervisor` and `service`. Configuration placed directly within the `provisioner` block are supervisor configurations, and a provisioner can define zero or more services to run, and each service will have a `service` block within the `provisioner`. A `service` block can also contain zero or more `bind` blocks to create service group bindings. 47 48 ### Supervisor Arguments 49 * `version (string)` - (Optional) The Habitat version to install on the remote machine. If not specified, the latest available version is used. 50 * `use_sudo (bool)` - (Optional) Use `sudo` when executing remote commands. Required when the user specified in the `connection` block is not `root`. (Defaults to `true`) 51 * `service_type (string)` - (Optional) Method used to run the Habitat supervisor. Valid options are `unmanaged` and `systemd`. (Defaults to `systemd`) 52 * `service_name (string)` - (Optional) The name of the Habitat supervisor service, if using an init system such as `systemd`. (Defaults to `hab-supervisor`) 53 * `peer (string)` - (Optional) IP or FQDN of a supervisor instance to peer with. (Defaults to none) 54 * `permanent_peer (bool)` - (Optional) Marks this supervisor as a permanent peer. (Defaults to false) 55 * `listen_gossip (string)` - (Optional) The listen address for the gossip system (Defaults to 0.0.0.0:9638) 56 * `listen_http (string)` - (Optional) The listen address for the HTTP gateway (Defaults to 0.0.0.0:9631) 57 * `ring_key (string)` - (Optional) The name of the ring key for encrypting gossip ring communication (Defaults to no encryption) 58 * `ring_key_content (string)` - (Optional) The key content. Only needed if using ring encryption and want the provisioner to take care of uploading and importing it. Easiest to source from a file (eg `ring_key_content = "${file("conf/foo-123456789.sym.key")}"`) (Defaults to none) 59 * `url (string)` - (Optional) The URL of a Builder service to download packages and receive updates from. (Defaults to https://bldr.habitat.sh) 60 * `channel (string)` - (Optional) The release channel in the Builder service to use. (Defaults to `stable`) 61 * `events (string)` - (Optional) Name of the service group running a Habitat EventSrv to forward Supervisor and service event data to. (Defaults to none) 62 * `override_name (string)` - (Optional) The name of the Supervisor (Defaults to `default`) 63 * `organization (string)` - (Optional) The organization that the Supervisor and it's subsequent services are part of. (Defaults to `default`) 64 * `builder_auth_token (string)` - (Optional) The builder authorization token when using a private origin. (Defaults to none) 65 66 ### Service Arguments 67 * `name (string)` - (Required) The Habitat package identifier of the service to run. (ie `core/haproxy` or `core/redis/3.2.4/20171002182640`) 68 * `binds (array)` - (Optional) An array of bind specifications. (ie `binds = ["backend:nginx.default"]`) 69 * `bind` - (Optional) An alternative way of declaring binds. This method can be easier to deal with when populating values from other values or variable inputs without having to do string interpolation. The following example is equivalent to `binds = ["backend:nginx.default"]`: 70 71 ```hcl 72 bind { 73 alias = "backend" 74 service = "nginx" 75 group = "default" 76 } 77 ``` 78 * `topology (string)` - (Optional) Topology to start service in. Possible values `standalone` or `leader`. (Defaults to `standalone`) 79 * `strategy (string)` - (Optional) Update strategy to use. Possible values `at-once`, `rolling` or `none`. (Defaults to `none`) 80 * `user_toml (string)` - (Optional) TOML formatted user configuration for the service. Easiest to source from a file (eg `user_toml = "${file("conf/redis.toml")}")`. (Defaults to none) 81 * `channel (string)` - (Optional) The release channel in the Builder service to use. (Defaults to `stable`) 82 * `group (string)` - (Optional) The service group to join. (Defaults to `default`) 83 * `url (string)` - (Optional) The URL of a Builder service to download packages and receive updates from. (Defaults to https://bldr.habitat.sh) 84 * `application (string)` - (Optional) The application name. (Defaults to none) 85 * `environment (string)` - (Optional) The environment name. (Defaults to none) 86 * `override_name (string)` - (Optional) The name for the state directory if there is more than one Supervisor running. (Defaults to `default`) 87 * `service_key (string)` - (Optional) The key content of a service private key, if using service group encryption. Easiest to source from a file (eg `service_key = "${file("conf/redis.default@org-123456789.box.key")}"`) (Defaults to none)