@hiiretail/gcp-infra-cli 0.83.2 → 0.83.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/generators/init/clan-infra/index.js +5 -11
  2. package/generators/init/clan-infra/templates/env/project.hcl +4 -1
  3. package/generators/init/clan-infra/templates/env/secrets/terragrunt.hcl +10 -8
  4. package/generators/init/clan-infra/templates/infra/common.hcl +20 -15
  5. package/generators/init/clan-infra/templates/notification-channels/notification-channels.yaml +7 -0
  6. package/generators/init/clan-infra/templates/notification-channels/terragrunt.hcl +13 -6
  7. package/generators/resources/cloud-storage/templates/cloud-storage/terragrunt.hcl +7 -8
  8. package/generators/resources/cloudsql/index.js +0 -8
  9. package/generators/resources/cloudsql/templates/mssql/instance/terragrunt.hcl +11 -12
  10. package/generators/resources/cloudsql/templates/mssql/instance-secrets/terragrunt.hcl +12 -16
  11. package/generators/resources/cloudsql/templates/mysql/instance/terragrunt.hcl +10 -10
  12. package/generators/resources/cloudsql/templates/mysql/instance-secrets/terragrunt.hcl +13 -16
  13. package/generators/resources/cloudsql/templates/postgres/instance/terragrunt.hcl +6 -7
  14. package/generators/resources/cloudsql/templates/postgres/instance-secrets/terragrunt.hcl +7 -8
  15. package/generators/resources/cloudsql-database/templates/mysql/secrets/terragrunt.hcl +11 -10
  16. package/generators/resources/cloudsql-database/templates/postgres/secrets/terragrunt.hcl +11 -10
  17. package/generators/resources/firestore/index.js +0 -7
  18. package/generators/resources/kms/templates/kms/terragrunt.hcl +10 -10
  19. package/generators/resources/memorystore/index.js +0 -7
  20. package/generators/resources/memorystore/templates/redis-instance/terragrunt.hcl +7 -9
  21. package/generators/resources/memorystore/templates/secrets/terragrunt.hcl +11 -15
  22. package/generators/resources/monitoring/handle-yaml.js +21 -3
  23. package/generators/resources/monitoring/index.js +12 -30
  24. package/generators/resources/monitoring/templates/alerts/{alerts.yaml → generic-infra.yaml} +0 -18
  25. package/generators/resources/monitoring/templates/alerts/service.yaml +16 -0
  26. package/generators/resources/monitoring/templates/alerts/terragrunt.hcl +13 -14
  27. package/generators/resources/monitoring/templates/slos/slos.yaml +3 -3
  28. package/generators/resources/monitoring/templates/slos/terragrunt.hcl +19 -18
  29. package/generators/resources/monitoring/templates/uptime-checks/terragrunt.hcl +15 -18
  30. package/generators/resources/pubsub/index.js +0 -7
  31. package/generators/resources/pubsub/templates/pubsub/terragrunt.hcl +7 -14
  32. package/generators/resources/pubsub/templates/pubsub-dlq/terragrunt.hcl +25 -32
  33. package/generators/resources/spanner/templates/spanner/terragrunt.hcl +16 -17
  34. package/package.json +1 -1
  35. package/generators/resources/cloudsql/templates/monitoring/cloud-sql/terragrunt.hcl +0 -34
  36. package/generators/resources/cloudsql/templates/monitoring/notification-channels/terragrunt.hcl +0 -22
  37. package/generators/resources/firestore/templates/monitoring/firestore/terragrunt.hcl +0 -34
  38. package/generators/resources/firestore/templates/monitoring/notification-channels/terragrunt.hcl +0 -22
  39. package/generators/resources/memorystore/templates/monitoring/memorystore/terragrunt.hcl +0 -34
  40. package/generators/resources/memorystore/templates/monitoring/notification-channels/terragrunt.hcl +0 -22
  41. package/generators/resources/monitoring/templates/notification-channels/terragrunt.hcl +0 -22
  42. package/generators/resources/pubsub/templates/monitoring/notification-channels/terragrunt.hcl +0 -22
  43. package/generators/resources/pubsub/templates/monitoring/pubsub/terragrunt.hcl +0 -34
