Terraform patterns for Boundary hosts and host management
Before you can access a system, you must create a target. Targets require an address or host, and credentials to connect to that host.
You can define target addresses directly to simplify access, but HashiCorp does not recommend that pattern at scale. Instead, HashiCorp recommends adding hosts to a host set, and then attaching the host set to a target.
Requirements
This document assumes the reader has:
- An understanding of Terraform fundamentals
- An existing Boundary installation. Refer to Initialize Boundary to learn about deploying Boundary.
- Configured the Terraform Boundary provider.
Static host catalog configuration
The following example shows how to create a Boundary static host catalog and add a known host to that catalog.
Static host catalogs increase your administrative burden and should only be used when necessary.
Dynamic host catalog configuration
When you use cloud providers like Amazon Web Services (AWS) and Microsoft Azure, a better pattern is to use a plugin-based host catalog that automatically discovers hosts based on the filtering criteria for a given cloud.
This example creates a dynamic host catalog that auto-discovers AWS hosts in us-east-1
.
Azure host catalog configuration
This host catalog example discovers hosts in Azure. Notice that it is very similar to the AWS example.
Add static hosts to hosts sets configuration
This example adds static hosts to static host sets.
Add plugin-based hosts to host sets configuration
Hosts discovered using a plugin-based host catalog should be added to a boundary_host_set_plugin
host set.
This example demonstrates how to add hosts from the AWS host catalog to a host set using tags as a filtering criteria. In this example, the filter looks for tags named service-type
that have a value of web
.
More information
For more information about the Boundary resources mentioned in this topic, refer to the domain model documentation:
For more information about managing the following resources using Terraform, refer to the Boundary provider documentation:
Next steps
Once you have configured hosts, you may want to configure credentials and credential stores for your hosts and users.