terraform/website/source/docs/providers/consul/r/service.html.markdown

50 lines
1.6 KiB
Markdown
Raw Normal View History

---
layout: "consul"
page_title: "Consul: consul_service"
sidebar_current: "docs-consul-resource-service"
description: |-
A high-level resource for creating a Service in Consul. Since Consul requires clients to register services with either the catalog or an agent, `consul_service` may register with either the catalog or an agent, depending on the configuration of `consul_service`. For now, `consul_service` always registers services with the agent running at the address defined in the `consul` resource. Health checks are not currently supported.
---
# consul\_service
A high-level resource for creating a Service in Consul. Currently, defining health checks for a service is not supported.
## Example Usage
```
resource "consul_service" "google" {
address = "www.google.com"
name = "google"
port = 80
tags = ["tag0", "tag1"]
}
```
## Argument Reference
The following arguments are supported:
Fixes for consul_service resource (#9366) Added `service_id` in place of `id` for resource. modified created, read, update to use `service_id` modified tests to include `service_id`. modified documentation for consul_service to include new value. Tests results CONSUL_HTTP_ADDR=localhost:8500 make testacc TEST=./builtin/providers/consul/ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/10/14 14:43:05 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/consul/ -v -timeout 120m === RUN TestAccDataConsulKeys_basic --- PASS: TestAccDataConsulKeys_basic (0.05s) === RUN TestAccConsulAgentService_basic --- PASS: TestAccConsulAgentService_basic (0.05s) === RUN TestAccConsulCatalogEntry_basic --- PASS: TestAccConsulCatalogEntry_basic (0.06s) === RUN TestAccConsulKeyPrefix_basic --- PASS: TestAccConsulKeyPrefix_basic (0.19s) === RUN TestConsulKeysMigrateState --- PASS: TestConsulKeysMigrateState (0.00s) === RUN TestConsulKeysMigrateState_empty --- PASS: TestConsulKeysMigrateState_empty (0.00s) === RUN TestAccConsulKeys_basic --- PASS: TestAccConsulKeys_basic (0.13s) === RUN TestAccConsulNode_basic --- PASS: TestAccConsulNode_basic (0.05s) === RUN TestAccConsulPreparedQuery_basic --- PASS: TestAccConsulPreparedQuery_basic (0.12s) === RUN TestAccConsulService_basic --- PASS: TestAccConsulService_basic (0.05s) === RUN TestResourceProvider --- PASS: TestResourceProvider (0.00s) === RUN TestResourceProvider_impl --- PASS: TestResourceProvider_impl (0.00s) === RUN TestResourceProvider_Configure --- PASS: TestResourceProvider_Configure (0.00s) === RUN TestResourceProvider_ConfigureTLS --- PASS: TestResourceProvider_ConfigureTLS (0.00s) PASS ok github.com/hashicorp/terraform/builtin/providers/consul 0.708s Refs: #9352
2016-10-26 14:07:00 +02:00
* `service_id` - (Optional, string) The id of the service, defaults to the value of `name` if not supplied.
* `address` - (Optional, string) The address of the service. Defaults to the
address of the agent.
Fixes for consul_service resource (#9366) Added `service_id` in place of `id` for resource. modified created, read, update to use `service_id` modified tests to include `service_id`. modified documentation for consul_service to include new value. Tests results CONSUL_HTTP_ADDR=localhost:8500 make testacc TEST=./builtin/providers/consul/ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/10/14 14:43:05 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/consul/ -v -timeout 120m === RUN TestAccDataConsulKeys_basic --- PASS: TestAccDataConsulKeys_basic (0.05s) === RUN TestAccConsulAgentService_basic --- PASS: TestAccConsulAgentService_basic (0.05s) === RUN TestAccConsulCatalogEntry_basic --- PASS: TestAccConsulCatalogEntry_basic (0.06s) === RUN TestAccConsulKeyPrefix_basic --- PASS: TestAccConsulKeyPrefix_basic (0.19s) === RUN TestConsulKeysMigrateState --- PASS: TestConsulKeysMigrateState (0.00s) === RUN TestConsulKeysMigrateState_empty --- PASS: TestConsulKeysMigrateState_empty (0.00s) === RUN TestAccConsulKeys_basic --- PASS: TestAccConsulKeys_basic (0.13s) === RUN TestAccConsulNode_basic --- PASS: TestAccConsulNode_basic (0.05s) === RUN TestAccConsulPreparedQuery_basic --- PASS: TestAccConsulPreparedQuery_basic (0.12s) === RUN TestAccConsulService_basic --- PASS: TestAccConsulService_basic (0.05s) === RUN TestResourceProvider --- PASS: TestResourceProvider (0.00s) === RUN TestResourceProvider_impl --- PASS: TestResourceProvider_impl (0.00s) === RUN TestResourceProvider_Configure --- PASS: TestResourceProvider_Configure (0.00s) === RUN TestResourceProvider_ConfigureTLS --- PASS: TestResourceProvider_ConfigureTLS (0.00s) PASS ok github.com/hashicorp/terraform/builtin/providers/consul 0.708s Refs: #9352
2016-10-26 14:07:00 +02:00
* `name` - (Required, string) The name of the service.
Fixes for consul_service resource (#9366) Added `service_id` in place of `id` for resource. modified created, read, update to use `service_id` modified tests to include `service_id`. modified documentation for consul_service to include new value. Tests results CONSUL_HTTP_ADDR=localhost:8500 make testacc TEST=./builtin/providers/consul/ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/10/14 14:43:05 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/consul/ -v -timeout 120m === RUN TestAccDataConsulKeys_basic --- PASS: TestAccDataConsulKeys_basic (0.05s) === RUN TestAccConsulAgentService_basic --- PASS: TestAccConsulAgentService_basic (0.05s) === RUN TestAccConsulCatalogEntry_basic --- PASS: TestAccConsulCatalogEntry_basic (0.06s) === RUN TestAccConsulKeyPrefix_basic --- PASS: TestAccConsulKeyPrefix_basic (0.19s) === RUN TestConsulKeysMigrateState --- PASS: TestConsulKeysMigrateState (0.00s) === RUN TestConsulKeysMigrateState_empty --- PASS: TestConsulKeysMigrateState_empty (0.00s) === RUN TestAccConsulKeys_basic --- PASS: TestAccConsulKeys_basic (0.13s) === RUN TestAccConsulNode_basic --- PASS: TestAccConsulNode_basic (0.05s) === RUN TestAccConsulPreparedQuery_basic --- PASS: TestAccConsulPreparedQuery_basic (0.12s) === RUN TestAccConsulService_basic --- PASS: TestAccConsulService_basic (0.05s) === RUN TestResourceProvider --- PASS: TestResourceProvider (0.00s) === RUN TestResourceProvider_impl --- PASS: TestResourceProvider_impl (0.00s) === RUN TestResourceProvider_Configure --- PASS: TestResourceProvider_Configure (0.00s) === RUN TestResourceProvider_ConfigureTLS --- PASS: TestResourceProvider_ConfigureTLS (0.00s) PASS ok github.com/hashicorp/terraform/builtin/providers/consul 0.708s Refs: #9352
2016-10-26 14:07:00 +02:00
* `port` - (Optional, int) The port of the service.
Fixes for consul_service resource (#9366) Added `service_id` in place of `id` for resource. modified created, read, update to use `service_id` modified tests to include `service_id`. modified documentation for consul_service to include new value. Tests results CONSUL_HTTP_ADDR=localhost:8500 make testacc TEST=./builtin/providers/consul/ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/10/14 14:43:05 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/consul/ -v -timeout 120m === RUN TestAccDataConsulKeys_basic --- PASS: TestAccDataConsulKeys_basic (0.05s) === RUN TestAccConsulAgentService_basic --- PASS: TestAccConsulAgentService_basic (0.05s) === RUN TestAccConsulCatalogEntry_basic --- PASS: TestAccConsulCatalogEntry_basic (0.06s) === RUN TestAccConsulKeyPrefix_basic --- PASS: TestAccConsulKeyPrefix_basic (0.19s) === RUN TestConsulKeysMigrateState --- PASS: TestConsulKeysMigrateState (0.00s) === RUN TestConsulKeysMigrateState_empty --- PASS: TestConsulKeysMigrateState_empty (0.00s) === RUN TestAccConsulKeys_basic --- PASS: TestAccConsulKeys_basic (0.13s) === RUN TestAccConsulNode_basic --- PASS: TestAccConsulNode_basic (0.05s) === RUN TestAccConsulPreparedQuery_basic --- PASS: TestAccConsulPreparedQuery_basic (0.12s) === RUN TestAccConsulService_basic --- PASS: TestAccConsulService_basic (0.05s) === RUN TestResourceProvider --- PASS: TestResourceProvider (0.00s) === RUN TestResourceProvider_impl --- PASS: TestResourceProvider_impl (0.00s) === RUN TestResourceProvider_Configure --- PASS: TestResourceProvider_Configure (0.00s) === RUN TestResourceProvider_ConfigureTLS --- PASS: TestResourceProvider_ConfigureTLS (0.00s) PASS ok github.com/hashicorp/terraform/builtin/providers/consul 0.708s Refs: #9352
2016-10-26 14:07:00 +02:00
* `tags` - (Optional, set of strings) A list of values that are opaque to Consul,
but can be used to distinguish between services or nodes.
## Attributes Reference
The following attributes are exported:
Fixes for consul_service resource (#9366) Added `service_id` in place of `id` for resource. modified created, read, update to use `service_id` modified tests to include `service_id`. modified documentation for consul_service to include new value. Tests results CONSUL_HTTP_ADDR=localhost:8500 make testacc TEST=./builtin/providers/consul/ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/10/14 14:43:05 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/consul/ -v -timeout 120m === RUN TestAccDataConsulKeys_basic --- PASS: TestAccDataConsulKeys_basic (0.05s) === RUN TestAccConsulAgentService_basic --- PASS: TestAccConsulAgentService_basic (0.05s) === RUN TestAccConsulCatalogEntry_basic --- PASS: TestAccConsulCatalogEntry_basic (0.06s) === RUN TestAccConsulKeyPrefix_basic --- PASS: TestAccConsulKeyPrefix_basic (0.19s) === RUN TestConsulKeysMigrateState --- PASS: TestConsulKeysMigrateState (0.00s) === RUN TestConsulKeysMigrateState_empty --- PASS: TestConsulKeysMigrateState_empty (0.00s) === RUN TestAccConsulKeys_basic --- PASS: TestAccConsulKeys_basic (0.13s) === RUN TestAccConsulNode_basic --- PASS: TestAccConsulNode_basic (0.05s) === RUN TestAccConsulPreparedQuery_basic --- PASS: TestAccConsulPreparedQuery_basic (0.12s) === RUN TestAccConsulService_basic --- PASS: TestAccConsulService_basic (0.05s) === RUN TestResourceProvider --- PASS: TestResourceProvider (0.00s) === RUN TestResourceProvider_impl --- PASS: TestResourceProvider_impl (0.00s) === RUN TestResourceProvider_Configure --- PASS: TestResourceProvider_Configure (0.00s) === RUN TestResourceProvider_ConfigureTLS --- PASS: TestResourceProvider_ConfigureTLS (0.00s) PASS ok github.com/hashicorp/terraform/builtin/providers/consul 0.708s Refs: #9352
2016-10-26 14:07:00 +02:00
* `service_id` - The id of the service, defaults to the value of `name`.
* `address` - The address of the service.
* `name` - The name of the service.
* `port` - The port of the service.
* `tags` - The tags of the service.