@hiiretail/gcp-infra-cli 0.83.1 → 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 (44) hide show
  1. package/generators/docs/rca/templates/docs/rca.md +20 -17
  2. package/generators/init/clan-infra/index.js +5 -11
  3. package/generators/init/clan-infra/templates/env/project.hcl +4 -1
  4. package/generators/init/clan-infra/templates/env/secrets/terragrunt.hcl +10 -8
  5. package/generators/init/clan-infra/templates/infra/common.hcl +20 -15
  6. package/generators/init/clan-infra/templates/notification-channels/notification-channels.yaml +7 -0
  7. package/generators/init/clan-infra/templates/notification-channels/terragrunt.hcl +13 -6
  8. package/generators/resources/cloud-storage/templates/cloud-storage/terragrunt.hcl +7 -8
  9. package/generators/resources/cloudsql/index.js +0 -8
  10. package/generators/resources/cloudsql/templates/mssql/instance/terragrunt.hcl +11 -12
  11. package/generators/resources/cloudsql/templates/mssql/instance-secrets/terragrunt.hcl +12 -16
  12. package/generators/resources/cloudsql/templates/mysql/instance/terragrunt.hcl +10 -10
  13. package/generators/resources/cloudsql/templates/mysql/instance-secrets/terragrunt.hcl +13 -16
  14. package/generators/resources/cloudsql/templates/postgres/instance/terragrunt.hcl +6 -7
  15. package/generators/resources/cloudsql/templates/postgres/instance-secrets/terragrunt.hcl +7 -8
  16. package/generators/resources/cloudsql-database/templates/mysql/secrets/terragrunt.hcl +11 -10
  17. package/generators/resources/cloudsql-database/templates/postgres/secrets/terragrunt.hcl +11 -10
  18. package/generators/resources/firestore/index.js +0 -7
  19. package/generators/resources/kms/templates/kms/terragrunt.hcl +10 -10
  20. package/generators/resources/memorystore/index.js +0 -7
  21. package/generators/resources/memorystore/templates/redis-instance/terragrunt.hcl +7 -9
  22. package/generators/resources/memorystore/templates/secrets/terragrunt.hcl +11 -15
  23. package/generators/resources/monitoring/handle-yaml.js +21 -3
  24. package/generators/resources/monitoring/index.js +12 -30
  25. package/generators/resources/monitoring/templates/alerts/{alerts.yaml → generic-infra.yaml} +0 -18
  26. package/generators/resources/monitoring/templates/alerts/service.yaml +16 -0
  27. package/generators/resources/monitoring/templates/alerts/terragrunt.hcl +13 -14
  28. package/generators/resources/monitoring/templates/slos/slos.yaml +3 -3
  29. package/generators/resources/monitoring/templates/slos/terragrunt.hcl +19 -18
  30. package/generators/resources/monitoring/templates/uptime-checks/terragrunt.hcl +15 -18
  31. package/generators/resources/pubsub/index.js +0 -7
  32. package/generators/resources/pubsub/templates/pubsub/terragrunt.hcl +7 -14
  33. package/generators/resources/pubsub/templates/pubsub-dlq/terragrunt.hcl +25 -32
  34. package/generators/resources/spanner/templates/spanner/terragrunt.hcl +16 -17
  35. package/package.json +1 -1
  36. package/generators/resources/cloudsql/templates/monitoring/cloud-sql/terragrunt.hcl +0 -34
  37. package/generators/resources/cloudsql/templates/monitoring/notification-channels/terragrunt.hcl +0 -22
  38. package/generators/resources/firestore/templates/monitoring/firestore/terragrunt.hcl +0 -34
  39. package/generators/resources/firestore/templates/monitoring/notification-channels/terragrunt.hcl +0 -22
  40. package/generators/resources/memorystore/templates/monitoring/memorystore/terragrunt.hcl +0 -34
  41. package/generators/resources/memorystore/templates/monitoring/notification-channels/terragrunt.hcl +0 -22
  42. package/generators/resources/monitoring/templates/notification-channels/terragrunt.hcl +0 -22
  43. package/generators/resources/pubsub/templates/monitoring/notification-channels/terragrunt.hcl +0 -22
  44. package/generators/resources/pubsub/templates/monitoring/pubsub/terragrunt.hcl +0 -34
@@ -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
+ };
@@ -6,14 +6,10 @@ const BaseGenerator = require('../../../src/BaseGenerator');
6
6
  const { required } = require('../../../src/validators');