@@ -58,7 +58,7 @@ module.exports = class extends BaseGenerator {
58
58
  {
59
59
  type: 'input',
60
60
  name: 'jiraProjectKey',
61
- message: 'Provide the "jira project key" for your clan (the uppercase prefix in your task names, example: SRT)',
61
+ message: 'Provide the "jira project key" for your clan, which is the prefix of your task names (e.g. srt, hii, hcc)',
62
62
  validate: required && validate.jiraProjectKey,
63
63
  },
64
64
  {
@@ -135,16 +135,10 @@ module.exports = class extends BaseGenerator {
135
135
  createEnv('staging', tribeStaging, clanStaging);
136
136
 
137
137
  // Init notification channels for clan
138
- ['prod', 'staging'].forEach((env) => {
139
- this.copyDir(
140
- 'notification-channels',
141
- path.join('infra', env, 'monitoring', 'notification-channels'),
142
- {
143
- ...this.answers,
144
- env,
145
- },
146
- );
147
- });
138
+ this.copyDir('notification-channels',
139
+ path.join('infra', 'prod', 'monitoring', 'notification-channels'),
140
+ this.answers);
141
+
148
142
  this.copyDir('github',
149
143
  this.destinationPath(path.join('.github')),
150
144
  {
@@ -8,5 +8,8 @@ locals {
8
8
  project = local.project_id
9
9
  network = "tribe-network"
10
10
  tribe_project_id = "<%-tribeProject%>"
11
- monitoring_project_id = "<%-tribeProject%>" # possibly will be changed to hiiretail-monitoring-prod-6500 later
11
+
12
+ default_user_labels = {
13
+ environment = local.project_env,
14
+ }
12
15
  }
@@ -7,6 +7,12 @@ terraform {
7
7
  locals {
8
8
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
9
9
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
10
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
11
+ component = local.common_vars.locals.component
12
+ product = local.common_vars.locals.product
13
+ tenant-alias = local.common_vars.locals.tenant_alias
14
+ terraform = ""
15
+ })
10
16
  }
11
17
 
12
18
  # Include all settings from the root terragrunt.hcl file
@@ -14,16 +20,12 @@ include {
14
20
  path = find_in_parent_folders("terragrunt_root.hcl")
15
21
  }
16
22
 
17
-
18
23
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
19
24
  inputs = merge(
20
25
  {
21
- secrets = merge(yamldecode(file("${get_terragrunt_dir()}/secrets.yaml")).secrets,
22
- { "clan_slack_channel" = local.common_vars.locals.clan_slack_channels[0].name })
23
- project_id = local.project_vars.locals.project_id
24
- labels = {
25
- terraform = ""
26
- cc = local.common_vars.locals.cost_center
27
- }
26
+ secrets = merge(yamldecode(file("${get_terragrunt_dir()}/secrets.yaml")).secrets,
27
+ { "clan_slack_channel" = local.common_vars.locals.clan_slack_channels[0].name })
28
+ project_id = local.project_vars.locals.project_id
29
+ labels = local.labels
28
30
  }
29
31
  )
@@ -1,19 +1,24 @@
1
1
  # Set clan-wide variables here. These are automatically pulled in at the root terragrunt.hcl configuration to
2
2
  # set the remote state configuration and to feed variables forward to the child modules.
3
3
  locals {
4
- tribe_name = "<%-tribe%>"
5
- clan_name = "<%-clan%>"
6
- region = "europe-west1"
7
- clan_group_email = "tribe-<%-tribe%>-<%-clan%>@extendaretail.com"
8
- clan_slack_channels = [
9
- {
10
- name = "#<%-tribe%>-<%-clan%>-monitor"
11
- }
12
- ]
13
- project_id_slack_token = "tf-admin-90301274"
14
- cost_center = "<%-costCenter%>"
15
- jira_project_key = "<%-jiraProjectKey%>"
16
- component = "<%-costCenter%>"
17
- product = "<%-product%>"
18
- tenant_alias = "<%-tenantAlias%>"
4
+ tribe_name = "<%-tribe%>"
5
+ clan_name = "<%-clan%>"
6
+ region = "europe-west1"
7
+ cost_center = "<%-costCenter%>"
8
+ jira_project_key = "<%-jiraProjectKey%>"
9
+ component = "<%-component%>"
10
+ product = "<%-product%>"
11
+ tenant_alias = "<%-tenantAlias%>"
12
+
13
+ project_id_slack_token = "tf-admin-90301274"
14
+ slack_token_secret_name = "monitoring-slack-token"
15
+
16
+ clan_group_email = "tribe-<%-tribe%>-<%-clan%>@extendaretail.com"
17
+ clan_slack_channels = [{ name = "#<%-tribe%>-<%-clan%>-monitor" }]
18
+
19
+ default_user_labels = {
20
+ clan = local.clan_name
21
+ cc = local.cost_center
22
+ jira_project_key = local.jira_project_key
23
+ }
19
24
  }
@@ -0,0 +1,7 @@
1
+ slack:
2
+ - channel_name: "#<%-tribe%>-<%-clan%>-monitor"
3
+ fallback_channel: true
4
+
5
+ email:
6
+ - email_address: tribe-<%-tribe%>-<%-clan%>@extendaretail.com
7
+ fallback_channel: true
@@ -1,7 +1,7 @@
1
1
  # Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
2
2
  # working directory, into a temporary folder, and execute your Terraform commands in that folder.
3
3
  terraform {
4
- source = "git::https://github.com/extenda/tf-module-gcp-notification-channels//?ref=v0.1.1"
4
+ source = "git::https://github.com/extenda/tf-module-gcp-notification-channels//?ref=v1.0.1"
5
5
  }
6
6
 
7
7
  # Include all settings from the root terragrunt.hcl file
@@ -12,11 +12,18 @@ include {
12
12
  locals {
13
13
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
14
14
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
15
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
16
+ component = local.common_vars.locals.component
17
+ product = local.common_vars.locals.product
18
+ tenant-alias = local.common_vars.locals.tenant_alias
19
+ })
15
20
  }
16
21
 
17
22
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
18
- inputs = merge(local.project_vars.locals, local.common_vars.locals,
19
- {
20
- clan_project_id = local.project_vars.locals.project_id
21
- }
22
- )
23
+ inputs = {
24
+ project = local.project_vars.locals.tribe_project_id,
25
+ notification_channels = yamldecode(file("${get_terragrunt_dir()}/notification-channels.yaml"))
26
+ slack_token_secret_project_id = local.common_vars.locals.project_id_slack_token,
27
+ slack_token_secret_name = local.common_vars.locals.slack_token_secret_name,
28
+ default_user_labels = local.labels,
29
+ }
@@ -12,6 +12,11 @@ include {
12
12
  locals {
13
13
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
14
14
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
15
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
16
+ component = local.common_vars.locals.component
17
+ product = local.common_vars.locals.product
18
+ tenant-alias = local.common_vars.locals.tenant_alias
19
+ })
15
20
  }
16
21
 
17
22
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
@@ -21,13 +26,7 @@ inputs = merge(
21
26
  {
22
27
  project_id = local.project_vars.locals.project_id
23
28
  # IAM-style members who will be granted roles/storage.objectViewer on all buckets.
24
- viewers = ["group:${local.common_vars.locals.clan_group_email}"]
25
- labels = {
26
- cc = local.common_vars.locals.cost_center
27
- component = local.common_vars.locals.component
28
- product = local.common_vars.locals.product
29
- tenant-alias = local.common_vars.locals.tenant_alias
30
- environment = local.project_vars.locals.project_env
31
- }
29
+ viewers = ["group:${local.common_vars.locals.clan_group_email}"]
30
+ labels = local.labels,
32
31
  }
33
32
  )
@@ -73,14 +73,6 @@ module.exports = class extends BaseGenerator {
73
73
  );
74
74
  });
