2020-10-06 20:34:16 -04:00
---
2021-01-14 14:07:36 -08:00
# generated by https://github.com/hashicorp/terraform-plugin-docs
2020-10-06 20:34:16 -04:00
page_title : "boundary_target Resource - terraform-provider-boundary"
subcategory : ""
description : |-
The target resource allows you to configure a Boundary target.
---
2021-05-05 10:02:53 -07:00
# boundary_target (Resource)
2020-10-06 20:34:16 -04:00
The target resource allows you to configure a Boundary target.
## Example Usage
```terraform
resource "boundary_scope" "global" {
2020-10-13 23:12:03 -04:00
global_scope = true
scope_id = "global"
2020-10-06 20:34:16 -04:00
}
resource "boundary_scope" "org" {
2020-10-13 23:12:03 -04:00
name = "organization_one"
description = "My first scope!"
scope_id = boundary_scope . global . id
auto_create_admin_role = true
auto_create_default_role = true
2020-10-06 20:34:16 -04:00
}
resource "boundary_scope" "project" {
2021-01-14 14:07:36 -08:00
name = "project_one"
description = "My first scope!"
scope_id = boundary_scope . org . id
auto_create_admin_role = true
2020-10-06 20:34:16 -04:00
}
2021-06-22 21:07:07 -07:00
resource "boundary_credential_store_vault" "foo" {
name = "vault_store"
description = "My first Vault credential store!"
2021-06-30 19:40:27 -04:00
address = "http://127.0.0.1:8200" # change to Vault address
token = "s.0ufRo6XEGU2jOqnIr7OlFYP5" # change to valid Vault token
2021-06-22 21:07:07 -07:00
scope_id = boundary_scope . project . id
}
resource "boundary_credential_library_vault" "foo" {
2021-06-25 13:30:23 -07:00
name = "foo"
2021-06-22 21:07:07 -07:00
description = "My first Vault credential library!"
credential_store_id = boundary_credential_store_vault . foo . id
2021-06-25 13:30:23 -07:00
path = "my/secret/foo" # change to Vault backend path
2021-06-22 21:07:07 -07:00
http_method = "GET"
2022-09-13 08:21:24 -07:00
credential_type = "username_password"
2021-06-22 21:07:07 -07:00
}
2020-10-06 20:34:16 -04:00
resource "boundary_host_catalog" "foo" {
name = "test"
description = "test catalog"
scope_id = boundary_scope . project . id
type = "static"
}
resource "boundary_host" "foo" {
2022-05-13 18:10:43 -07:00
type = "static"
2020-10-06 20:34:16 -04:00
name = "foo"
host_catalog_id = boundary_host_catalog . foo . id
address = "10.0.0.1"
}
resource "boundary_host" "bar" {
2022-05-13 18:10:43 -07:00
type = "static"
2020-10-06 20:34:16 -04:00
name = "bar"
host_catalog_id = boundary_host_catalog . foo . id
address = "10.0.0.1"
}
resource "boundary_host_set" "foo" {
2022-05-13 18:10:43 -07:00
type = "static"
2020-10-06 20:34:16 -04:00
name = "foo"
host_catalog_id = boundary_host_catalog . foo . id
host_ids = [
boundary_host . foo . id ,
boundary_host . bar . id ,
]
}
2023-06-30 13:11:15 -04:00
resource "boundary_storage_bucket" "aws_example" {
name = "My aws storage bucket"
description = "My first storage bucket!"
scope_id = boundary_scope . org . id
plugin_name = "aws"
bucket_name = "mybucket"
attributes_json = jsonencode ({ "region" = "us-east-1" })
secrets_json = jsonencode ({
"access_key_id" = "aws_access_key_id_value" ,
"secret_access_key" = "aws_secret_access_key_value"
})
worker_filter = " \ " pki \ " in \ " / tags /type \ ""
}
2020-10-06 20:34:16 -04:00
resource "boundary_target" "foo" {
name = "foo"
description = "Foo target"
2021-09-01 14:37:22 -07:00
type = "tcp"
2020-10-06 20:34:16 -04:00
default_port = "22"
scope_id = boundary_scope . project . id
2021-09-08 11:15:10 -07:00
host_source_ids = [
2020-10-06 20:34:16 -04:00
boundary_host_set . foo . id
]
2022-09-07 17:57:26 -07:00
brokered_credential_source_ids = [
2021-06-22 21:07:07 -07:00
boundary_credential_library_vault . foo . id
]
2020-10-06 20:34:16 -04:00
}
2022-09-13 08:21:24 -07:00
resource "boundary_target" "ssh_foo" {
name = "ssh_foo"
description = "Ssh target"
type = "ssh"
default_port = "22"
scope_id = boundary_scope . project . id
host_source_ids = [
boundary_host_set . foo . id
]
injected_application_credential_source_ids = [
boundary_credential_library_vault . foo . id
]
}
2023-02-10 15:13:52 +00:00
2023-06-30 13:11:15 -04:00
resource "boundary_target" "ssh_session_recording_foo" {
name = "ssh_foo"
description = "Ssh target"
type = "ssh"
default_port = "22"
scope_id = boundary_scope . project . id
host_source_ids = [
boundary_host_set . foo . id
]
injected_application_credential_source_ids = [
boundary_credential_library_vault . foo . id
]
enable_session_recording = true
storage_bucket_id = boundary_storage_bucket . aws_example
}
2023-02-10 15:13:52 +00:00
resource "boundary_target" "address_foo" {
name = "address_foo"
description = "Foo target with an address"
type = "tcp"
default_port = "22"
scope_id = boundary_scope . project . id
address = "127.0.0.1"
}
2020-10-06 20:34:16 -04:00
```
2021-01-14 14:07:36 -08:00
<!-- schema generated by tfplugindocs -->
2020-10-06 20:34:16 -04:00
## Schema
### Required
2022-05-13 18:10:43 -07:00
- `scope_id` (String) The scope ID in which the resource is created. Defaults to the provider's `default_scope` if unset.
- `type` (String) The target resource type.
2020-10-06 20:34:16 -04:00
### Optional
2023-02-10 15:13:52 +00:00
- `address` (String) Optionally, a valid network address to connect to for this target. Cannot be used alongside host_source_ids.
2022-09-07 17:57:26 -07:00
- `brokered_credential_source_ids` (Set of String) A list of brokered credential source ID's.
2023-04-28 13:13:11 -04:00
- `default_client_port` (Number) The default client port for this target.
2022-05-13 18:10:43 -07:00
- `default_port` (Number) The default port for this target.
- `description` (String) The target description.
2023-02-15 15:24:13 +00:00
- `egress_worker_filter` (String) Boolean expression to filter the workers used to access this target
2023-06-30 13:11:15 -04:00
- `enable_session_recording` (Boolean) HCP/Ent Only. Enable sessions recording for this target. Only applicable for SSH targets.
2023-02-10 15:13:52 +00:00
- `host_source_ids` (Set of String) A list of host source ID's. Cannot be used alongside address.
2023-02-15 15:24:13 +00:00
- `ingress_worker_filter` (String) HCP Only. Boolean expression to filter the workers a user will connect to when initiating a session against this target
2022-09-07 17:57:26 -07:00
- `injected_application_credential_source_ids` (Set of String) A list of injected application credential source ID's.
2022-05-13 18:10:43 -07:00
- `name` (String) The target name. Defaults to the resource name.
- `session_connection_limit` (Number)
- `session_max_seconds` (Number)
2023-06-30 13:11:15 -04:00
- `storage_bucket_id` (String) HCP/Ent Only. Storage bucket for this target. Only applicable for SSH targets.
2023-02-15 15:24:13 +00:00
- `worker_filter` (String, Deprecated) Boolean expression to filter the workers for this target
2020-10-06 20:34:16 -04:00
2021-05-05 10:02:53 -07:00
### Read-Only
2020-10-19 12:40:50 -04:00
2022-05-13 18:10:43 -07:00
- `id` (String) The ID of the target.
2020-10-19 12:40:50 -04:00
2020-10-07 12:04:11 -04:00
## Import
2020-10-06 20:34:16 -04:00
2020-10-07 12:04:11 -04:00
Import is supported using the following syntax:
```shell
terraform import boundary_target.foo <my-id>
```