Skip to content

Commit 8cc5f65

Browse files
authored
chore: Add connection metadata, metadata.display.yaml (#439)
1 parent 866c1a0 commit 8cc5f65

File tree

6 files changed

+345
-3
lines changed

6 files changed

+345
-3
lines changed

modules/instance_template/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ See the [simple](../../examples/instance_template/simple) for a usage example.
4747
| project\_id | The GCP project ID | `string` | `null` | no |
4848
| region | Region where the instance template should be created. | `string` | `null` | no |
4949
| resource\_policies | A list of self\_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported. | `list(string)` | `[]` | no |
50-
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account. | <pre>object({<br> email = string<br> scopes = set(string)<br> })</pre> | n/a | yes |
50+
| service\_account | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account. | <pre>object({<br> email = string<br> scopes = optional(set(string), ["cloud-platform"])<br> })</pre> | n/a | yes |
5151
| shielded\_instance\_config | Not used unless enable\_shielded\_vm is true. Shielded VM configuration for the instance. | <pre>object({<br> enable_secure_boot = bool<br> enable_vtpm = bool<br> enable_integrity_monitoring = bool<br> })</pre> | <pre>{<br> "enable_integrity_monitoring": true,<br> "enable_secure_boot": true,<br> "enable_vtpm": true<br>}</pre> | no |
5252
| source\_image | Source disk image. If neither source\_image nor source\_image\_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. | `string` | `""` | no |
5353
| source\_image\_family | Source image family. If neither source\_image nor source\_image\_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. | `string` | `"rocky-linux-9-optimized-gcp"` | no |
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: blueprints.cloud.google.com/v1alpha1
16+
kind: BlueprintMetadata
17+
metadata:
18+
name: terraform-google-vm-instance-template-display
19+
annotations:
20+
config.kubernetes.io/local-config: "true"
21+
spec:
22+
info:
23+
title: instance_template
24+
source:
25+
repo: https://github.com/terraform-google-modules/terraform-google-vm
26+
sourceType: git
27+
dir: /modules/instance_template
28+
ui:
29+
input:
30+
variables:
31+
access_config:
32+
name: access_config
33+
title: Access Config
34+
altDefaults:
35+
- type: ALTERNATE_TYPE_DC
36+
value:
37+
nat_ip: null
38+
network_tier: PREMIUM
39+
additional_disks:
40+
name: additional_disks
41+
title: Additional Disks
42+
additional_networks:
43+
name: additional_networks
44+
title: Additional Networks
45+
alias_ip_range:
46+
name: alias_ip_range
47+
title: Alias Ip Range
48+
auto_delete:
49+
name: auto_delete
50+
title: Auto Delete
51+
automatic_restart:
52+
name: automatic_restart
53+
title: Automatic Restart
54+
can_ip_forward:
55+
name: can_ip_forward
56+
title: Can Ip Forward
57+
confidential_instance_type:
58+
name: confidential_instance_type
59+
title: Confidential Instance Type
60+
description:
61+
name: description
62+
title: Description
63+
disk_encryption_key:
64+
name: disk_encryption_key
65+
title: Disk Encryption Key
66+
disk_labels:
67+
name: disk_labels
68+
title: Disk Labels
69+
disk_resource_policies:
70+
name: disk_resource_policies
71+
title: Disk Resource Policies
72+
disk_size_gb:
73+
name: disk_size_gb
74+
title: Disk Size Gb
75+
disk_type:
76+
name: disk_type
77+
title: Disk Type
78+
enable_confidential_vm:
79+
name: enable_confidential_vm
80+
title: Enable Confidential Vm
81+
enable_nested_virtualization:
82+
name: enable_nested_virtualization
83+
title: Enable Nested Virtualization
84+
enable_shielded_vm:
85+
name: enable_shielded_vm
86+
title: Enable Shielded Vm
87+
gpu:
88+
name: gpu
89+
title: Gpu
90+
instance_description:
91+
name: instance_description
92+
title: Instance Description
93+
ipv6_access_config:
94+
name: ipv6_access_config
95+
title: Ipv6 Access Config
96+
labels:
97+
name: labels
98+
title: Labels
99+
machine_type:
100+
name: machine_type
101+
title: Machine Type
102+
maintenance_interval:
103+
name: maintenance_interval
104+
title: Maintenance Interval
105+
metadata:
106+
name: metadata
107+
title: Metadata
108+
min_cpu_platform:
109+
name: min_cpu_platform
110+
title: Min Cpu Platform
111+
name_prefix:
112+
name: name_prefix
113+
title: Name Prefix
114+
network:
115+
name: network
116+
title: Network
117+
network_ip:
118+
name: network_ip
119+
title: Network Ip
120+
nic_type:
121+
name: nic_type
122+
title: Nic Type
123+
on_host_maintenance:
124+
name: on_host_maintenance
125+
title: On Host Maintenance
126+
preemptible:
127+
name: preemptible
128+
title: Preemptible
129+
project_id:
130+
name: project_id
131+
title: Project Id
132+
region:
133+
name: region
134+
title: Region
135+
resource_policies:
136+
name: resource_policies
137+
title: Resource Policies
138+
service_account:
139+
name: service_account
140+
title: Service Account
141+
shielded_instance_config:
142+
name: shielded_instance_config
143+
title: Shielded Instance Config
144+
source_image:
145+
name: source_image
146+
title: Source Image
147+
source_image_family:
148+
name: source_image_family
149+
title: Source Image Family
150+
source_image_project:
151+
name: source_image_project
152+
title: Source Image Project
153+
spot:
154+
name: spot
155+
title: Spot
156+
spot_instance_termination_action:
157+
name: spot_instance_termination_action
158+
title: Spot Instance Termination Action
159+
stack_type:
160+
name: stack_type
161+
title: Stack Type
162+
startup_script:
163+
name: startup_script
164+
title: Startup Script
165+
subnetwork:
166+
name: subnetwork
167+
title: Subnetwork
168+
subnetwork_project:
169+
name: subnetwork_project
170+
title: Subnetwork Project
171+
tags:
172+
name: tags
173+
title: Tags
174+
threads_per_core:
175+
name: threads_per_core
176+
title: Threads Per Core
177+
total_egress_bandwidth_tier:
178+
name: total_egress_bandwidth_tier
179+
title: Total Egress Bandwidth Tier
180+

modules/instance_template/metadata.yaml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,27 @@ spec:
223223
description: Metadata, provided as a map
224224
varType: map(string)
225225
defaultValue: {}
226+
connections:
227+
- source:
228+
source: github.com/terraform-google-modules/terraform-google-memorystore
229+
version: ~> 10.0
230+
spec:
231+
outputExpr: env_vars
232+
- source:
233+
source: github.com/terraform-google-modules/terraform-google-sql-db//modules/postgresql
234+
version: ~> 21.0
235+
spec:
236+
outputExpr: env_vars
237+
- source:
238+
source: github.com/terraform-google-modules/terraform-google-sql-db//modules/mysql
239+
version: ~> 22.0
240+
spec:
241+
outputExpr: env_vars
242+
- source:
243+
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
244+
version: ~> 4.3
245+
spec:
246+
outputExpr: env_vars
226247
- name: min_cpu_platform
227248
description: "Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as Intel Haswell or Intel Skylake. See the complete list: https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform"
228249
varType: string
@@ -264,9 +285,16 @@ spec:
264285
varType: |-
265286
object({
266287
email = string
267-
scopes = set(string)
288+
scopes = optional(set(string), ["cloud-platform"])
268289
})
269290
required: true
291+
connections:
292+
- source:
293+
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
294+
version: ~> 4.3
295+
spec:
296+
outputExpr: email
297+
inputPath: email
270298
- name: shielded_instance_config
271299
description: Not used unless enable_shielded_vm is true. Shielded VM configuration for the instance.
272300
varType: |-
@@ -328,12 +356,18 @@ spec:
328356
outputs:
329357
- name: name
330358
description: Name of instance template
359+
type: string
331360
- name: self_link
332361
description: Self-link of instance template
362+
type: string
333363
- name: self_link_unique
334364
description: Unique self-link of instance template (recommended output to use instead of self_link)
365+
type: string
335366
- name: tags
336367
description: Tags that will be associated with instance(s)
368+
type:
369+
- list
370+
- string
337371
requirements:
338372
roles:
339373
- level: Project

modules/instance_template/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ variable "metadata" {
327327
variable "service_account" {
328328
type = object({
329329
email = string
330-
scopes = set(string)
330+
scopes = optional(set(string), ["cloud-platform"])
331331
})
332332
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account."
333333
}

modules/mig/metadata.display.yaml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: blueprints.cloud.google.com/v1alpha1
16+
kind: BlueprintMetadata
17+
metadata:
18+
name: terraform-google-vm-mig-display
19+
annotations:
20+
config.kubernetes.io/local-config: "true"
21+
spec:
22+
info:
23+
title: Managed Instance Group (MIG)
24+
source:
25+
repo: https://github.com/terraform-google-modules/terraform-google-vm
26+
sourceType: git
27+
dir: /modules/mig
28+
ui:
29+
input:
30+
variables:
31+
autoscaler_name:
32+
name: autoscaler_name
33+
title: Autoscaler Name
34+
autoscaling_cpu:
35+
name: autoscaling_cpu
36+
title: Autoscaling Cpu
37+
autoscaling_enabled:
38+
name: autoscaling_enabled
39+
title: Autoscaling Enabled
40+
autoscaling_lb:
41+
name: autoscaling_lb
42+
title: Autoscaling Lb
43+
autoscaling_metric:
44+
name: autoscaling_metric
45+
title: Autoscaling Metric
46+
autoscaling_mode:
47+
name: autoscaling_mode
48+
title: Autoscaling Mode
49+
autoscaling_scale_in_control:
50+
name: autoscaling_scale_in_control
51+
title: Autoscaling Scale In Control
52+
cooldown_period:
53+
name: cooldown_period
54+
title: Cooldown Period
55+
distribution_policy_target_shape:
56+
name: distribution_policy_target_shape
57+
title: Distribution Policy Target Shape
58+
distribution_policy_zones:
59+
name: distribution_policy_zones
60+
title: Distribution Policy Zones
61+
health_check:
62+
name: health_check
63+
title: Health Check
64+
health_check_name:
65+
name: health_check_name
66+
title: Health Check Name
67+
hostname:
68+
name: hostname
69+
title: Hostname
70+
instance_template:
71+
name: instance_template
72+
title: Instance Template
73+
labels:
74+
name: labels
75+
title: Labels
76+
max_replicas:
77+
name: max_replicas
78+
title: Max Replicas
79+
mig_name:
80+
name: mig_name
81+
title: Mig Name
82+
mig_timeouts:
83+
name: mig_timeouts
84+
title: Mig Timeouts
85+
min_replicas:
86+
name: min_replicas
87+
title: Min Replicas
88+
named_ports:
89+
name: named_ports
90+
title: Named Ports
91+
project_id:
92+
name: project_id
93+
title: Project Id
94+
region:
95+
name: region
96+
title: Region
97+
scaling_schedules:
98+
name: scaling_schedules
99+
title: Scaling Schedules
100+
stateful_disks:
101+
name: stateful_disks
102+
title: Stateful Disks
103+
stateful_ips:
104+
name: stateful_ips
105+
title: Stateful Ips
106+
target_pools:
107+
name: target_pools
108+
title: Target Pools
109+
target_size:
110+
name: target_size
111+
title: Target Size
112+
update_policy:
113+
name: update_policy
114+
title: Update Policy
115+
wait_for_instances:
116+
name: wait_for_instances
117+
title: Wait For Instances

0 commit comments

Comments
 (0)