75
75
 
76
- // CloudSQL Monitoring
77
- ['prod', 'staging'].forEach((env) => {
78
- this.copyDir(
79
- path.join('monitoring'),
80
- path.join('infra', env, 'monitoring'),
81
- );
82
- });
83
-
84
76
  // CloudSQL Instance secrets
85
77
  ['prod', 'staging'].forEach((env) => {
86
78
  this.copyDir(
@@ -13,6 +13,11 @@ locals {
13
13
  spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
14
14
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
15
15
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
16
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
17
+ component = local.common_vars.locals.component
18
+ product = local.common_vars.locals.product
19
+ tenant-alias = local.common_vars.locals.tenant_alias
20
+ })
16
21
  }
17
22
 
18
23
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
@@ -20,20 +25,14 @@ inputs = merge(
20
25
  local.spec_vars.locals,
21
26
  {
22
27
  name = "mssql-${local.project_vars.locals.project_name}"
23
- ip_configuration = {
24
- "authorized_networks": [],
25
- "ipv4_enabled": true,
26
- "private_network": "https://www.googleapis.com/compute/v1/projects/${local.project_vars.locals.tribe_project_id}/global/networks/${local.project_vars.locals.network}",
27
- "require_ssl": false
28
+ ip_configuration = {
29
+ "authorized_networks" : [],
30
+ "ipv4_enabled" : true,
31
+ "private_network" : "https://www.googleapis.com/compute/v1/projects/${local.project_vars.locals.tribe_project_id}/global/networks/${local.project_vars.locals.network}",
32
+ "require_ssl" : false
28
33
  }
29
34
  ## Uncomment and apply it before destroy in case of necessary to delete the instance
30
35
  # deletion_protection = false
31
- user_labels = {
32
- cc = local.common_vars.locals.cost_center
33
- component = local.common_vars.locals.component
34
- product = local.common_vars.locals.product
35
- tenant-alias = local.common_vars.locals.tenant_alias
36
- environment = local.project_vars.locals.project_env
37
- }
36
+ user_labels = local.labels,
38
37
  }
39
38
  )
@@ -7,6 +7,12 @@ terraform {
7
7
  locals {
8
8
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
9
9
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
10
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
11
+ component = local.common_vars.locals.component
12
+ product = local.common_vars.locals.product
13
+ tenant-alias = local.common_vars.locals.tenant_alias
14
+ terraform = ""
15
+ })
10
16
  }
11
17
 
12
18
  # Include all settings from the root terragrunt.hcl file
@@ -22,20 +28,10 @@ dependency "mssql_address" {
22
28
  }
23
29
 
24
30
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
25
- inputs = merge(
26
- {
27
- project_id = local.project_vars.locals.project_id
28
-
29
- secrets = {
30
- mssql-common-address = dependency.mssql_address.outputs.private_address
31
- }
32
- labels = {
33
- terraform = ""
34
- cc = local.common_vars.locals.cost_center
35
- component = local.common_vars.locals.component
36
- product = local.common_vars.locals.product
37
- tenant-alias = local.common_vars.locals.tenant_alias
38
- environment = local.project_vars.locals.project_env
39
- }
31
+ inputs = {
32
+ project_id = local.project_vars.locals.project_id
33
+ secrets = {
34
+ mssql-common-address = dependency.mssql_address.outputs.private_address
40
35
  }
41
- )
36
+ labels = local.labels,
37
+ }
@@ -10,9 +10,15 @@ include {
10
10
  }
11
11
 
12
12
  locals {
13
- spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
14
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
15
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
13
+ spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
14
+ project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
15
+ common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
16
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
17
+ component = local.common_vars.locals.component
18
+ product = local.common_vars.locals.product
19
+ tenant-alias = local.common_vars.locals.tenant_alias
20
+ terraform = ""
21
+ })
16
22
  }
