Skip to content

Commit f5b7b54

Browse files
authored
Simplify nested ternary operator for environment variable (#43)
1 parent 88eb41f commit f5b7b54

File tree

7 files changed

+23
-17
lines changed

7 files changed

+23
-17
lines changed

.github/workflows/sandbox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
DD_GIT_COMMIT_SHA=${{ github.sha }}
4141
registry: us-docker.pkg.dev
4242
service_account: plt-gke-info-github@ptl-lz-terraform-tf91-sb.iam.gserviceaccount.com
43-
tags: us-docker.pkg.dev/plt-lz-services-tf7f-sb/platform-docker-standard/gke-info-go:${{ github.sha }}
43+
tags: us-docker.pkg.dev/plt-lz-services-tf7f-sb/plt-docker-standard/gke-info-go:${{ github.sha }}
4444
workload_identity_provider: projects/746490462722/locations/global/workloadIdentityPools/github-actions/providers/github-actions-oidc
4545

4646
us_east1_b:

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99

1010

1111
- repo: https://github.com/antonbabenko/pre-commit-terraform
12-
rev: v1.92.3
12+
rev: v1.95.0
1313
hooks:
1414
- id: terraform_fmt
1515

@@ -30,7 +30,7 @@ repos:
3030
- --hook-config=--create-file-if-not-exist=false
3131

3232
- repo: https://github.com/bridgecrewio/checkov.git
33-
rev: 3.2.238
33+
rev: 3.2.253
3434
hooks:
3535
- id: checkov
3636
files: Dockerfile

cmd/http/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func main() {
2525

2626
observability.InfoWithContext(ctx, "Application is starting")
2727

28-
tracer.Start()
28+
tracer.Start(tracer.WithRuntimeMetrics())
2929
defer tracer.Stop()
3030

3131
err := profiler.Start(

deployments/regional/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Terraform Documentation
22

3-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
3+
<!-- BEGIN_TF_DOCS -->
44
## Requirements
55

66
No requirements.
@@ -9,8 +9,8 @@ No requirements.
99

1010
| Name | Version |
1111
|------|---------|
12-
| <a name="provider_datadog"></a> [datadog](#provider\_datadog) | 3.43.1 |
13-
| <a name="provider_google"></a> [google](#provider\_google) | 6.0.1 |
12+
| <a name="provider_datadog"></a> [datadog](#provider\_datadog) | 3.44.1 |
13+
| <a name="provider_google"></a> [google](#provider\_google) | 6.2.0 |
1414
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.32.0 |
1515

1616
## Modules
@@ -44,4 +44,4 @@ No modules.
4444
## Outputs
4545

4646
No outputs.
47-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
47+
<!-- END_TF_DOCS -->

deployments/regional/locals.tf

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,14 @@ locals {
6868
}
6969
} : {}
7070

71-
env = var.environment == "sandbox" ? "sb" : var.environment == "non-production" ? "non-prod" : var.environment == "production" ? "prod" : "none"
71+
env_map = {
72+
"sandbox" = "sb"
73+
"non-production" = "non-prod"
74+
"production" = "prod"
75+
}
7276

73-
registry = var.environment == "sandbox" ? "us-docker.pkg.dev/plt-lz-services-tf7f-sb/platform-docker-virtual" : "us-docker.pkg.dev/plt-lz-services-tf79-prod/platform-docker-virtual"
77+
env = lookup(local.env_map, var.environment, "none")
78+
79+
registry = var.environment == "sandbox" ? "us-docker.pkg.dev/plt-lz-services-tf7f-sb/plt-docker-virtual" : "us-docker.pkg.dev/plt-lz-services-tf79-prod/plt-docker-virtual"
7480
kubernetes_project = var.environment == "sandbox" ? "plt-k8s-tf39-sb" : var.environment == "production" ? "plt-k8s-tf10-prod" : "plt-k8s-tf33-nonprod"
7581
}

deployments/regional/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ provider "kubernetes" {
5252

5353
data "google_container_cluster" "this" {
5454
location = var.region
55-
name = "services-${var.region}-${var.zone}"
55+
name = "plt-${var.region}-${var.zone}"
5656
project = local.kubernetes_project
5757
}
5858

@@ -82,7 +82,7 @@ resource "datadog_synthetics_test" "this" {
8282

8383
locations = each.value.locations
8484
message = each.value.message
85-
name = "${each.value.name} on - region:${each.value.region} env:${var.environment}"
85+
name = "${each.value.name} ${each.value.region} ${var.environment}"
8686

8787
options_list {
8888
tick_every = 300
@@ -216,12 +216,12 @@ resource "kubernetes_deployment_v1" "gke_info_go" {
216216

217217
resources {
218218
requests = {
219-
cpu = "50m"
220-
memory = "128Mi"
219+
cpu = "100m"
220+
memory = "64Mi"
221221
}
222222
limits = {
223-
cpu = "100m"
224-
memory = "256Mi"
223+
cpu = "200m"
224+
memory = "128Mi"
225225
}
226226
}
227227

openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ paths:
4444
- cluster-name
4545
- cluster-location
4646
- instance-zone
47-
47+
4848
responses:
4949
'200':
5050
description: Metadata fetched successfully

0 commit comments

Comments
 (0)