Skip to content

Commit 53c2a57

Browse files
authored
Add target alias resource (#571)
* Add target alias resource * increment the number of authorize_acctions returned on an admin user
1 parent ed1bf21 commit 53c2a57

File tree

11 files changed

+877
-356
lines changed

11 files changed

+877
-356
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Canonical reference for changes, improvements, and bugfixes for the Boundary Ter
66

77
### New and Improved
88

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

1112
## 1.1.14 (February 14, 2024)
1213

docs/resources/alias_target.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "boundary_alias_target Resource - terraform-provider-boundary"
4+
subcategory: ""
5+
description: |-
6+
The target alias resource allows you to configure a Boundary target alias.
7+
---
8+
9+
# boundary_alias_target (Resource)
10+
11+
The target alias resource allows you to configure a Boundary target alias.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "boundary_scope" "org" {
17+
name = "organization_one"
18+
description = "global scope"
19+
scope_id = "global"
20+
auto_create_admin_role = true
21+
auto_create_default_role = true
22+
}
23+
24+
resource "boundary_scope" "project" {
25+
name = "project_one"
26+
description = "My first scope!"
27+
scope_id = boundary_scope.org.id
28+
auto_create_admin_role = true
29+
}
30+
31+
resource "boundary_host_catalog_static" "foo" {
32+
name = "test"
33+
description = "test catalog"
34+
scope_id = boundary_scope.project.id
35+
}
36+
37+
resource "boundary_host_static" "foo" {
38+
name = "foo"
39+
host_catalog_id = boundary_host_catalog_static.foo.id
40+
address = "10.0.0.1"
41+
}
42+
43+
resource "boundary_host_static" "bar" {
44+
name = "bar"
45+
host_catalog_id = boundary_host_catalog_static.foo.id
46+
address = "127.0.0.1"
47+
}
48+
49+
resource "boundary_host_set_static" "foo" {
50+
name = "foo"
51+
host_catalog_id = boundary_host_catalog_static.foo.id
52+
53+
host_ids = [
54+
boundary_host_static.foo.id,
55+
boundary_host_static.bar.id,
56+
]
57+
}
58+
59+
resource "boundary_target" "foo" {
60+
name = "foo"
61+
description = "Foo target"
62+
type = "tcp"
63+
default_port = "22"
64+
scope_id = boundary_scope.project.id
65+
host_source_ids = [
66+
boundary_host_set_static.foo.id,
67+
]
68+
}
69+
70+
resource "boundary_alias_target" "example_alias_target" {
71+
name = "example_alias_target"
72+
description = "Example alias to target foo using host boundary_host_static.bar"
73+
scope_id = "global"
74+
value = "example.bar.foo.boundary"
75+
destination_id = boundary_target.foo.id
76+
authorize_session_host_id = boundary_host_static.bar.id
77+
}
78+
```
79+
80+
<!-- schema generated by tfplugindocs -->
81+
## Schema
82+
83+
### Required
84+
85+
- `scope_id` (String) The scope ID.
86+
- `value` (String) The value of the alias.
87+
88+
### Optional
89+
90+
- `authorize_session_host_id` (String) The host id to pass to Boundary when performing an authorize session action.
91+
- `description` (String) The alias description.
92+
- `destination_id` (String) The destination of the alias.
93+
- `name` (String) The alias name. Defaults to the resource name.
94+
- `type` (String) The type of alias; hardcoded.
95+
96+
### Read-Only
97+
98+
- `id` (String) The ID of the account.
99+
100+
## Import
101+
102+
Import is supported using the following syntax:
103+
104+
```shell
105+
terraform import boundary_alias_target.example_alias_target <my-id>
106+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import boundary_alias_target.example_alias_target <my-id>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
resource "boundary_scope" "org" {
2+
name = "organization_one"
3+
description = "global scope"
4+
scope_id = "global"
5+
auto_create_admin_role = true
6+
auto_create_default_role = true
7+
}
8+
9+
resource "boundary_scope" "project" {
10+
name = "project_one"
11+
description = "My first scope!"
12+
scope_id = boundary_scope.org.id
13+
auto_create_admin_role = true
14+
}
15+
16+
resource "boundary_host_catalog_static" "foo" {
17+
name = "test"
18+
description = "test catalog"
19+
scope_id = boundary_scope.project.id
20+
}
21+
22+
resource "boundary_host_static" "foo" {
23+
name = "foo"
24+
host_catalog_id = boundary_host_catalog_static.foo.id
25+
address = "10.0.0.1"
26+
}
27+
28+
resource "boundary_host_static" "bar" {
29+
name = "bar"
30+
host_catalog_id = boundary_host_catalog_static.foo.id
31+
address = "127.0.0.1"
32+
}
33+
34+
resource "boundary_host_set_static" "foo" {
35+
name = "foo"
36+
host_catalog_id = boundary_host_catalog_static.foo.id
37+
38+
host_ids = [
39+
boundary_host_static.foo.id,
40+
boundary_host_static.bar.id,
41+
]
42+
}
43+
44+
resource "boundary_target" "foo" {
45+
name = "foo"
46+
description = "Foo target"
47+
type = "tcp"
48+
default_port = "22"
49+
scope_id = boundary_scope.project.id
50+
host_source_ids = [
51+
boundary_host_set_static.foo.id,
52+
]
53+
}
54+
55+
resource "boundary_alias_target" "example_alias_target" {
56+
name = "example_alias_target"
57+
description = "Example alias to target foo using host boundary_host_static.bar"
58+
scope_id = "global"
59+
value = "example.bar.foo.boundary"
60+
destination_id = boundary_target.foo.id
61+
authorize_session_host_id = boundary_host_static.bar.id
62+
}

0 commit comments

Comments
 (0)