17
23
 
18
24
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
@@ -29,12 +35,6 @@ inputs = merge(
29
35
  }
30
36
  ## Uncomment and apply it before destroy in case of necessary to delete the instance
31
37
  # deletion_protection = false
32
- user_labels = {
33
- cc = local.common_vars.locals.cost_center
34
- component = local.common_vars.locals.component
35
- product = local.common_vars.locals.product
36
- tenant-alias = local.common_vars.locals.tenant_alias
37
- environment = local.project_vars.locals.project_env
38
- }
38
+ user_labels = local.labels,
39
39
  }
40
40
  )
@@ -11,6 +11,12 @@ include {
11
11
  locals {
12
12
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
13
13
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
14
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
15
+ component = local.common_vars.locals.component
16
+ product = local.common_vars.locals.product
17
+ tenant-alias = local.common_vars.locals.tenant_alias
18
+ terraform = ""
19
+ })
14
20
  }
15
21
 
16
22
  dependency "instance" {
@@ -22,20 +28,11 @@ dependency "instance" {
22
28
  }
23
29
 
24
30
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
25
- inputs = merge(
26
- {
27
- project_id = local.project_vars.locals.project_id
28
- secrets = {
29
- mysql_master_password = dependency.instance.outputs.generated_user_password
30
- mysql_private_address = dependency.instance.outputs.private_ip_address
31
- }
32
- labels = {
33
- terraform = ""
34
- cc = local.common_vars.locals.cost_center
35
- component = local.common_vars.locals.component
36
- product = local.common_vars.locals.product
37
- tenant-alias = local.common_vars.locals.tenant_alias
38
- environment = local.project_vars.locals.project_env
39
- }
31
+ inputs = {
32
+ project_id = local.project_vars.locals.project_id
33
+ secrets = {
34
+ mysql_master_password = dependency.instance.outputs.generated_user_password
35
+ mysql_private_address = dependency.instance.outputs.private_ip_address
40
36
  }
41
- )
37
+ labels = local.labels,
38
+ }
@@ -13,6 +13,11 @@ locals {
13
13
  spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
14
14
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
15
15
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
16
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
17
+ component = local.common_vars.locals.component
18
+ product = local.common_vars.locals.product
19
+ tenant-alias = local.common_vars.locals.tenant_alias
20
+ })
16
21
  }