7
7
  const validate = require('./validate');
8
8
  const { handleSlos, handleAlerts, handleUptimeChecks } = require('./handle-yaml');
9
- const { getProjectId } = require('../pubsub/get-gcp-projects');
10
- const getTribeAndClanName = require('../../init/clan-infra/tribe-clan-repo');
11
9
 
12
10
  const uptimeCheckTemplates = yaml.load(fs.readFileSync(`${__dirname}/templates/uptime-checks/uptime-checks.yaml`));
13
- const alertTemplates = yaml.load(fs.readFileSync(`${__dirname}/templates/alerts/alerts.yaml`));
11
+ const alertTemplates = yaml.load(fs.readFileSync(`${__dirname}/templates/alerts/service.yaml`));
14
12
  const sloTemplates = yaml.load(fs.readFileSync(`${__dirname}/templates/slos/slos.yaml`));
15
- const { clan: defaultClan } = getTribeAndClanName();
16
- const projectId = getProjectId('prod');
17
13
 
18
14
  module.exports = class extends BaseGenerator {
19
15
  async prompting() {
@@ -24,27 +20,21 @@ module.exports = class extends BaseGenerator {
24
20
  message: 'Select the resource you want to create',
25
21
  choices: ['alerts', 'uptime-checks', 'slos'],
26
22
  },
27
- {
28
- when: (response) => response.monitoringResource === 'alerts',
29
- type: 'list',
30
- name: 'alertResource',
31
- choices: Object.keys(alertTemplates),
32
- },
33
23
  {
34
24
  when: (response) => response.monitoringResource === 'alerts',
35
25
  type: 'list',
36
26
  name: 'alert',
37
- choices: (answers) => Object.keys(alertTemplates[`${answers.alertResource}`]),
27
+ choices: Object.keys(alertTemplates),
38
28
  },
39
29
  {
40
- when: (response) => ['slos', 'uptime-checks'].includes(response.monitoringResource) || response.alertResource === 'cloud_run',
30
+ when: (response) => ['slos', 'uptime-checks', 'alerts'].includes(response.monitoringResource),
41
31
  type: 'input',
42
32
  name: 'systemName',
43
33
  message: 'Please provide three-letter system name as defined in Styra (example: sre, ptf, sda, che, pnp, iam...)',
44
34
  validate: required && validate.systemName,
45
35
  },
46
36
  {
47
- when: (response) => ['slos', 'uptime-checks'].includes(response.monitoringResource) || response.alertResource === 'cloud_run',
37
+ when: (response) => ['slos', 'uptime-checks', 'alerts'].includes(response.monitoringResource),
48
38
  type: 'input',
49
39
  name: 'serviceName',
50
40
  message: 'Please provide the namespace where the service resides',
@@ -57,13 +47,6 @@ module.exports = class extends BaseGenerator {
57
47
  message: 'Please provide the full URL to your runbook in confluence (Leave empty if none)',
58
48
  validate: required && validate.confluenceUrl,
59
49
  },
60
- {
61
- when: (response) => response.monitoringResource === 'alerts',
62
- type: 'list',
63
- name: 'projectId',
64
- message: 'Please select clan project id',
65
- choices: [`${projectId}`],
66
- },
67
50
  {
68
51
  when: (response) => response.monitoringResource === 'uptime-checks',
69
52
  type: 'input',
@@ -120,13 +103,13 @@ module.exports = class extends BaseGenerator {
120
103
  }
121
104
  };
122
105
 
123
- if (monitoringResource === 'uptime-checks') {
124
- const yamlPath = `${resourceDir}/uptime-checks.yaml`;
106
+ if (monitoringResource === 'alerts') {
107
+ const yamlPath = `${resourceDir}/${serviceName}.yaml`;
125
108
 
126
- copyTemplate('uptime-checks', resourceDir, yamlPath);
109
+ copyTemplate('alerts', resourceDir, yamlPath);
127
110
 
128
111
  const oldYaml = yaml.load(fs.readFileSync(yamlPath, 'utf8')) || [];
129
- const newYaml = await handleUptimeChecks(oldYaml, uptimeCheckTemplates, this.answers);
112
+ const newYaml = await handleAlerts(oldYaml, alertTemplates, this.answers);
130
113
 
131
114
  fs.writeFileSync(yamlPath, yaml.dump(newYaml, { lineWidth: 250, noArrayIndent: true }));
132
115
  }
@@ -144,14 +127,13 @@ module.exports = class extends BaseGenerator {
144
127
  fs.writeFileSync(yamlPath, yaml.dump(newYaml, { lineWidth: 250, noArrayIndent: true }));
145
128
  }
146
129
 
147
- if (monitoringResource === 'alerts') {
148
- const yamlPath = `${resourceDir}/alerts.yaml`;
130
+ if (monitoringResource === 'uptime-checks') {
131
+ const yamlPath = `${resourceDir}/uptime-checks.yaml`;
149
132
 
150
- copyTemplate('alerts', resourceDir, yamlPath);
133
+ copyTemplate('uptime-checks', resourceDir, yamlPath);
151
134
 
152
135
  const oldYaml = yaml.load(fs.readFileSync(yamlPath, 'utf8')) || [];
153
- const newYaml = await handleAlerts(oldYaml, alertTemplates,
154
- { ...this.answers, clan: defaultClan });
136
+ const newYaml = await handleUptimeChecks(oldYaml, uptimeCheckTemplates, this.answers);
155
137
 
156
138
  fs.writeFileSync(yamlPath, yaml.dump(newYaml, { lineWidth: 250, noArrayIndent: true }));
157
139
  }
@@ -1,21 +1,3 @@
1
- cloud_run:
2
- request_latency:
3
- display_name: "[P3] <%-systemName%>.<%-serviceName%> | High Request Latency"
4
- conditions:
5
- - display_name: Cloud Run Anthos - Response Time (95%) above 1s for 5 min
6
- condition_threshold:
7
- filter: |
8
- resource.type="knative_revision"
9
- resource.labels.service_name="<%-serviceName%>"
10
- metric.type="knative.dev/serving/revision/request_latencies"
11
- resource.labels.project_id="<%-projectId%>"
12
- threshold_value: 1000
13
- duration: 300s
14
- aggregations:
15
- - alignment_period: 60s
16
- per_series_aligner: ALIGN_PERCENTILE_95
17
- documentation:
18
- content: <% if (runbookLink) { %>[Runbook](<%-runbookLink%>)<%} else { %> <% } %>
19
1
  cloud_scheduler:
20
2
  failed_job:
21
3
  display_name: "[P4] <%-clan%> - Cloud Scheduler | Job Failed"
@@ -0,0 +1,16 @@
1
+ request_latency:
2
+ display_name: "[P3] <%-systemName%>.<%-serviceName%> | High Request Latency"
3
+ conditions:
4
+ - display_name: Cloud Run Anthos - Response Time (95%) above 1s for 5 min
5
+ condition_threshold:
6
+ filter: |
7
+ resource.type="knative_revision"
8
+ metric.type="knative.dev/serving/revision/request_latencies"
9
+ resource.labels.service_name="<%-serviceName%>"
10
+ threshold_value: 1000
11
+ duration: 300s
12
+ aggregations:
13
+ - alignment_period: 60s
14
+ per_series_aligner: ALIGN_PERCENTILE_95
15
+ documentation:
16
+ content: <% if (runbookLink) { %>[Runbook](<%-runbookLink%>)<%} else { %> <% } %>
@@ -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-alert-policy//?ref=v0.1.1"
4
+ source = "git::https://github.com/extenda/tf-module-gcp-alert-policy//?ref=v1.1.1"
5
5
  }
6
6
 
7
7
  # Include all settings from the root terragrunt.hcl file
@@ -10,7 +10,7 @@ include {
10
10
  }
11
11
 
12
12
  dependency "notification_channels" {
13
- config_path = "../notification-channels"
13
+ config_path = "../notification-channels"
14
14
  mock_outputs = {
15
15
  notification_channels = ["dummy-channel"]
16
16
  }
@@ -19,20 +19,19 @@ dependency "notification_channels" {
19
19
  locals {
20
20
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
21
21
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
22
+ alerts = flatten([for file in fileset(get_terragrunt_dir(), "./*.yaml") : yamldecode(file(file))])
23
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
24
+ component = local.common_vars.locals.component
25
+ product = local.common_vars.locals.product
26
+ tenant-alias = local.common_vars.locals.tenant_alias
27
+ })
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
31
  inputs = {
26
- monitoring_project_id = lookup(local.project_vars.locals, "monitoring_project_id", local.project_vars.locals.tribe_project_id),
27
- notification_channels = dependency.notification_channels.outputs.notification_channels,
28
- policies = yamldecode(file("${get_terragrunt_dir()}/alerts.yaml")),
29
- user_labels = {
30
- cc = local.common_vars.locals.cost_center
31
- clan = local.common_vars.locals.clan_name
32
- jira_project_key = lookup(local.common_vars.locals, "jira_project_key", null)
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
- },
32
+ project = local.project_vars.locals.tribe_project_id,
33
+ policies = local.alerts,
34
+ notification_channel_ids = dependency.notification_channels.outputs.notification_channels,
35
+ fallback_notification_channels = dependency.notification_channels.outputs.fallback_channels_ids,
36
+ default_user_labels = local.labels,
38
37
  }
@@ -1,7 +1,7 @@
1
1
  availability:
2
2
  display_name: Month - Availability
3
3
  slo_id: month-availability
4
- goal: 0.999
4
+ goal: 0.998
5
5
  calendar_period: MONTH
6
6
  type: windows_based_sli
7
7
  method: boolean_filter
@@ -13,7 +13,7 @@ availability:
13
13
  error-rate:
14
14
  display_name: Month - Error rate
15
15
  slo_id: month-error-rate
16
- goal: 0.999
16
+ goal: 0.998
17
17
  calendar_period: MONTH
18
18
  type: request_based_sli
19
19
  method: good_total_ratio
@@ -34,7 +34,7 @@ latency:
34
34
  type: request_based_sli
35
35
  method: distribution_cut
36
36
  range_min: 0
37
- range_max: 100
37
+ range_max: 500
38
38
  metric_filter: |
39
39
  metric.type="knative.dev/serving/revision/request_latencies"
40
40
  resource.type="knative_revision"
@@ -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-slo//?ref=v0.1.0"
4
+ source = "git::https://github.com/extenda/tf-module-gcp-slo//?ref=v1.0.1"
5
5
  }
6
6
 
7
7
  # Include all settings from the root terragrunt.hcl file
@@ -10,7 +10,7 @@ include {
10
10
  }
11
11
 
12
12
  dependency "notification_channels" {
13
- config_path = "../../notification-channels"
13
+ config_path = "../../notification-channels"
14
14
  mock_outputs = {
15
15
  notification_channels = ["dummy-channel"]
16
16
  }
@@ -19,22 +19,23 @@ dependency "notification_channels" {
19
19
  locals {
20
20
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
21
21
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
22
+ service_name = basename(get_terragrunt_dir())
23
+ system_name = "<%-systemName%>"
24
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
25
+ component = local.common_vars.locals.component
26
+ product = local.common_vars.locals.product
27
+ tenant-alias = local.common_vars.locals.tenant_alias
28
+ })
22
29
  }
23
30
 
24
31
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
25
- inputs = merge(
26
- local.project_vars.locals,
27
- {
28
- service_name = "<%-systemName%>.<%-serviceName%>"
29
- monitoring_project_id = lookup(local.project_vars.locals, "monitoring_project_id", local.project_vars.locals.tribe_project_id),
30
- notification_channels = dependency.notification_channels.outputs.notification_channels,
31
- telemetry_resource_name = "//container.googleapis.com/projects/${lookup(local.project_vars.locals, "monitoring_project_id", local.project_vars.locals.tribe_project_id)}/locations/europe-west1/clusters/k8s-cluster/k8s/namespaces/<%-serviceName%>"
32
- slos = yamldecode(file("${get_terragrunt_dir()}/slos.yaml")),
33
- documentation = "[Alerting guidelines](https://confluence.extendaretail.com/x/71fhBg)"
34
- user_labels = {
35
- cc = local.common_vars.locals.cost_center
36
- clan = local.common_vars.locals.clan_name
37
- jira_project_key = lookup(local.common_vars.locals, "jira_project_key", null)
38
- },
39
- }
40
- )
32
+ inputs = {
33
+ service_name = "${local.system_name}.${local.service_name}"
34
+ project = local.project_vars.locals.tribe_project_id,
35
+ slos = yamldecode(file("${get_terragrunt_dir()}/slos.yaml"))
36
+ telemetry_resource_name = "//container.googleapis.com/projects/${local.project_vars.locals.tribe_project_id}/locations/europe-west1/clusters/k8s-cluster/k8s/namespaces/${local.service_name}"
37
+ notification_channel_ids = dependency.notification_channels.outputs.notification_channels,
38
+ fallback_notification_channels = dependency.notification_channels.outputs.fallback_channels_ids,
39
+ default_user_labels = local.labels,
40
+ documentation = "[Alerting guidelines](https://confluence.extendaretail.com/x/71fhBg)"
41
+ }
@@ -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-uptime-check//?ref=v0.1.3"
4
+ source = "git::https://github.com/extenda/tf-module-gcp-uptime-check//?ref=v1.0.1"
5
5
  }
6
6
 
7
7
  # Include all settings from the root terragrunt.hcl file
@@ -10,7 +10,7 @@ include {
10
10
  }
11
11
 
12
12
  dependency "notification_channels" {
13
- config_path = "../notification-channels"
13
+ config_path = "../notification-channels"
14
14
  mock_outputs = {
15
15
  notification_channels = ["dummy-channel"]
16
16
  }
@@ -19,22 +19,19 @@ dependency "notification_channels" {
19
19
  locals {
20
20
  project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
21
21
  common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
22
+ labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
23
+ component = local.common_vars.locals.component
24
+ product = local.common_vars.locals.product
25
+ tenant-alias = local.common_vars.locals.tenant_alias
26
+ })
22
27
  }
23
28
 
24
29
  # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
25
- inputs = merge({
26
- project_id = local.project_vars.locals.project_id,
27
- project_id_alert = local.project_vars.locals.tribe_project_id,
28
- notification_channels = dependency.notification_channels.outputs.notification_channels,
29
- uptime_checks = yamldecode(file("${get_terragrunt_dir()}/uptime-checks.yaml")),
30
- labels = {
31
- cc = local.common_vars.locals.cost_center
32
- clan = local.common_vars.locals.clan_name
33
- jira_project_key = lookup(local.common_vars.locals, "jira_project_key", null)
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
- }
39
- }
40
- )
30
+ inputs = {
31
+ project = local.project_vars.locals.project_id,
32
+ default_alert_project = local.project_vars.locals.tribe_project_id,
33
+ uptime_checks = yamldecode(file("${get_terragrunt_dir()}/uptime-checks.yaml"))
34
+ notification_channel_ids = dependency.notification_channels.outputs.notification_channels,
35
+ fallback_notification_channels = dependency.notification_channels.outputs.fallback_channels_ids,
36
+ default_user_labels = local.labels
37
+ }
@@ -303,13 +303,6 @@ module.exports = class extends BaseGenerator {
303
303
  );
304
304
  }
305
305
  });
