Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add apphub_workload_uri output variable and update metadata #451

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions autogen/outputs.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ output "health_check_self_links" {
description = "All self_links of healthchecks created for the instance group."
value = local.healthchecks
}
{% if mig %}

output "apphub_workload_uri" {
value = {
workload_uri = "//compute.googleapis.com/projects${element(split("/projects", google_compute_region_instance_group_manager.mig.instance_group), 1)}"
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)
}
description = "Workload URI in CAIS style to be used by Apphub."
}
{% endif %}
14 changes: 7 additions & 7 deletions modules/instance_template/metadata.display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
description:
name: description
title: Description
invisible: false
level: 1
disk_encryption_key:
name: disk_encryption_key
title: Disk Encryption Key
Expand Down Expand Up @@ -91,7 +91,7 @@ spec:
instance_description:
name: instance_description
title: Instance Description
invisible: false
level: 1
ipv6_access_config:
name: ipv6_access_config
title: Ipv6 Access Config
Expand All @@ -101,7 +101,7 @@ spec:
machine_type:
name: machine_type
title: Machine Type
invisible: false
level: 1
maintenance_interval:
name: maintenance_interval
title: Maintenance Interval
Expand All @@ -114,9 +114,9 @@ spec:
name_prefix:
name: name_prefix
title: Name Prefix
invisible: false
regexValidation: ^[a-z][a-z0-9-]{0,51}[a-z0-9]$
validation: Use lowercase letters, numbers, and hyphens. Start with a letter and end with letter/number. Must be 53 characters or fewer.
level: 1
network:
name: network
title: Network
Expand All @@ -135,11 +135,11 @@ spec:
project_id:
name: project_id
title: Project Id
invisible: false
level: 1
region:
name: region
title: Region
invisible: false
level: 1
resource_policies:
name: resource_policies
title: Resource Policies
Expand All @@ -161,7 +161,7 @@ spec:
spot:
name: spot
title: Spot
invisible: false
level: 1
spot_instance_termination_action:
name: spot_instance_termination_action
title: Spot Instance Termination Action
Expand Down
1 change: 1 addition & 0 deletions modules/mig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The current version is 2.X. The following guides are available to assist with up

| Name | Description |
|------|-------------|
| apphub\_workload\_uri | Workload URI in CAIS style to be used by Apphub. |
| health\_check\_self\_links | All self\_links of healthchecks created for the instance group. |
| instance\_group | Instance-group url of managed instance group |
| instance\_group\_manager | An instance of google\_compute\_region\_instance\_group\_manager of the instance group. |
Expand Down
8 changes: 4 additions & 4 deletions modules/mig/metadata.display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
hostname:
name: hostname
title: Hostname
invisible: false
level: 1
instance_template:
name: instance_template
title: Instance Template
Expand All @@ -80,9 +80,9 @@ spec:
mig_name:
name: mig_name
title: Mig Name
invisible: false
regexValidation: ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
validation: Use lowercase letters, numbers, and hyphens. Start with a letter and end with letter/number. Must be 63 characters or fewer.
level: 1
mig_timeouts:
name: mig_timeouts
title: Mig Timeouts
Expand All @@ -95,7 +95,7 @@ spec:
project_id:
name: project_id
title: Project Id
invisible: false
level: 1
region:
name: region
title: Region
Expand All @@ -114,7 +114,7 @@ spec:
target_size:
name: target_size
title: Target Size
invisible: false
level: 1
update_policy:
name: update_policy
title: Update Policy
Expand Down
6 changes: 6 additions & 0 deletions modules/mig/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,12 @@ spec:
varType: map(string)
defaultValue: {}
outputs:
- name: apphub_workload_uri
description: Workload URI in CAIS style to be used by Apphub.
type:
- object
- workload_id: string
workload_uri: string
- name: health_check_self_links
description: All self_links of healthchecks created for the instance group.
type:
Expand Down
8 changes: 8 additions & 0 deletions modules/mig/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ output "health_check_self_links" {
description = "All self_links of healthchecks created for the instance group."
value = local.healthchecks
}

output "apphub_workload_uri" {
value = {
workload_uri = "//compute.googleapis.com/projects${element(split("/projects", google_compute_region_instance_group_manager.mig.instance_group), 1)}"
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)
}
description = "Workload URI in CAIS style to be used by Apphub."
}
Loading