17
22
 
18
23
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
@@ -28,12 +33,6 @@ inputs = merge(
28
33
  }
29
34
  ## Uncomment and apply it before destroy in case of necessary to delete the instance
30
35
  # deletion_protection = false
31
- user_labels = {
32
- cc = local.common_vars.locals.cost_center
33
- component = local.common_vars.locals.component
34
- product = local.common_vars.locals.product
35
- tenant-alias = local.common_vars.locals.tenant_alias
36
- environment = local.project_vars.locals.project_env
37
- }
36
+ user_labels = local.labels,
38
37
  }
39
38
  )
@@ -11,6 +11,12 @@ include {
11
11
  locals {
12
12
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
13
13
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
14
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
15
+ component = local.common_vars.locals.component
16
+ product = local.common_vars.locals.product
17
+ tenant-alias = local.common_vars.locals.tenant_alias
18
+ terraform = ""
19
+ })
14
20
  }
15
21
 
16
22
  dependency "instance" {
@@ -29,13 +35,6 @@ inputs = merge(
29
35
  postgresql_master_password = dependency.instance.outputs.generated_user_password
30
36
  postgresql_private_address = dependency.instance.outputs.private_ip_address
31
37
  }
32
- labels = {
33
- terraform = ""
34
- cc = local.common_vars.locals.cost_center
35
- component = local.common_vars.locals.component
36
- product = local.common_vars.locals.product
37
- tenant-alias = local.common_vars.locals.tenant_alias
38
- environment = local.project_vars.locals.project_env
39
- }
38
+ labels = local.labels,
40
39
  }
41
40
  )
