Skip to content

Commit fa80759

Browse files
authored
feat: add apphub_workload_uri output variable and update metadata (#451)
1 parent 5047b60 commit fa80759

File tree

6 files changed

+36
-11
lines changed

6 files changed

+36
-11
lines changed

autogen/outputs.tf.tmpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@ output "health_check_self_links" {
3535
description = "All self_links of healthchecks created for the instance group."
3636
value = local.healthchecks
3737
}
38+
{% if mig %}
39+
40+
output "apphub_workload_uri" {
41+
value = {
42+
workload_uri = "//compute.googleapis.com/projects${element(split("/projects", google_compute_region_instance_group_manager.mig.instance_group), 1)}"
43+
workload_id = substr(join("-", [tostring(google_compute_region_instance_group_manager.mig.name), md5(tostring(google_compute_region_instance_group_manager.mig.self_link))]), 0, 63)
44+
}
45+
description = "Workload URI in CAIS style to be used by Apphub."
46+
}
47+
{% endif %}

modules/instance_template/metadata.display.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ spec:
6060
description:
6161
name: description
6262
title: Description
63-
invisible: false
63+
level: 1
6464
disk_encryption_key:
6565
name: disk_encryption_key
6666
title: Disk Encryption Key
@@ -91,7 +91,7 @@ spec:
9191
instance_description:
9292
name: instance_description
9393
title: Instance Description
94-
invisible: false
94+
level: 1
9595
ipv6_access_config:
9696
name: ipv6_access_config
9797
title: Ipv6 Access Config
@@ -101,7 +101,7 @@ spec:
101101
machine_type:
102102
name: machine_type
103103
title: Machine Type
104-
invisible: false
104+
level: 1
105105
maintenance_interval:
106106
name: maintenance_interval
107107
title: Maintenance Interval
@@ -114,9 +114,9 @@ spec:
114114
name_prefix:
115115
name: name_prefix
116116
title: Name Prefix
117-
invisible: false
118117
regexValidation: ^[a-z][a-z0-9-]{0,51}[a-z0-9]$
119118
validation: Use lowercase letters, numbers, and hyphens. Start with a letter and end with letter/number. Must be 53 characters or fewer.
119+
level: 1
120120
network:
121121
name: network
122122
title: Network
@@ -135,11 +135,11 @@ spec:
135135
project_id:
136136
name: project_id
137137
title: Project Id
138-
invisible: false
138+
level: 1
139139
region:
140140
name: region
141141
title: Region
142-
invisible: false
142+
level: 1
143143
resource_policies:
144144
name: resource_policies
145145
title: Resource Policies
@@ -161,7 +161,7 @@ spec:
161161
spot:
162162
name: spot
163163
title: Spot
164-
invisible: false
164+
level: 1
165165
spot_instance_termination_action:
166166
name: spot_instance_termination_action
167167
title: Spot Instance Termination Action

modules/mig/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ The current version is 2.X. The following guides are available to assist with up
5252

5353
| Name | Description |
5454
|------|-------------|
55+
| apphub\_workload\_uri | Workload URI in CAIS style to be used by Apphub. |
5556
| health\_check\_self\_links | All self\_links of healthchecks created for the instance group. |
5657
| instance\_group | Instance-group url of managed instance group |
5758
| instance\_group\_manager | An instance of google\_compute\_region\_instance\_group\_manager of the instance group. |

modules/mig/metadata.display.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ spec:
6767
hostname:
6868
name: hostname
6969
title: Hostname
70-
invisible: false
70+
level: 1
7171
instance_template:
7272
name: instance_template
7373
title: Instance Template
@@ -80,9 +80,9 @@ spec:
8080
mig_name:
8181
name: mig_name
8282
title: Mig Name
83-
invisible: false
8483
regexValidation: ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
8584
validation: Use lowercase letters, numbers, and hyphens. Start with a letter and end with letter/number. Must be 63 characters or fewer.
85+
level: 1
8686
mig_timeouts:
8787
name: mig_timeouts
8888
title: Mig Timeouts
@@ -95,7 +95,7 @@ spec:
9595
project_id:
9696
name: project_id
9797
title: Project Id
98-
invisible: false
98+
level: 1
9999
region:
100100
name: region
101101
title: Region
@@ -114,7 +114,7 @@ spec:
114114
target_size:
115115
name: target_size
116116
title: Target Size
117-
invisible: false
117+
level: 1
118118
update_policy:
119119
name: update_policy
120120
title: Update Policy

modules/mig/metadata.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,12 @@ spec:
286286
varType: map(string)
287287
defaultValue: {}
288288
outputs:
289+
- name: apphub_workload_uri
290+
description: Workload URI in CAIS style to be used by Apphub.
291+
type:
292+
- object
293+
- workload_id: string
294+
workload_uri: string
289295
- name: health_check_self_links
290296
description: All self_links of healthchecks created for the instance group.
291297
type:

modules/mig/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,11 @@ output "health_check_self_links" {
3535
description = "All self_links of healthchecks created for the instance group."
3636
value = local.healthchecks
3737
}
38+
39+
output "apphub_workload_uri" {
40+
value = {
41+
workload_uri = "//compute.googleapis.com/projects${element(split("/projects", google_compute_region_instance_group_manager.mig.instance_group), 1)}"
42+
workload_id = substr(join("-", [tostring(google_compute_region_instance_group_manager.mig.name), md5(tostring(google_compute_region_instance_group_manager.mig.self_link))]), 0, 63)
43+
}
44+
description = "Workload URI in CAIS style to be used by Apphub."
45+
}

0 commit comments

Comments
 (0)