@@ -14,6 +14,8 @@ Retrieves information about a specific target in Warpgate. This data source allo
1414``` hcl
1515data "warpgate_target" "web_server" {
1616 id = "12345678-1234-1234-1234-123456789012"
17+ // optionally
18+ // name = "webserver"
1719}
1820
1921output "target_name" {
@@ -42,20 +44,20 @@ locals {
4244 is_http = length(data.warpgate_target.server.http_options) > 0
4345 is_mysql = length(data.warpgate_target.server.mysql_options) > 0
4446 is_postgres = length(data.warpgate_target.server.postgres_options) > 0
45-
47+
4648 # Safely access target details
4749 host = local.is_ssh ? data.warpgate_target.server.ssh_options[0].host :
4850 local.is_http ? "<HTTP target>" :
4951 local.is_mysql ? data.warpgate_target.server.mysql_options[0].host :
50- local.is_postgres ? data.warpgate_target.server.postgres_options[0].host :
52+ local.is_postgres ? data.warpgate_target.server.postgres_options[0].host :
5153 "unknown"
5254}
5355
5456output "target_type" {
55- value = local.is_ssh ? "SSH" :
56- local.is_http ? "HTTP" :
57- local.is_mysql ? "MySQL" :
58- local.is_postgres ? "PostgreSQL" :
57+ value = local.is_ssh ? "SSH" :
58+ local.is_http ? "HTTP" :
59+ local.is_mysql ? "MySQL" :
60+ local.is_postgres ? "PostgreSQL" :
5961 "unknown"
6062}
6163
@@ -68,54 +70,58 @@ output "target_host" {
6870
6971The following arguments are supported:
7072
71- * ` id ` - (Required) The ID of the target to look up.
73+ - ` id ` - The ID of the target to look up.
74+ - ` name ` - The name of the target to look up.
75+
76+ Either ` id ` or ` name ` should be specified.
7277
7378## Attribute Reference
7479
7580In addition to the arguments listed above, the following attributes are exported:
7681
77- * ` name ` - The name of the target.
78- * ` description ` - The description of the target.
79- * ` allow_roles ` - The list of roles allowed to access this target.
82+ - ` name ` - The name of the target.
83+ - ` description ` - The description of the target.
84+ - ` allow_roles ` - The list of roles allowed to access this target.
8085
8186Based on the target type, one of the following option blocks will be populated:
8287
83- * ` ssh_options ` - Configuration for SSH targets.
84- * ` host ` - The SSH server hostname or IP address.
85- * ` port ` - The SSH server port.
86- * ` username ` - The SSH username.
87- * ` allow_insecure_algos ` - Whether insecure SSH algorithms are allowed.
88- * ` password_auth ` - Password authentication configuration (if applicable).
89- * ` password ` - The password for SSH authentication.
90- * ` public_key_auth ` - Public key authentication configuration (if applicable).
91-
92- * ` http_options ` - Configuration for HTTP targets.
93- * ` url ` - The HTTP server URL.
94- * ` tls ` - TLS configuration.
95- * ` mode ` - TLS mode (Disabled, Preferred, Required).
96- * ` verify ` - Whether TLS certificates are verified.
97- * ` headers ` - HTTP headers included in requests.
98- * ` external_host ` - External host for HTTP requests.
99-
100- * ` mysql_options ` - Configuration for MySQL targets.
101- * ` host ` - The MySQL server hostname or IP address.
102- * ` port ` - The MySQL server port.
103- * ` username ` - The MySQL username.
104- * ` password ` - The MySQL password.
105- * ` tls ` - TLS configuration.
106- * ` mode ` - TLS mode (Disabled, Preferred, Required).
107- * ` verify ` - Whether TLS certificates are verified.
108-
109- * ` postgres_options ` - Configuration for PostgreSQL targets.
110- * ` host ` - The PostgreSQL server hostname or IP address.
111- * ` port ` - The PostgreSQL server port.
112- * ` username ` - The PostgreSQL username.
113- * ` password ` - The PostgreSQL password.
114- * ` tls ` - TLS configuration.
115- * ` mode ` - TLS mode (Disabled, Preferred, Required).
116- * ` verify ` - Whether TLS certificates are verified.
88+ - ` ssh_options ` - Configuration for SSH targets.
89+ - ` host ` - The SSH server hostname or IP address.
90+ - ` port ` - The SSH server port.
91+ - ` username ` - The SSH username.
92+ - ` allow_insecure_algos ` - Whether insecure SSH algorithms are allowed.
93+ - ` password_auth ` - Password authentication configuration (if applicable).
94+ - ` password ` - The password for SSH authentication.
95+ - ` public_key_auth ` - Public key authentication configuration (if applicable).
96+
97+ - ` http_options ` - Configuration for HTTP targets.
98+ - ` url ` - The HTTP server URL.
99+ - ` tls ` - TLS configuration.
100+ - ` mode ` - TLS mode (Disabled, Preferred, Required).
101+ - ` verify ` - Whether TLS certificates are verified.
102+ - ` headers ` - HTTP headers included in requests.
103+ - ` external_host ` - External host for HTTP requests.
104+
105+ - ` mysql_options ` - Configuration for MySQL targets.
106+ - ` host ` - The MySQL server hostname or IP address.
107+ - ` port ` - The MySQL server port.
108+ - ` username ` - The MySQL username.
109+ - ` password ` - The MySQL password.
110+ - ` tls ` - TLS configuration.
111+ - ` mode ` - TLS mode (Disabled, Preferred, Required).
112+ - ` verify ` - Whether TLS certificates are verified.
113+
114+ - ` postgres_options ` - Configuration for PostgreSQL targets.
115+ - ` host ` - The PostgreSQL server hostname or IP address.
116+ - ` port ` - The PostgreSQL server port.
117+ - ` username ` - The PostgreSQL username.
118+ - ` password ` - The PostgreSQL password.
119+ - ` tls ` - TLS configuration.
120+ - ` mode ` - TLS mode (Disabled, Preferred, Required).
121+ - ` verify ` - Whether TLS certificates are verified.
117122
118123<!-- schema generated by tfplugindocs -->
124+
119125## Schema
120126
121127### Required
@@ -133,6 +139,7 @@ Based on the target type, one of the following option blocks will be populated:
133139- ` ssh_options ` (List of Object) SSH target options (see [ below for nested schema] ( #nestedatt--ssh_options ) )
134140
135141<a id =" nestedatt--http_options " ></a >
142+
136143### Nested Schema for ` http_options `
137144
138145Read-Only:
@@ -143,16 +150,16 @@ Read-Only:
143150- ` url ` (String)
144151
145152<a id =" nestedobjatt--http_options--tls " ></a >
153+
146154### Nested Schema for ` http_options.tls `
147155
148156Read-Only:
149157
150158- ` mode ` (String)
151159- ` verify ` (Boolean)
152160
153-
154-
155161<a id =" nestedatt--mysql_options " ></a >
162+
156163### Nested Schema for ` mysql_options `
157164
158165Read-Only:
@@ -164,16 +171,16 @@ Read-Only:
164171- ` username ` (String)
165172
166173<a id =" nestedobjatt--mysql_options--tls " ></a >
174+
167175### Nested Schema for ` mysql_options.tls `
168176
169177Read-Only:
170178
171179- ` mode ` (String)
172180- ` verify ` (Boolean)
173181
174-
175-
176182<a id =" nestedatt--postgres_options " ></a >
183+
177184### Nested Schema for ` postgres_options `
178185
179186Read-Only:
@@ -185,16 +192,16 @@ Read-Only:
185192- ` username ` (String)
186193
187194<a id =" nestedobjatt--postgres_options--tls " ></a >
195+
188196### Nested Schema for ` postgres_options.tls `
189197
190198Read-Only:
191199
192200- ` mode ` (String)
193201- ` verify ` (Boolean)
194202
195-
196-
197203<a id =" nestedatt--ssh_options " ></a >
204+
198205### Nested Schema for ` ssh_options `
199206
200207Read-Only:
@@ -207,14 +214,15 @@ Read-Only:
207214- ` username ` (String)
208215
209216<a id =" nestedobjatt--ssh_options--password_auth " ></a >
217+
210218### Nested Schema for ` ssh_options.password_auth `
211219
212220Read-Only:
213221
214222- ` password ` (String)
215223
216-
217224<a id =" nestedobjatt--ssh_options--public_key_auth " ></a >
225+
218226### Nested Schema for ` ssh_options.public_key_auth `
219227
220228Read-Only:
0 commit comments