diff --git a/website/content/docs/common-workflows/manage-targets.mdx b/website/content/docs/common-workflows/manage-targets.mdx index b7b608058..d09583164 100644 --- a/website/content/docs/common-workflows/manage-targets.mdx +++ b/website/content/docs/common-workflows/manage-targets.mdx @@ -6,3 +6,183 @@ description: How to manage Boundary targets --- # Manage Targets + +[Targets](/docs/concepts/domain-model/targets) are Boundary resources which contain a [host-set](/docs/concepts/domain-model/host-sets). A target allows Boundary users to define an endpoint with a default-port and a protocol to establish a session. Unless specified with a `-host-id` flag, Boundary will choose one [host](/docs/concepts/domain-model/hosts) in the host-set to connect to at random. + +In this section, we'll show you the basics of how to define a host, host-set, and a target in Boundary on the CLI, the admin console, and using our [Terraform provider](https://github.com/hashicorp/terraform-provider-boundary). + +We assume you're running Boundary in dev mode and have a default static host-catalog of `hcst_1234567890`. We also assume you've logged in on the command line and the admin console. See the output of `boundary dev` for these login values. + +## Define a Host + +For this example, we're going to create a target to access postgres on `localhost`. This assumes a couple of things: + +1. The host address is `127.0.0.1` +2. The target port is `:5432` + +#### CLI + +```bash +boundary hosts create static -name postgres -description "Postgres host" -address "127.0.0.1" -host-catalog-id "hcst_1234567890" + +Host information: + Created Time: Mon, 28 Sep 2020 18:12:39 PDT + Description: Postgres host + Host Catalog ID: hcst_1234567890 + ID: hst_N5l67hLYrQ + Name: postgres + Type: static + Updated Time: Mon, 28 Sep 2020 18:12:39 PDT + Version: 1 + + Scope: + ID: p_1234567890 + Name: Generated project scope + Parent Scope ID: o_1234567890 + Type: project + + Attributes: + address: 127.0.0.1 +``` + +#### UI + +Navigate to the default host catalog: +![](/img/manage-targets-host-undefined.png) + +Select new host from the `manage` dropdown: +![](/img/manage-targets-new-host.png) + +Fill in the required information about our postgres host: +![](/img/manage-targets-new-host-2.png) + +View the host in the catalog: +![](/img/manage-targets-new-host-defined.png) + +#### Terraform + +To define this same host using our Terraform provider: + +```hcl +resource "boundary_host" "postgres" { + type = "static" + name = "postgres" + description = "Postgres host" + address = "127.0.0.1" + host_catalog_id = "hcst_1234567890" +} +``` + +## Define a Host-Set + +Host-sets allow us to group hosts of similar interests together. A target works off of host-sets, so even though we are only defining one host in this example, we're going to create a host-set of one host. + +#### CLI + +```bash +boundary host-sets create static -name "postgres" -description "Postgres host set" -host-catalog-id hcst_1234567890 + +Host Set information: + Created Time: Mon, 28 Sep 2020 18:27:10 PDT + Description: Postgres host set + Host Catalog ID: hcst_1234567890 + ID: hsst_z7gDCPSig5 + Name: postgres + Type: static + Updated Time: Mon, 28 Sep 2020 18:27:10 PDT + Version: 1 + + Scope: + ID: p_1234567890 + Name: Generated project scope + Parent Scope ID: o_1234567890 + Type: project +``` + +#### UI + +Navigate to the host catalog and the `host sets` tab, select `Create Host Set` from `manage` dropdown: +![](/img/manage-targets-new-host-set-undefined.png) + +Fill in the host-set definition: +![](/img/manage-targets-new-host-set-settings.png) + +See the new host set in the host-catalog view: +![](/img/manage-targets-new-host-set-defined.png) + +#### Terraform + +To define this host-set in Terraform: + +```hcl +resource "boundary_host_set" "postgres" { + type = "static" + name = "postgres" + description = "Host set for postgres" + host_catalog_id = host_catalog_id = "hcst_1234567890" + + // taken from the Terraform example above + host_ids = [ boundary_host.postgres.id ] +} +``` + +## Define Target + +#### CLI + +```bash +boundary targets create tcp -name 'postgres' -description 'Postgres target' -default-port 5432 -scope-id p_1234567890 -session-connection-limit '-1' + +Target information: + Created Time: Mon, 28 Sep 2020 18:43:12 PDT + Description: Postgres target + ID: ttcp_CzVQA3adBf + Name: postgres + Session Connection Limit: -1 + Session Max Seconds: 28800 + Type: tcp + Updated Time: Mon, 28 Sep 2020 18:43:12 PDT + Version: 1 + + Scope: + ID: p_1234567890 + Name: Generated project scope + Parent Scope ID: o_1234567890 + Type: project + Attributes: + Default Port: 5432 +``` + +#### UI + +Navigate to your the default project: +![](/img/manage-targets-new-target-project.png) + +Then the targets view and choose `new` target: +![](/img/manage-targets-new-target-undefined.png) + +Fill in the Target info: +![](/img/manage-targets-new-target-settings.png) + +See the Target in the targets view: +![](/img/manage-targets-new-target-defined.png) + +#### Terraform + +To define this target in Terraform: + +```hcl +resource "boundary_target" "postgres" { + type = "tcp" + name = "postgres" + description = "Postgres target" + scope_id = "p_1234567890" + session_connection_limit = -1 + default_port = 5432 + + // taken from the example above + host_set_ids = [ + boundary_host_set.postgres.id + ] +} +``` diff --git a/website/public/img/manage-targets-host-undefined.png b/website/public/img/manage-targets-host-undefined.png new file mode 100644 index 000000000..f472f98ee Binary files /dev/null and b/website/public/img/manage-targets-host-undefined.png differ diff --git a/website/public/img/manage-targets-new-host-2.png b/website/public/img/manage-targets-new-host-2.png new file mode 100644 index 000000000..94dd2452c Binary files /dev/null and b/website/public/img/manage-targets-new-host-2.png differ diff --git a/website/public/img/manage-targets-new-host-defined.png b/website/public/img/manage-targets-new-host-defined.png new file mode 100644 index 000000000..682aaa4eb Binary files /dev/null and b/website/public/img/manage-targets-new-host-defined.png differ diff --git a/website/public/img/manage-targets-new-host-set-defined.png b/website/public/img/manage-targets-new-host-set-defined.png new file mode 100644 index 000000000..dd0f0a55e Binary files /dev/null and b/website/public/img/manage-targets-new-host-set-defined.png differ diff --git a/website/public/img/manage-targets-new-host-set-settings.png b/website/public/img/manage-targets-new-host-set-settings.png new file mode 100644 index 000000000..2cc390e7e Binary files /dev/null and b/website/public/img/manage-targets-new-host-set-settings.png differ diff --git a/website/public/img/manage-targets-new-host-set-undefined.png b/website/public/img/manage-targets-new-host-set-undefined.png new file mode 100644 index 000000000..c3829ee79 Binary files /dev/null and b/website/public/img/manage-targets-new-host-set-undefined.png differ diff --git a/website/public/img/manage-targets-new-host.png b/website/public/img/manage-targets-new-host.png new file mode 100644 index 000000000..f87bc7516 Binary files /dev/null and b/website/public/img/manage-targets-new-host.png differ diff --git a/website/public/img/manage-targets-new-target-defined.png b/website/public/img/manage-targets-new-target-defined.png new file mode 100644 index 000000000..79293fca5 Binary files /dev/null and b/website/public/img/manage-targets-new-target-defined.png differ diff --git a/website/public/img/manage-targets-new-target-project.png b/website/public/img/manage-targets-new-target-project.png new file mode 100644 index 000000000..2179c21d8 Binary files /dev/null and b/website/public/img/manage-targets-new-target-project.png differ diff --git a/website/public/img/manage-targets-new-target-settings.png b/website/public/img/manage-targets-new-target-settings.png new file mode 100644 index 000000000..677fd9e89 Binary files /dev/null and b/website/public/img/manage-targets-new-target-settings.png differ diff --git a/website/public/img/manage-targets-new-target-undefined.png b/website/public/img/manage-targets-new-target-undefined.png new file mode 100644 index 000000000..c3bf1ed93 Binary files /dev/null and b/website/public/img/manage-targets-new-target-undefined.png differ