Skip to content

Commit ef5ee51

Browse files
committed
chore: Update variable's order in variables.tf and update display metadata
1 parent 780d187 commit ef5ee51

File tree

10 files changed

+109
-95
lines changed

10 files changed

+109
-95
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ docker_generate_docs:
8282
-e ENABLE_BPMETADATA \
8383
-v "$(CURDIR)":/workspace \
8484
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
85-
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs'
85+
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs display'
8686

8787
# Generate files from autogen
8888
.PHONY: docker_generate_modules

autogen/variables.tf.tmpl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ variable "project_id" {
2222
default = null
2323
}
2424

25-
variable "hostname" {
26-
description = "Hostname prefix for instances"
25+
variable "region" {
26+
description = "The Google Cloud region where the managed instance group resides."
2727
type = string
28-
default = "default"
2928
}
3029

3130
variable "mig_name" {
@@ -34,9 +33,16 @@ variable "mig_name" {
3433
default = ""
3534
}
3635

37-
variable "region" {
38-
description = "The Google Cloud region where the managed instance group resides."
36+
variable "hostname" {
37+
description = "Hostname prefix for instances"
3938
type = string
39+
default = "default"
40+
}
41+
42+
variable "target_size" {
43+
description = "The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set."
44+
type = number
45+
default = 1
4046
}
4147

4248
{% if mig %}
@@ -62,12 +68,6 @@ variable "next_version_percent" {
6268
}
6369

6470
{% endif %}
65-
variable "target_size" {
66-
description = "The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set."
67-
type = number
68-
default = 1
69-
}
70-
7171
variable "target_pools" {
7272
description = "The target load balancing pools to assign this group to."
7373
type = list(string)

modules/instance_template/metadata.display.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ spec:
6060
description:
6161
name: description
6262
title: Description
63+
invisible: false
6364
disk_encryption_key:
6465
name: disk_encryption_key
6566
title: Disk Encryption Key
@@ -90,6 +91,7 @@ spec:
9091
instance_description:
9192
name: instance_description
9293
title: Instance Description
94+
invisible: false
9395
ipv6_access_config:
9496
name: ipv6_access_config
9597
title: Ipv6 Access Config
@@ -99,6 +101,7 @@ spec:
99101
machine_type:
100102
name: machine_type
101103
title: Machine Type
104+
invisible: false
102105
maintenance_interval:
103106
name: maintenance_interval
104107
title: Maintenance Interval
@@ -111,6 +114,9 @@ spec:
111114
name_prefix:
112115
name: name_prefix
113116
title: Name Prefix
117+
invisible: false
118+
regexValidation: ^[a-z][a-z0-9-]{0,51}[a-z0-9]$
119+
validation: Use lowercase letters, numbers, and hyphens. Start with a letter and end with letter/number. Must be 53 characters or fewer.
114120
network:
115121
name: network
116122
title: Network
@@ -129,9 +135,11 @@ spec:
129135
project_id:
130136
name: project_id
131137
title: Project Id
138+
invisible: false
132139
region:
133140
name: region
134141
title: Region
142+
invisible: false
135143
resource_policies:
136144
name: resource_policies
137145
title: Resource Policies
@@ -153,6 +161,7 @@ spec:
153161
spot:
154162
name: spot
155163
title: Spot
164+
invisible: false
156165
spot_instance_termination_action:
157166
name: spot_instance_termination_action
158167
title: Spot Instance Termination Action
@@ -177,4 +186,3 @@ spec:
177186
total_egress_bandwidth_tier:
178187
name: total_egress_bandwidth_tier
179188
title: Total Egress Bandwidth Tier
180-

modules/instance_template/metadata.yaml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,21 @@ spec:
8383
- name: project_id
8484
description: The GCP project ID
8585
varType: string
86+
- name: region
87+
description: Region where the instance template should be created.
88+
varType: string
8689
- name: name_prefix
8790
description: Name prefix for the instance template
8891
varType: string
8992
defaultValue: default-instance-template
93+
- name: machine_type
94+
description: Machine type to create, e.g. n1-standard-1
95+
varType: string
96+
defaultValue: n1-standard-1
97+
- name: spot
98+
description: Provision a SPOT instance
99+
varType: bool
100+
defaultValue: false
90101
- name: description
91102
description: The template's description
92103
varType: string
@@ -95,10 +106,6 @@ spec:
95106
description: Description of the generated instances
96107
varType: string
97108
defaultValue: ""
98-
- name: machine_type
99-
description: Machine type to create, e.g. n1-standard-1
100-
varType: string
101-
defaultValue: n1-standard-1
102109
- name: min_cpu_platform
103110
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"
104111
varType: string
@@ -118,10 +125,6 @@ spec:
118125
description: Allow the instance to be preempted
119126
varType: bool
120127
defaultValue: false
121-
- name: spot
122-
description: Provision a SPOT instance
123-
varType: bool
124-
defaultValue: false
125128
- name: automatic_restart
126129
description: (Optional) Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user).
127130
varType: bool
@@ -137,9 +140,6 @@ spec:
137140
description: Action to take when Compute Engine preempts a Spot VM.
138141
varType: string
139142
defaultValue: STOP
140-
- name: region
141-
description: Region where the instance template should be created.
142-
varType: string
143143
- name: enable_nested_virtualization
144144
description: Defines whether the instance should have nested virtualization enabled.
145145
varType: bool
@@ -265,24 +265,24 @@ spec:
265265
connections:
266266
- source:
267267
source: github.com/terraform-google-modules/terraform-google-memorystore
268-
version: ~> 10.0
268+
version: ">= 12.0"
269269
spec:
270-
outputExpr: env_vars
270+
outputExpr: "{\"REDIS_HOST\": host, \"REDIS_PORT\": port}"
271271
- source:
272-
source: github.com/terraform-google-modules/terraform-google-sql-db//modules/postgresql
273-
version: ~> 21.0
272+
source: github.com/q2w/terraform-google-sql-db//modules/postgresql
273+
version: ">= 23.0"
274274
spec:
275-
outputExpr: env_vars
275+
outputExpr: "{\"CLOUD_SQL_DATABASE_HOST\" : instance_first_ip_address, \"CLOUD_SQL_DATABASE_CONNECTION_NAME\" : instance_connection_name, \"CLOUD_SQL_DATABASE_NAME\" : env_vars.CLOUD_SQL_DATABASE_NAME}"
276276
- source:
277-
source: github.com/terraform-google-modules/terraform-google-sql-db//modules/mysql
278-
version: ~> 22.0
277+
source: github.com/q2w/terraform-google-sql-db//modules/mysql
278+
version: ">= 23.0"
279279
spec:
280-
outputExpr: env_vars
280+
outputExpr: "{\"CLOUD_SQL_DATABASE_HOST\" : instance_first_ip_address, \"CLOUD_SQL_DATABASE_CONNECTION_NAME\" : instance_connection_name, \"CLOUD_SQL_DATABASE_NAME\" : env_vars.CLOUD_SQL_DATABASE_NAME}"
281281
- source:
282282
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
283-
version: ~> 4.3
283+
version: ">= 4.4"
284284
spec:
285-
outputExpr: env_vars
285+
outputExpr: "{\"SERVICE_ACCOUNT_EMAIL\" : email, \"SERVICE_ACCOUNT_IAM_EMAIL\" : iam_email}"
286286
- name: service_account
287287
description: Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account.
288288
varType: |-
@@ -294,7 +294,7 @@ spec:
294294
connections:
295295
- source:
296296
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
297-
version: ~> 4.3
297+
version: ">= 4.4"
298298
spec:
299299
outputExpr: email
300300
inputPath: email

modules/instance_template/variables.tf

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,30 @@ variable "project_id" {
2020
default = null
2121
}
2222

23+
variable "region" {
24+
type = string
25+
description = "Region where the instance template should be created."
26+
default = null
27+
}
28+
2329
variable "name_prefix" {
2430
description = "Name prefix for the instance template"
2531
type = string
2632
default = "default-instance-template"
2733
}
2834

35+
variable "machine_type" {
36+
description = "Machine type to create, e.g. n1-standard-1"
37+
type = string
38+
default = "n1-standard-1"
39+
}
40+
41+
variable "spot" {
42+
type = bool
43+
description = "Provision a SPOT instance"
44+
default = false
45+
}
46+
2947
variable "description" {
3048
description = "The template's description"
3149
type = string
@@ -38,12 +56,6 @@ variable "instance_description" {
3856
default = ""
3957
}
4058

41-
variable "machine_type" {
42-
description = "Machine type to create, e.g. n1-standard-1"
43-
type = string
44-
default = "n1-standard-1"
45-
}
46-
4759
variable "min_cpu_platform" {
4860
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"
4961
type = string
@@ -74,12 +86,6 @@ variable "preemptible" {
7486
default = false
7587
}
7688

77-
variable "spot" {
78-
type = bool
79-
description = "Provision a SPOT instance"
80-
default = false
81-
}
82-
8389
variable "automatic_restart" {
8490
type = bool
8591
description = "(Optional) Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user)."
@@ -113,12 +119,6 @@ variable "spot_instance_termination_action" {
113119
}
114120
}
115121

116-
variable "region" {
117-
type = string
118-
description = "Region where the instance template should be created."
119-
default = null
120-
}
121-
122122
variable "enable_nested_virtualization" {
123123
type = bool
124124
description = "Defines whether the instance should have nested virtualization enabled."

modules/mig/metadata.display.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ spec:
6767
hostname:
6868
name: hostname
6969
title: Hostname
70+
invisible: false
7071
instance_template:
7172
name: instance_template
7273
title: Instance Template
@@ -79,6 +80,9 @@ spec:
7980
mig_name:
8081
name: mig_name
8182
title: Mig Name
83+
invisible: false
84+
regexValidation: ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
85+
validation: Use lowercase letters, numbers, and hyphens. Start with a letter and end with letter/number. Must be 63 characters or fewer.
8286
mig_timeouts:
8387
name: mig_timeouts
8488
title: Mig Timeouts
@@ -91,6 +95,7 @@ spec:
9195
project_id:
9296
name: project_id
9397
title: Project Id
98+
invisible: false
9499
region:
95100
name: region
96101
title: Region
@@ -109,6 +114,7 @@ spec:
109114
target_size:
110115
name: target_size
111116
title: Target Size
117+
invisible: false
112118
update_policy:
113119
name: update_policy
114120
title: Update Policy

modules/mig/metadata.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,32 +83,32 @@ spec:
8383
- name: project_id
8484
description: The Google Cloud project ID
8585
varType: string
86-
- name: hostname
87-
description: Hostname prefix for instances
86+
- name: region
87+
description: The Google Cloud region where the managed instance group resides.
8888
varType: string
89-
defaultValue: default
89+
required: true
9090
- name: mig_name
9191
description: Managed instance group name. When variable is empty, name will be derived from var.hostname.
9292
varType: string
9393
defaultValue: ""
94-
- name: region
95-
description: The Google Cloud region where the managed instance group resides.
94+
- name: hostname
95+
description: Hostname prefix for instances
9696
varType: string
97-
required: true
97+
defaultValue: default
98+
- name: target_size
99+
description: The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set.
100+
varType: number
101+
defaultValue: 1
98102
- name: instance_template
99103
description: Instance template self_link used to create compute instances
100104
varType: string
101105
required: true
102106
connections:
103107
- source:
104108
source: github.com/terraform-google-modules/terraform-google-vm//modules/instance_template
105-
version: ~> 12.0
109+
version: ">= 12.0"
106110
spec:
107111
outputExpr: self_link
108-
- name: target_size
109-
description: The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set.
110-
varType: number
111-
defaultValue: 1
112112
- name: target_pools
113113
description: The target load balancing pools to assign this group to.
114114
varType: list(string)

0 commit comments

Comments
 (0)