Skip to content

Commit

Permalink
chore: Add connection metadata, metadata.display.yaml (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
q2w authored Oct 22, 2024
1 parent 866c1a0 commit 8cc5f65
Show file tree
Hide file tree
Showing 6 changed files with 345 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/instance_template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ See the [simple](../../examples/instance_template/simple) for a usage example.
| project\_id | The GCP project ID | `string` | `null` | no |
| region | Region where the instance template should be created. | `string` | `null` | no |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
Expand Down
180 changes: 180 additions & 0 deletions modules/instance_template/metadata.display.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintMetadata
metadata:
name: terraform-google-vm-instance-template-display
annotations:
config.kubernetes.io/local-config: "true"
spec:
info:
title: instance_template
source:
repo: https://github.com/terraform-google-modules/terraform-google-vm
sourceType: git
dir: /modules/instance_template
ui:
input:
variables:
access_config:
name: access_config
title: Access Config
altDefaults:
- type: ALTERNATE_TYPE_DC
value:
nat_ip: null
network_tier: PREMIUM
additional_disks:
name: additional_disks
title: Additional Disks
additional_networks:
name: additional_networks
title: Additional Networks
alias_ip_range:
name: alias_ip_range
title: Alias Ip Range
auto_delete:
name: auto_delete
title: Auto Delete
automatic_restart:
name: automatic_restart
title: Automatic Restart
can_ip_forward:
name: can_ip_forward
title: Can Ip Forward
confidential_instance_type:
name: confidential_instance_type
title: Confidential Instance Type
description:
name: description
title: Description
disk_encryption_key:
name: disk_encryption_key
title: Disk Encryption Key
disk_labels:
name: disk_labels
title: Disk Labels
disk_resource_policies:
name: disk_resource_policies
title: Disk Resource Policies
disk_size_gb:
name: disk_size_gb
title: Disk Size Gb
disk_type:
name: disk_type
title: Disk Type
enable_confidential_vm:
name: enable_confidential_vm
title: Enable Confidential Vm
enable_nested_virtualization:
name: enable_nested_virtualization
title: Enable Nested Virtualization
enable_shielded_vm:
name: enable_shielded_vm
title: Enable Shielded Vm
gpu:
name: gpu
title: Gpu
instance_description:
name: instance_description
title: Instance Description
ipv6_access_config:
name: ipv6_access_config
title: Ipv6 Access Config
labels:
name: labels
title: Labels
machine_type:
name: machine_type
title: Machine Type
maintenance_interval:
name: maintenance_interval
title: Maintenance Interval
metadata:
name: metadata
title: Metadata
min_cpu_platform:
name: min_cpu_platform
title: Min Cpu Platform
name_prefix:
name: name_prefix
title: Name Prefix
network:
name: network
title: Network
network_ip:
name: network_ip
title: Network Ip
nic_type:
name: nic_type
title: Nic Type
on_host_maintenance:
name: on_host_maintenance
title: On Host Maintenance
preemptible:
name: preemptible
title: Preemptible
project_id:
name: project_id
title: Project Id
region:
name: region
title: Region
resource_policies:
name: resource_policies
title: Resource Policies
service_account:
name: service_account
title: Service Account
shielded_instance_config:
name: shielded_instance_config
title: Shielded Instance Config
source_image:
name: source_image
title: Source Image
source_image_family:
name: source_image_family
title: Source Image Family
source_image_project:
name: source_image_project
title: Source Image Project
spot:
name: spot
title: Spot
spot_instance_termination_action:
name: spot_instance_termination_action
title: Spot Instance Termination Action
stack_type:
name: stack_type
title: Stack Type
startup_script:
name: startup_script
title: Startup Script
subnetwork:
name: subnetwork
title: Subnetwork
subnetwork_project:
name: subnetwork_project
title: Subnetwork Project
tags:
name: tags
title: Tags
threads_per_core:
name: threads_per_core
title: Threads Per Core
total_egress_bandwidth_tier:
name: total_egress_bandwidth_tier
title: Total Egress Bandwidth Tier

36 changes: 35 additions & 1 deletion modules/instance_template/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,27 @@ spec:
description: Metadata, provided as a map
varType: map(string)
defaultValue: {}
connections:
- source:
source: github.com/terraform-google-modules/terraform-google-memorystore
version: ~> 10.0
spec:
outputExpr: env_vars
- source:
source: github.com/terraform-google-modules/terraform-google-sql-db//modules/postgresql
version: ~> 21.0
spec:
outputExpr: env_vars
- source:
source: github.com/terraform-google-modules/terraform-google-sql-db//modules/mysql
version: ~> 22.0
spec:
outputExpr: env_vars
- source:
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
version: ~> 4.3
spec:
outputExpr: env_vars
- name: min_cpu_platform
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"
varType: string
Expand Down Expand Up @@ -264,9 +285,16 @@ spec:
varType: |-
object({
email = string
scopes = set(string)
scopes = optional(set(string), ["cloud-platform"])
})
required: true
connections:
- source:
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
version: ~> 4.3
spec:
outputExpr: email
inputPath: email
- name: shielded_instance_config
description: Not used unless enable_shielded_vm is true. Shielded VM configuration for the instance.
varType: |-
Expand Down Expand Up @@ -328,12 +356,18 @@ spec:
outputs:
- name: name
description: Name of instance template
type: string
- name: self_link
description: Self-link of instance template
type: string
- name: self_link_unique
description: Unique self-link of instance template (recommended output to use instead of self_link)
type: string
- name: tags
description: Tags that will be associated with instance(s)
type:
- list
- string
requirements:
roles:
- level: Project
Expand Down
2 changes: 1 addition & 1 deletion modules/instance_template/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ variable "metadata" {
variable "service_account" {
type = object({
email = string
scopes = set(string)
scopes = optional(set(string), ["cloud-platform"])
})
description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account."
}
Expand Down
117 changes: 117 additions & 0 deletions modules/mig/metadata.display.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintMetadata
metadata:
name: terraform-google-vm-mig-display
annotations:
config.kubernetes.io/local-config: "true"
spec:
info:
title: Managed Instance Group (MIG)
source:
repo: https://github.com/terraform-google-modules/terraform-google-vm
sourceType: git
dir: /modules/mig
ui:
input:
variables:
autoscaler_name:
name: autoscaler_name
title: Autoscaler Name
autoscaling_cpu:
name: autoscaling_cpu
title: Autoscaling Cpu
autoscaling_enabled:
name: autoscaling_enabled
title: Autoscaling Enabled
autoscaling_lb:
name: autoscaling_lb
title: Autoscaling Lb
autoscaling_metric:
name: autoscaling_metric
title: Autoscaling Metric
autoscaling_mode:
name: autoscaling_mode
title: Autoscaling Mode
autoscaling_scale_in_control:
name: autoscaling_scale_in_control
title: Autoscaling Scale In Control
cooldown_period:
name: cooldown_period
title: Cooldown Period
distribution_policy_target_shape:
name: distribution_policy_target_shape
title: Distribution Policy Target Shape
distribution_policy_zones:
name: distribution_policy_zones
title: Distribution Policy Zones
health_check:
name: health_check
title: Health Check
health_check_name:
name: health_check_name
title: Health Check Name
hostname:
name: hostname
title: Hostname
instance_template:
name: instance_template
title: Instance Template
labels:
name: labels
title: Labels
max_replicas:
name: max_replicas
title: Max Replicas
mig_name:
name: mig_name
title: Mig Name
mig_timeouts:
name: mig_timeouts
title: Mig Timeouts
min_replicas:
name: min_replicas
title: Min Replicas
named_ports:
name: named_ports
title: Named Ports
project_id:
name: project_id
title: Project Id
region:
name: region
title: Region
scaling_schedules:
name: scaling_schedules
title: Scaling Schedules
stateful_disks:
name: stateful_disks
title: Stateful Disks
stateful_ips:
name: stateful_ips
title: Stateful Ips
target_pools:
name: target_pools
title: Target Pools
target_size:
name: target_size
title: Target Size
update_policy:
name: update_policy
title: Update Policy
wait_for_instances:
name: wait_for_instances
title: Wait For Instances
Loading

0 comments on commit 8cc5f65

Please sign in to comment.