Skip to content

Commit df25433

Browse files
authored
feat: expose output for connections (#562)
1 parent 519ee8f commit df25433

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

modules/compute_instance/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ See the [simple](https://github.com/terraform-google-modules/terraform-google-vm
4040
| Name | Description |
4141
|------|-------------|
4242
| available\_zones | List of available zones in region |
43+
| instance\_name | The name of the first compute instance. |
4344
| instances\_details | List of all details for compute instances |
4445
| instances\_self\_links | List of self-links for compute instances |
46+
| service\_account\_email | The service account email associated with the instances. |
4547

4648
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

modules/compute_instance/metadata.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ spec:
119119
connections:
120120
- source:
121121
source: github.com/terraform-google-modules/terraform-google-address
122-
version: ">= 4.4"
122+
version: ">=4.4"
123123
spec:
124124
outputExpr: addresses
125125
- name: access_config
@@ -189,6 +189,10 @@ spec:
189189
type:
190190
- list
191191
- string
192+
- name: instance_name
193+
description: The name of the first compute instance.
194+
type:
195+
- string
192196
- name: instances_details
193197
description: List of all details for compute instances
194198
type:
@@ -444,6 +448,10 @@ spec:
444448
type:
445449
- list
446450
- string
451+
- name: service_account_email
452+
description: The service account email associated with the instances.
453+
type:
454+
- string
447455
requirements:
448456
roles:
449457
- level: Project

modules/compute_instance/outputs.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,13 @@ output "available_zones" {
2929
description = "List of available zones in region"
3030
value = data.google_compute_zones.available.names
3131
}
32+
33+
output "service_account_email" {
34+
description = "The service account email associated with the instances."
35+
value = try(google_compute_instance_from_template.compute_instance[0].service_account[0].email, null)
36+
}
37+
38+
output "instance_name" {
39+
description = "The name of the first compute instance."
40+
value = try(google_compute_instance_from_template.compute_instance[0].name, "")
41+
}

0 commit comments

Comments
 (0)