Skip to content

Commit b071db1

Browse files
authored
fix: fixes lint issues and generates metadata (#288)
1 parent d431db6 commit b071db1

File tree

30 files changed

+1866
-127
lines changed

30 files changed

+1866
-127
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Make will use bash instead of sh
1919
SHELL := /usr/bin/env bash
2020

21-
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.0
21+
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.10
2222
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
2323
REGISTRY_URL := gcr.io/cloud-foundation-cicd
2424

autogen/variables.tf.tmpl

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ variable "project_id" {
2424

2525
variable "hostname" {
2626
description = "Hostname prefix for instances"
27+
type = string
2728
default = "default"
2829
}
2930

@@ -35,29 +36,35 @@ variable "mig_name" {
3536

3637
variable "region" {
3738
description = "The GCP region where the managed instance group resides."
39+
type = string
3840
}
3941

4042
{% if mig %}
4143
variable "instance_template" {
4244
description = "Instance template self_link used to create compute instances"
45+
type = string
4346
}
4447

4548
{% else %}
4649
variable "instance_template_initial_version" {
4750
description = "Instance template self_link used to create compute instances for the initial version"
51+
type = string
4852
}
4953

5054
variable "instance_template_next_version" {
5155
description = "Instance template self_link used to create compute instances for the second version"
56+
type = string
5257
}
5358

5459
variable "next_version_percent" {
5560
description = "Percentage of instances defined in the second version"
61+
type = number
5662
}
5763

5864
{% endif %}
5965
variable "target_size" {
6066
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
6168
default = 1
6269
}
6370

@@ -161,21 +168,25 @@ variable "autoscaler_name" {
161168
variable "autoscaling_enabled" {
162169
description = "Creates an autoscaler for the managed instance group"
163170
default = "false"
171+
type = string
164172
}
165173

166174
variable "max_replicas" {
167175
description = "The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas."
168176
default = 10
177+
type = number
169178
}
170179

171180
variable "min_replicas" {
172181
description = "The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0."
173182
default = 2
183+
type = number
174184
}
175185

176186
variable "cooldown_period" {
177187
description = "The number of seconds that the autoscaler should wait before it starts collecting information from a new instance."
178188
default = 60
189+
type = number
179190
}
180191

181192
variable "autoscaling_mode" {
@@ -186,11 +197,11 @@ variable "autoscaling_mode" {
186197

187198
variable "autoscaling_cpu" {
188199
description = "Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#cpu_utilization"
189-
type = list(object({
200+
type = list(object({
190201
target = number
191202
predictive_method = string
192203
}))
193-
default = []
204+
default = []
194205
}
195206

196207
variable "autoscaling_metric" {
@@ -238,21 +249,6 @@ variable "autoscaling_scale_in_control" {
238249

239250
##########################
240251

241-
variable "network" {
242-
description = "Network to deploy to. Only one of network or subnetwork should be specified."
243-
default = ""
244-
}
245-
246-
variable "subnetwork" {
247-
description = "Subnet to deploy to. Only one of network or subnetwork should be specified."
248-
default = ""
249-
}
250-
251-
variable "subnetwork_project" {
252-
description = "The project that subnetwork belongs to"
253-
default = ""
254-
}
255-
256252
variable "named_ports" {
257253
description = "Named name and named port. https://cloud.google.com/load-balancing/docs/backend-service#named_ports"
258254
type = list(object({
@@ -264,6 +260,7 @@ variable "named_ports" {
264260

265261
variable "wait_for_instances" {
266262
description = "Whether to wait for all instances to be created/updated before returning. Note that if this is set to true and the operation does not succeed, Terraform will continue trying until it times out."
263+
type = string
267264
default = "false"
268265
}
269266

build/int.cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,4 @@ tags:
234234
- 'integration'
235235
substitutions:
236236
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
237-
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.0'
237+
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.10'

build/lint.cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ tags:
2121
- 'lint'
2222
substitutions:
2323
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
24-
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.0'
24+
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.10'

examples/compute_instance/simple/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ This is a simple, minimal example of how to use the compute_instance module
77

88
| Name | Description | Type | Default | Required |
99
|------|-------------|------|---------|:--------:|
10-
| deletion\_protection | Enable deletion protection on this instance. Note: you must disable deletion protection before removing the resource, or the instance cannot be deleted and the Terraform run will not complete successfully. | `bool` | `false` | no |
1110
| nat\_ip | Public ip address | `any` | `null` | no |
1211
| network\_tier | Network network\_tier | `string` | `"PREMIUM"` | no |
1312
| num\_instances | Number of instances to create | `any` | n/a | yes |

examples/compute_instance/simple/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ variable "network_tier" {
5151
default = "PREMIUM"
5252
}
5353

54-
variable "deletion_protection" {
55-
type = bool
56-
description = "Enable deletion protection on this instance. Note: you must disable deletion protection before removing the resource, or the instance cannot be deleted and the Terraform run will not complete successfully."
57-
default = false
58-
}
59-
6054
variable "service_account" {
6155
default = null
6256
type = object({

examples/mig/full/main.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ module "instance_template" {
3838
service_account = var.service_account
3939

4040
/* network */
41-
network = var.network
42-
subnetwork = var.subnetwork
43-
subnetwork_project = var.subnetwork_project
44-
can_ip_forward = var.can_ip_forward
41+
subnetwork = var.subnetwork
42+
can_ip_forward = var.can_ip_forward
4543

4644
/* image */
4745
source_image = var.source_image

examples/mig/full/variables.tf

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ variable "region" {
2929
default = "us-central1"
3030
}
3131

32-
variable "network" {
33-
description = "Network to deploy to. Only one of network or subnetwork should be specified."
34-
default = ""
35-
}
36-
3732
variable "subnetwork" {
3833
description = "Subnet to deploy to. Only one of network or subnetwork should be specified."
3934
default = ""
@@ -44,13 +39,6 @@ variable "project_id" {
4439
type = string
4540
}
4641

47-
48-
49-
variable "subnetwork_project" {
50-
description = "The project that subnetwork belongs to"
51-
default = ""
52-
}
53-
5442
variable "named_ports" {
5543
description = "Named name and named port"
5644
type = list(object({
@@ -63,11 +51,6 @@ variable "named_ports" {
6351
####################
6452
# Instance Template
6553
####################
66-
variable "name_prefix" {
67-
description = "Name prefix for the instance template"
68-
default = "default-instance-template"
69-
}
70-
7154
variable "machine_type" {
7255
description = "Machine type to create, e.g. n1-standard-1"
7356
default = "n1-standard-1"

examples/umig/full/main.tf

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ module "instance_template" {
4343
service_account = var.service_account
4444

4545
/* network */
46-
network = var.network
47-
subnetwork = var.subnetwork
48-
subnetwork_project = var.subnetwork_project
49-
can_ip_forward = var.can_ip_forward
46+
subnetwork = var.subnetwork
47+
can_ip_forward = var.can_ip_forward
5048

5149
/* image */
5250
source_image = var.source_image
@@ -61,16 +59,14 @@ module "instance_template" {
6159
}
6260

6361
module "umig" {
64-
source = "../../../modules/umig"
65-
project_id = var.project_id
66-
network = var.network
67-
subnetwork = var.subnetwork
68-
subnetwork_project = var.subnetwork_project
69-
hostname = var.hostname
70-
static_ips = var.static_ips
71-
num_instances = var.target_size
72-
instance_template = module.instance_template.self_link
73-
named_ports = var.named_ports
74-
region = var.region
75-
access_config = [[local.access_config]]
62+
source = "../../../modules/umig"
63+
project_id = var.project_id
64+
subnetwork = var.subnetwork
65+
hostname = var.hostname
66+
static_ips = var.static_ips
67+
num_instances = var.target_size
68+
instance_template = module.instance_template.self_link
69+
named_ports = var.named_ports
70+
region = var.region
71+
access_config = [[local.access_config]]
7672
}

examples/umig/full/variables.tf

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,11 @@ variable "region" {
3636
default = "us-central1"
3737
}
3838

39-
variable "network" {
40-
description = "Network to deploy to. Only one of network or subnetwork should be specified."
41-
default = ""
42-
}
43-
4439
variable "subnetwork" {
4540
description = "Subnet to deploy to. Only one of network or subnetwork should be specified."
4641
default = ""
4742
}
4843

49-
variable "subnetwork_project" {
50-
description = "The project that subnetwork belongs to"
51-
default = ""
52-
}
53-
5444
variable "named_ports" {
5545
description = "Named name and named port"
5646
type = list(object({
@@ -63,11 +53,6 @@ variable "named_ports" {
6353
####################
6454
# Instance Template
6555
####################
66-
variable "name_prefix" {
67-
description = "Name prefix for the instance template"
68-
default = "default-instance-template"
69-
}
70-
7156
variable "machine_type" {
7257
description = "Machine type to create, e.g. n1-standard-1"
7358
default = "n1-standard-1"

0 commit comments

Comments
 (0)