Skip to content

Commit 9f0a8c4

Browse files
authored
feat!: Remove 'squad' from Terraform modules (#1174)
Following on from #1161
1 parent 76a4393 commit 9f0a8c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+61
-259
lines changed

modules/alerting/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ No modules.
7474
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | n/a | `string` | n/a | yes |
7575
| <a name="input_scaling_issue_filter"></a> [scaling\_issue\_filter](#input\_scaling\_issue\_filter) | additional filter to apply to scaling issue alert policy | `string` | `""` | no |
7676
| <a name="input_signal_filter"></a> [signal\_filter](#input\_signal\_filter) | additional filter to apply to signal alert policy | `string` | `""` | no |
77-
| <a name="input_squad"></a> [squad](#input\_squad) | DEPRECATED: Use 'team' instead. Squad label to apply to resources. | `string` | `""` | no |
7877
| <a name="input_team"></a> [team](#input\_team) | Team label to apply to resources (replaces deprecated 'squad'). | `string` | `""` | no |
7978
| <a name="input_timeout_filter"></a> [timeout\_filter](#input\_timeout\_filter) | additional filter to apply to timeout alert policy | `string` | `""` | no |
8079

modules/alerting/main.tf

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ locals {
1313
}
1414

1515
locals {
16-
effective_team = coalesce(var.team, var.squad, "unknown")
17-
squad_log_filter = local.effective_team == "" ? "" : "labels.squad=\"${local.effective_team}\""
18-
squad_proto_log_filter = local.effective_team == "" ? "" : "protoPayload.response.metadata.labels.squad=\"${local.effective_team}\""
19-
name = local.effective_team == "" ? "global" : local.effective_team
20-
squad_metric_filter = local.effective_team == "" ? "" : "metric.labels.team=\"${local.effective_team}\""
21-
squad_metric_user_label_filter = local.effective_team == "" ? "" : "metadata.user_labels.\"team\"=\"${local.effective_team}\""
16+
squad_log_filter = var.team == "" ? "" : "labels.squad=\"${var.team}\""
17+
squad_proto_log_filter = var.team == "" ? "" : "protoPayload.response.metadata.labels.squad=\"${var.team}\""
18+
name = var.team == "" ? "global" : var.team
19+
squad_metric_filter = var.team == "" ? "" : "metric.labels.team=\"${var.team}\""
20+
squad_metric_user_label_filter = var.team == "" ? "" : "metadata.user_labels.\"team\"=\"${var.team}\""
2221
}
2322

2423
locals {
@@ -498,7 +497,7 @@ resource "google_monitoring_alert_policy" "nonzero-exitcode-job" {
498497
}
499498

500499
locals {
501-
promql_squad_filter = local.effective_team == "" ? "" : ", team=\"${local.effective_team}\""
500+
promql_squad_filter = var.team == "" ? "" : ", team=\"${var.team}\""
502501
}
503502

504503
resource "google_monitoring_alert_policy" "service_failure_rate_non_eventing" {
@@ -727,7 +726,7 @@ resource "google_monitoring_alert_policy" "grpc_service_failure_rate" {
727726
}
728727

729728
resource "google_logging_metric" "cloud-run-scaling-failure" {
730-
count = local.effective_team == "" ? 1 : 0
729+
count = var.team == "" ? 1 : 0
731730

732731
name = "cloud_run_scaling_failure"
733732
filter = <<EOT
@@ -808,7 +807,7 @@ resource "google_monitoring_alert_policy" "cloud-run-scaling-failure" {
808807
}
809808

810809
resource "google_logging_metric" "cloud-run-failed-req" {
811-
count = local.effective_team == "" ? 1 : 0
810+
count = var.team == "" ? 1 : 0
812811

813812
name = "cloud_run_failed_req"
814813
filter = <<EOT
@@ -990,7 +989,7 @@ resource "google_monitoring_alert_policy" "cloudrun_timeout" {
990989
}
991990

992991
resource "google_logging_metric" "cloudrun_timeout" {
993-
count = local.effective_team == "" ? 1 : 0
992+
count = var.team == "" ? 1 : 0
994993

995994
name = "cloudrun_timeout"
996995
filter = <<EOT
@@ -1027,7 +1026,7 @@ resource "google_logging_metric" "cloudrun_timeout" {
10271026
}
10281027

10291028
resource "google_logging_metric" "dockerhub_ratelimit" {
1030-
count = local.effective_team == "" ? 1 : 0
1029+
count = var.team == "" ? 1 : 0
10311030

10321031
name = "dockerhub_ratelimit"
10331032
filter = <<EOT
@@ -1070,7 +1069,7 @@ resource "google_logging_metric" "dockerhub_ratelimit" {
10701069
}
10711070

10721071
resource "google_logging_metric" "github_ratelimit" {
1073-
count = local.effective_team == "" ? 1 : 0
1072+
count = var.team == "" ? 1 : 0
10741073

10751074
name = "github_ratelimit"
10761075
filter = <<EOT
@@ -1113,7 +1112,7 @@ resource "google_logging_metric" "github_ratelimit" {
11131112
}
11141113

11151114
resource "google_logging_metric" "r2_same_ratelimit" {
1116-
count = local.effective_team == "" ? 1 : 0
1115+
count = var.team == "" ? 1 : 0
11171116

11181117
name = "r2_same_ratelimit"
11191118
filter = <<EOT

modules/alerting/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,6 @@ variable "team" {
127127
default = ""
128128
}
129129

130-
variable "squad" {
131-
description = "DEPRECATED: Use 'team' instead. Squad label to apply to resources."
132-
type = string
133-
default = ""
134-
}
135-
136130
variable "global_only_alerts" {
137131
description = "only enable global alerts. when true, only create alerts that are global."
138132
type = bool

modules/bastion/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,9 @@ No modules.
160160
| <a name="input_patch_time_utc"></a> [patch\_time\_utc](#input\_patch\_time\_utc) | Time of day in HH:MM (UTC) when patching runs. | `string` | `"03:00"` | no |
161161
| <a name="input_product"></a> [product](#input\_product) | Product label to apply to the service. | `string` | `"unknown"` | no |
162162
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Project in which to deploy the bastion host. | `string` | n/a | yes |
163-
| <a name="input_squad"></a> [squad](#input\_squad) | DEPRECATED: Use 'team' instead. Squad label to apply to resources. | `string` | `""` | no |
164163
| <a name="input_startup_script"></a> [startup\_script](#input\_startup\_script) | additional startup script snippet to execute on bastion. | `string` | `""` | no |
165164
| <a name="input_subnetwork"></a> [subnetwork](#input\_subnetwork) | Subnetwork name the bastion joins (must be private). | `string` | n/a | yes |
166-
| <a name="input_team"></a> [team](#input\_team) | Team label to apply to resources (replaces deprecated 'squad'). | `string` | `""` | no |
165+
| <a name="input_team"></a> [team](#input\_team) | Team label to apply to resources (replaces deprecated 'squad'). | `string` | n/a | yes |
167166
| <a name="input_zone"></a> [zone](#input\_zone) | Compute Engine zone for the bastion VM (e.g. us-central1-a). | `string` | n/a | yes |
168167

169168
## Outputs

modules/bastion/main.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ locals {
2121
terraform-module = basename(abspath(path.module))
2222
}
2323

24-
effective_team = coalesce(var.team, var.squad)
25-
2624
squad_label = {
27-
squad = local.effective_team
28-
team = local.effective_team
25+
squad = var.team
26+
team = var.team
2927
}
3028

3129
product_label = var.product != "" ? {

modules/bastion/variables.tf

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,6 @@ variable "dev_principals" {
3636
variable "team" {
3737
description = "Team label to apply to resources (replaces deprecated 'squad')."
3838
type = string
39-
default = ""
40-
41-
validation {
42-
condition = var.team != "" || var.squad != ""
43-
error_message = "Either 'team' or 'squad' must be specified. Please use 'team' as 'squad' is deprecated."
44-
}
45-
}
46-
47-
variable "squad" {
48-
description = "DEPRECATED: Use 'team' instead. Squad label to apply to resources."
49-
type = string
50-
default = ""
5139
}
5240

5341
variable "machine_type" {

modules/bucket-events/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ No requirements.
128128
| <a name="input_product"></a> [product](#input\_product) | Product label to apply to the service. | `string` | `"unknown"` | no |
129129
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | n/a | `string` | n/a | yes |
130130
| <a name="input_regions"></a> [regions](#input\_regions) | A map from region names to a network and subnetwork. The bucket must be in one of these regions. | <pre>map(object({<br/> network = string<br/> subnet = string<br/> }))</pre> | n/a | yes |
131-
| <a name="input_squad"></a> [squad](#input\_squad) | DEPRECATED: Use 'team' instead. Squad label to apply to resources. | `string` | `""` | no |
132131
| <a name="input_team"></a> [team](#input\_team) | Team label to apply to resources (replaces deprecated 'squad'). | `string` | `""` | no |
133132

134133
## Outputs

modules/bucket-events/main.tf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ locals {
1313
terraform-module = basename(abspath(path.module))
1414
}
1515

16-
effective_team = coalesce(var.team, var.squad, "unknown")
17-
1816
squad_label = {
19-
squad = local.effective_team
20-
team = local.effective_team
17+
squad = var.team
18+
team = var.team
2119
}
2220

2321
product_label = var.product != "" ? {
@@ -82,7 +80,6 @@ module "this" {
8280
}
8381

8482
team = var.team
85-
squad = var.squad
8683
deletion_protection = var.deletion_protection
8784
service_account = google_service_account.service.email
8885
containers = {

modules/bucket-events/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ variable "team" {
6262
default = ""
6363
}
6464

65-
variable "squad" {
66-
description = "DEPRECATED: Use 'team' instead. Squad label to apply to resources."
67-
type = string
68-
default = ""
69-
}
70-
7165
variable "labels" {
7266
description = "Labels to apply to the bucket event resources."
7367
type = map(string)

modules/cloudevent-broker/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ No requirements.
120120
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | n/a | `string` | n/a | yes |
121121
| <a name="input_regions"></a> [regions](#input\_regions) | A map from region names to a network and subnetwork. A pub/sub topic and ingress service (publishing to the respective topic) will be created in each region, with the ingress service configured to egress all traffic via the specified subnetwork. | <pre>map(object({<br/> network = string<br/> subnet = string<br/> }))</pre> | n/a | yes |
122122
| <a name="input_scaling"></a> [scaling](#input\_scaling) | The scaling configuration for the service. | <pre>object({<br/> min_instances = optional(number, 0)<br/> max_instances = optional(number, 100)<br/> max_instance_request_concurrency = optional(number)<br/> })</pre> | `{}` | no |
123-
| <a name="input_squad"></a> [squad](#input\_squad) | DEPRECATED: Use 'team' instead. Squad label to apply to resources. | `string` | `""` | no |
124123
| <a name="input_team"></a> [team](#input\_team) | Team label to apply to resources (replaces deprecated 'squad'). | `string` | `""` | no |
125124

126125
## Outputs

0 commit comments

Comments
 (0)