Skip to content

Commit

Permalink
Add target alias resource (#571)
Browse files Browse the repository at this point in the history
* Add target alias resource

* increment the number of authorize_acctions returned on an admin user
  • Loading branch information
talanknight authored May 1, 2024
1 parent ed1bf21 commit 53c2a57
Show file tree
Hide file tree
Showing 11 changed files with 877 additions and 356 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Canonical reference for changes, improvements, and bugfixes for the Boundary Ter

### New and Improved

* new things here
* Add support for a target alias as a resource
([PR](https://github.com/hashicorp/terraform-provider-boundary/pull/571))

## 1.1.14 (February 14, 2024)

Expand Down
106 changes: 106 additions & 0 deletions docs/resources/alias_target.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "boundary_alias_target Resource - terraform-provider-boundary"
subcategory: ""
description: |-
The target alias resource allows you to configure a Boundary target alias.
---

# boundary_alias_target (Resource)

The target alias resource allows you to configure a Boundary target alias.

## Example Usage

```terraform
resource "boundary_scope" "org" {
name = "organization_one"
description = "global scope"
scope_id = "global"
auto_create_admin_role = true
auto_create_default_role = true
}
resource "boundary_scope" "project" {
name = "project_one"
description = "My first scope!"
scope_id = boundary_scope.org.id
auto_create_admin_role = true
}
resource "boundary_host_catalog_static" "foo" {
name = "test"
description = "test catalog"
scope_id = boundary_scope.project.id
}
resource "boundary_host_static" "foo" {
name = "foo"
host_catalog_id = boundary_host_catalog_static.foo.id
address = "10.0.0.1"
}
resource "boundary_host_static" "bar" {
name = "bar"
host_catalog_id = boundary_host_catalog_static.foo.id
address = "127.0.0.1"
}
resource "boundary_host_set_static" "foo" {
name = "foo"
host_catalog_id = boundary_host_catalog_static.foo.id
host_ids = [
boundary_host_static.foo.id,
boundary_host_static.bar.id,
]
}
resource "boundary_target" "foo" {
name = "foo"
description = "Foo target"
type = "tcp"
default_port = "22"
scope_id = boundary_scope.project.id
host_source_ids = [
boundary_host_set_static.foo.id,
]
}
resource "boundary_alias_target" "example_alias_target" {
name = "example_alias_target"
description = "Example alias to target foo using host boundary_host_static.bar"
scope_id = "global"
value = "example.bar.foo.boundary"
destination_id = boundary_target.foo.id
authorize_session_host_id = boundary_host_static.bar.id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `scope_id` (String) The scope ID.
- `value` (String) The value of the alias.

### Optional

- `authorize_session_host_id` (String) The host id to pass to Boundary when performing an authorize session action.
- `description` (String) The alias description.
- `destination_id` (String) The destination of the alias.
- `name` (String) The alias name. Defaults to the resource name.
- `type` (String) The type of alias; hardcoded.

### Read-Only

- `id` (String) The ID of the account.

## Import

Import is supported using the following syntax:

```shell
terraform import boundary_alias_target.example_alias_target <my-id>
```
1 change: 1 addition & 0 deletions examples/resources/boundary_alias_target/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import boundary_alias_target.example_alias_target <my-id>
62 changes: 62 additions & 0 deletions examples/resources/boundary_alias_target/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
resource "boundary_scope" "org" {
name = "organization_one"
description = "global scope"
scope_id = "global"
auto_create_admin_role = true
auto_create_default_role = true
}

resource "boundary_scope" "project" {
name = "project_one"
description = "My first scope!"
scope_id = boundary_scope.org.id
auto_create_admin_role = true
}

resource "boundary_host_catalog_static" "foo" {
name = "test"
description = "test catalog"
scope_id = boundary_scope.project.id
}

resource "boundary_host_static" "foo" {
name = "foo"
host_catalog_id = boundary_host_catalog_static.foo.id
address = "10.0.0.1"
}

resource "boundary_host_static" "bar" {
name = "bar"
host_catalog_id = boundary_host_catalog_static.foo.id
address = "127.0.0.1"
}

resource "boundary_host_set_static" "foo" {
name = "foo"
host_catalog_id = boundary_host_catalog_static.foo.id

host_ids = [
boundary_host_static.foo.id,
boundary_host_static.bar.id,
]
}

resource "boundary_target" "foo" {
name = "foo"
description = "Foo target"
type = "tcp"
default_port = "22"
scope_id = boundary_scope.project.id
host_source_ids = [
boundary_host_set_static.foo.id,
]
}

resource "boundary_alias_target" "example_alias_target" {
name = "example_alias_target"
description = "Example alias to target foo using host boundary_host_static.bar"
scope_id = "global"
value = "example.bar.foo.boundary"
destination_id = boundary_target.foo.id
authorize_session_host_id = boundary_host_static.bar.id
}
Loading

0 comments on commit 53c2a57

Please sign in to comment.