306
-
307
- ['prod', 'staging'].forEach((env) => {
308
- this.copyDir(
309
- path.join('monitoring'),
310
- path.join('infra', env, 'monitoring'),
311
- );
312
- });
313
306
  }
314
307
 
315
308
  end() {
@@ -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
@@ -22,20 +27,8 @@ inputs = merge(<% if (createResource == 'topic') { %><% } else { %>
22
27
  local.spec_vars.locals,
23
28
  local.project_vars.locals,
24
29
  {
25
- topic_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
- }<% if (createResource == 'topic') { %><% } else { %>
32
- subscription_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
- }<% } %>
30
+ topic_labels = local.labels<% if (createResource == 'topic') { %><% } else { %>
31
+ subscription_labels = local.labels<% } %>
39
32
  grant_token_creator = false
40
33
  }
41
34
  )
@@ -12,39 +12,32 @@ 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 (
19
- local.project_vars.locals,
20
- {
21
- topic = "dlq.${local.common_vars.locals.clan_name}.common"
22
- create_subscriptions = true
23
- create_topic = true
24
- push_subscriptions = [
25
- {
26
- name = "dlq.${local.common_vars.locals.clan_name}.common+dlq.message-handler",
27
- push_endpoint = "https://europe-west1-sre-prod-5462.cloudfunctions.net/dlq-message-handler",
28
- audience = "https://europe-west1-sre-prod-5462.cloudfunctions.net/dlq-message-handler",
29
- expiration_policy = "",
30
- oidc_service_account_email = "pubsub-dlq-handler@${local.project_vars.locals.project_id}.iam.gserviceaccount.com",
31
- filter = "attributes.Consumer = \"dlq.${local.common_vars.locals.clan_name}.common+dlq.message-handler OR NOT attributes:Consumer\"",
32
- },
33
- ],
34
- topic_labels = {
35
- cc = local.common_vars.locals.cost_center
36
- component = local.common_vars.locals.component
37
- product = local.common_vars.locals.product
38
- tenant-alias = local.common_vars.locals.tenant_alias
39
- environment = local.project_vars.locals.project_env
40
- }
41
- subscription_labels = {
42
- cc = local.common_vars.locals.cost_center
43
- component = local.common_vars.locals.component
44
- product = local.common_vars.locals.product
45
- tenant-alias = local.common_vars.locals.tenant_alias
46
- environment = local.project_vars.locals.project_env
47
- }
48
- grant_token_creator = false,
49
- }
23
+ inputs = merge(
24
+ local.project_vars.locals,
25
+ {
26
+ topic = "dlq.${local.common_vars.locals.clan_name}.common"
27
+ create_subscriptions = true
28
+ create_topic = true
29
+ push_subscriptions = [
30
+ {
31
+ name = "dlq.${local.common_vars.locals.clan_name}.common+dlq.message-handler",
32
+ push_endpoint = "https://europe-west1-sre-prod-5462.cloudfunctions.net/dlq-message-handler",
33
+ audience = "https://europe-west1-sre-prod-5462.cloudfunctions.net/dlq-message-handler",
34
+ expiration_policy = "",
35
+ oidc_service_account_email = "pubsub-dlq-handler@${local.project_vars.locals.project_id}.iam.gserviceaccount.com",
36
+ filter = "attributes.Consumer = \"dlq.${local.common_vars.locals.clan_name}.common+dlq.message-handler OR NOT attributes:Consumer\"",
37
+ },
38
+ ],
39
+ topic_labels = local.labels,
40
+ subscription_labels = local.labels,
41
+ grant_token_creator = false,
42
+ }
50
43
  )
@@ -10,25 +10,24 @@ 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
+ created = "terraform"
19
+ product = local.common_vars.locals.product
20
+ tenant-alias = local.common_vars.locals.tenant_alias
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
19
25
  inputs = merge(
20
- yamldecode(
21
- file("${get_terragrunt_dir()}/databases.yaml")),
22
- local.spec_vars.locals,
23
- local.project_vars.locals,
24
- {
25
- instance_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
- "created" = "terraform"
32
- }
33
- }
26
+ yamldecode(
27
+ file("${get_terragrunt_dir()}/databases.yaml")),
28
+ local.spec_vars.locals,
29
+ local.project_vars.locals,
30
+ {
31
+ instance_labels = local.labels
32
+ }
34
33
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiiretail/gcp-infra-cli",
3
- "version": "0.83.1",
3
+ "version": "0.83.3",
4
4
  "description": "Infrastructure as code generator for GCP.",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
@@ -1,34 +0,0 @@
1
- # Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
2
- # working directory, into a temporary folder, and execute your Terraform commands in that folder.
3
- terraform {
4
- source = "git::https://github.com/extenda/tf-module-gcp-monitoring//?ref=v0.1.6"
5
- }
6
-
7
- # Include all settings from the root terragrunt.hcl file
8
- include {
9
- path = find_in_parent_folders("terragrunt_root.hcl")
10
- }
11
-
12
- dependency "notification_channels" {
13
- config_path = "../notification-channels"
14
- mock_outputs = {
15
- notification_channels = ["dummy-channel"]
16
- }
17
- }
18
-
19
- locals {
20
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
21
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
22
- }
23
-
24
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
25
- inputs = merge(local.project_vars.locals, local.common_vars.locals,
26
- {
27
- clan_project_id = local.project_vars.locals.project_id
28
- notification_channels = dependency.notification_channels.outputs.notification_channels
29
- cloudsql_monitoring = true
30
- user_labels = {
31
- cc = local.common_vars.locals.cost_center
32
- }
33
- }
34
- )
@@ -1,22 +0,0 @@
1
- # Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
2
- # working directory, into a temporary folder, and execute your Terraform commands in that folder.
3
- terraform {
4
- source = "git::https://github.com/extenda/tf-module-gcp-notification-channels//?ref=v0.1.1"
5
- }
6
-
7
- # Include all settings from the root terragrunt.hcl file
8
- include {
9
- path = find_in_parent_folders("terragrunt_root.hcl")
10
- }
11
-
12
- locals {
13
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
14
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
15
- }
16
-
17
- # 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
- )