@@ -11,19 +11,20 @@ include {
11
11
  locals {
12
12
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
13
13
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
14
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
15
+ component = local.common_vars.locals.component
16
+ product = local.common_vars.locals.product
17
+ tenant-alias = local.common_vars.locals.tenant_alias
18
+ terraform = ""
19
+ })
14
20
  }
15
21
 
16
22
  <%-dependencies%>
17
23
 
18
24
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
19
- inputs = merge(
20
- {
21
- project_id = local.project_vars.locals.project_id
22
- secrets = {<%-secrets%>
25
+ inputs = {
26
+ project_id = local.project_vars.locals.project_id
27
+ secrets = {<%-secrets%>
23
28
  }
24
- labels = {
25
- terraform = ""
26
- cc = local.common_vars.locals.cost_center
27
- }
28
- }
29
- )
29
+ labels = local.labels
30
+ }
@@ -11,19 +11,20 @@ include {
11
11
  locals {
12
12
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
13
13
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
14
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
15
+ component = local.common_vars.locals.component
16
+ product = local.common_vars.locals.product
17
+ tenant-alias = local.common_vars.locals.tenant_alias
18
+ terraform = ""
19
+ })
14
20
  }
15
21
 
16
22
  <%-dependencies%>
17
23
 
18
24
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
19
- inputs = merge(
20
- {
21
- project_id = local.project_vars.locals.project_id
22
- secrets = {<%-secrets%>
25
+ inputs = {
26
+ project_id = local.project_vars.locals.project_id
27
+ secrets = {<%-secrets%>
23
28
  }
24
- labels = {
25
- terraform = ""
26
- cc = local.common_vars.locals.cost_center
27
- }
28
- }
29
- )
29
+ labels = local.labels,
30
+ }
@@ -62,13 +62,6 @@ module.exports = class extends BaseGenerator {
62
62
  },
63
63
  );
64
64
  });
65
-
66
- ['prod', 'staging'].forEach((env) => {
67
- this.copyDir(
68
- path.join('monitoring'),
69
- path.join('infra', env, 'monitoring'),
70
- );
71
- });
72
65
  }
73
66
 
74
67
  end() {
@@ -10,9 +10,15 @@ include {
10
10
  }
11
11
 
12
12
  locals {
13
- spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
14
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
15
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
13
+ spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
14
+ project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
15
+ common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
16
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
17
+ component = local.common_vars.locals.component
18
+ product = local.common_vars.locals.product
19
+ tenant-alias = local.common_vars.locals.tenant_alias
20
+ terraform = ""
21
+ })
16
22
  }
17
23
 
18
24
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
@@ -20,13 +26,7 @@ inputs = merge(
20
26
  local.spec_vars.locals,
21
27
  local.project_vars.locals,
22
28
  {
23
- labels = {
24
- cc = local.common_vars.locals.cost_center
25
- component = local.common_vars.locals.component
26
- product = local.common_vars.locals.product
27
- tenant-alias = local.common_vars.locals.tenant_alias
28
- environment = local.project_vars.locals.project_env
29
- }
29
+ labels = local.labels
30
30
  project_id = local.project_vars.locals.project_id
31
31
  prevent_destroy = false
32
32
  }
@@ -64,13 +64,6 @@ module.exports = class extends SecretsGenerator {
64
64
  selectTier('prod', prodTier);
65
65
  selectTier('staging', stagingTier);
66
66
 
67
- ['prod', 'staging'].forEach((env) => {
68
- this.copyDir(
69
- path.join('monitoring'),
70
- path.join('infra', env, 'monitoring'),
71
- );
72
- });
73
-
74
67
  this.writeSecrets('memorystore', '', '', name === '' ? 'redis-instance' : name);
75
68
  }
76
69
  };
@@ -14,6 +14,12 @@ locals {
14
14
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
15
15
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
16
16
  service_name = basename(get_terragrunt_dir())
17
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
18
+ component = local.common_vars.locals.component
19
+ product = local.common_vars.locals.product
20
+ project = local.project_vars.locals.project_name
21
+ tenant-alias = local.common_vars.locals.tenant_alias
22
+ })
17
23
  }
18
24
 
19
25
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
@@ -24,14 +30,6 @@ inputs = merge(
24
30
  project = local.project_vars.locals.project_id
25
31
  authorized_network = "projects/${local.project_vars.locals.tribe_project_id}/global/networks/${local.project_vars.locals.network}"
26
32
  enable_apis = false
27
-
28
- labels = {
29
- project = local.project_vars.locals.project_name
30
- cc = local.common_vars.locals.cost_center
31
- component = local.common_vars.locals.component
32
- product = local.common_vars.locals.product
33
- tenant-alias = local.common_vars.locals.tenant_alias
34
- environment = local.project_vars.locals.project_env
35
- }
33
+ labels = local.labels
36
34
  }
37
35
  )
@@ -7,6 +7,12 @@ terraform {
7
7
  locals {
8
8
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
9
9
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
10
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
11
+ component = local.common_vars.locals.component
12
+ product = local.common_vars.locals.product
13
+ tenant-alias = local.common_vars.locals.tenant_alias
14
+ terraform = ""
15
+ })
10
16
  }
11
17
 
12
18
  # Include all settings from the root terragrunt.hcl file
@@ -17,19 +23,9 @@ include {
17
23
  <%-dependencies%>
18
24
 
19
25
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
20
- inputs = merge(
21
- {
22
- project_id = local.project_vars.locals.project_id
23
-
24
- secrets = {<%-secrets%>
26
+ inputs = {
27
+ project_id = local.project_vars.locals.project_id
28
+ secrets = {<%-secrets%>
25
29
  }
26
- labels = {
27
- terraform = ""
28
- cc = local.common_vars.locals.cost_center
29
- component = local.common_vars.locals.component
30
- product = local.common_vars.locals.product
31
- tenant-alias = local.common_vars.locals.tenant_alias
32
- environment = local.project_vars.locals.project_env
33
- }
34
- }
35
- )
30
+ labels = local.labels
31
+ }
@@ -1,10 +1,23 @@
1
1
  const ejs = require('ejs');
2
+ const _ = require('lodash');
3
+
4
+ function cleanAlerts(alerts) {
5
+ const copy = [...alerts];
6
+ return copy.map((obj) => {
7
+ /* eslint-disable no-param-reassign */
8
+ if (_.get(obj, 'documentation.content') === ' ') delete obj.documentation;
9
+ if (_.get(obj, 'enabled') === true) delete obj.enabled;
10
+
11
+ return obj;
12
+ });
13
+ }
2
14
 
3
15
  const handleAlerts = (alerts, templates, answers) => {
4
- const template = templates[`${answers.alertResource}`][`${answers.alert}`];
16
+ const template = templates[`${answers.alert}`];
5
17
  const newAlert = JSON.parse(ejs.render(JSON.stringify(template), answers));
6
18
 
7
19
  alerts.push(newAlert);
20
+ alerts = cleanAlerts(alerts);
8
21
  return alerts;
9
22
  };
10
23
 
@@ -12,7 +25,7 @@ const handleSlos = (slos, templates, answers) => {
12
25
  const template = templates[`${answers.sli}`];
13
26
  const newSLO = JSON.parse(ejs.render(JSON.stringify(template), answers));
14
27
 
15
- if (answers.burnRateAlert === 'no') newSLO.alert = {};
28
+ if (answers.burnRateAlert === 'no') newSLO.alert = false;
16
29
 
17
30
  slos.push(newSLO);
18
31
  return slos;
@@ -25,4 +38,9 @@ const handleUptimeChecks = (slos, templates, answers) => {
25
38
  return slos;
26
39
  };
27
40
 
28
- module.exports = { handleAlerts, handleSlos, handleUptimeChecks };
41
+ module.exports = {
42
+ handleAlerts,
43
+ handleSlos,
44
+ handleUptimeChecks,
45
+ cleanAlerts,
46
+ };