@hiiretail/gcp-infra-cli 0.63.0 → 0.65.1
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.
- package/generators/init/clan-infra/templates/env/secrets/terragrunt.hcl +1 -1
- package/generators/init/clan-infra/templates/infra/common.hcl +5 -1
- package/generators/resources/cloudsql/index.js +7 -0
- package/generators/resources/cloudsql/templates/monitoring/cloud-sql/terragrunt.hcl +2 -2
- package/generators/resources/cloudsql/templates/mssql/instance/spec.hcl +9 -0
- package/generators/resources/cloudsql/templates/mysql/instance/spec.hcl +10 -0
- package/generators/resources/cloudsql/templates/postgres/instance/spec.hcl +10 -0
- package/generators/resources/firestore/templates/monitoring/firestore/terragrunt.hcl +2 -2
- package/generators/resources/memorystore/templates/monitoring/memorystore/terragrunt.hcl +2 -2
- package/generators/resources/monitoring/templates/cloudfunction/terragrunt.hcl +2 -2
- package/generators/resources/monitoring/templates/cloudrun/terragrunt.hcl +2 -2
- package/generators/resources/monitoring/templates/dataflow/terragrunt.hcl +2 -2
- package/generators/resources/pubsub/index.js +2 -1
- package/generators/resources/pubsub/templates/monitoring/pubsub/terragrunt.hcl +2 -2
- package/generators/resources/pubsub/validate.js +12 -0
- package/package.json +1 -1
|
@@ -19,7 +19,7 @@ include {
|
|
|
19
19
|
inputs = merge(
|
|
20
20
|
{
|
|
21
21
|
secrets = merge(yamldecode(file("${get_terragrunt_dir()}/secrets.yaml")).secrets,
|
|
22
|
-
{ "clan_slack_channel" = local.common_vars.locals.clan_slack_channels[0] })
|
|
22
|
+
{ "clan_slack_channel" = local.common_vars.locals.clan_slack_channels[0].name })
|
|
23
23
|
project_id = local.project_vars.locals.project_id
|
|
24
24
|
labels = {
|
|
25
25
|
terraform = ""
|
|
@@ -5,7 +5,11 @@ locals {
|
|
|
5
5
|
clan_name = "<%-clan%>"
|
|
6
6
|
region = "europe-west1"
|
|
7
7
|
clan_group_email = "tribe-<%-tribe%>-<%-clan%>@extendaretail.com"
|
|
8
|
-
clan_slack_channels = [
|
|
8
|
+
clan_slack_channels = [
|
|
9
|
+
{
|
|
10
|
+
name = "#<%-tribe%>-<%-clan%>-monitor"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
9
13
|
project_id_slack_token = "tf-admin-90301274"
|
|
10
14
|
cost_center = "<%-costCenter%>"
|
|
11
15
|
}
|
|
@@ -42,6 +42,13 @@ module.exports = class extends BaseGenerator {
|
|
|
42
42
|
store: true,
|
|
43
43
|
default: 10,
|
|
44
44
|
},
|
|
45
|
+
{
|
|
46
|
+
type: 'list',
|
|
47
|
+
name: 'enableBackups',
|
|
48
|
+
message: 'Enable Databases backup?',
|
|
49
|
+
default: true,
|
|
50
|
+
choices: [true, false],
|
|
51
|
+
},
|
|
45
52
|
];
|
|
46
53
|
|
|
47
54
|
return this.prompt(prompts).then((props) => {
|
|
@@ -12,7 +12,7 @@ include {
|
|
|
12
12
|
dependency "notification_channels" {
|
|
13
13
|
config_path = "../notification-channels"
|
|
14
14
|
mock_outputs = {
|
|
15
|
-
|
|
15
|
+
notification_channels = ["dummy-channel"]
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@ locals {
|
|
|
25
25
|
inputs = merge(local.project_vars.locals, local.common_vars.locals,
|
|
26
26
|
{
|
|
27
27
|
clan_project_id = local.project_vars.locals.project_id
|
|
28
|
-
notification_channels = dependency.notification_channels.outputs.
|
|
28
|
+
notification_channels = dependency.notification_channels.outputs.notification_channels
|
|
29
29
|
cloudsql_monitoring = true
|
|
30
30
|
user_labels = {
|
|
31
31
|
cc = local.common_vars.locals.cost_center
|
|
@@ -64,4 +64,13 @@ locals {
|
|
|
64
64
|
#Type: String
|
|
65
65
|
#Default: "PD_SSD"
|
|
66
66
|
# disk_type = "PD_SSD"
|
|
67
|
+
|
|
68
|
+
#Description: The database backup configuration.
|
|
69
|
+
#Type: Map
|
|
70
|
+
backup_configuration = {
|
|
71
|
+
enabled = <%- enableBackups %>
|
|
72
|
+
binary_log_enabled = enabled
|
|
73
|
+
start_time = "04:00"
|
|
74
|
+
point_in_time_recovery_enabled = true
|
|
75
|
+
}
|
|
67
76
|
}
|
|
@@ -60,4 +60,14 @@ locals {
|
|
|
60
60
|
#Type: String
|
|
61
61
|
#Default: "PD_SSD"
|
|
62
62
|
# disk_type = "PD_SSD"
|
|
63
|
+
|
|
64
|
+
#Description: The database backup configuration.
|
|
65
|
+
#Type: Map
|
|
66
|
+
#Default: missing
|
|
67
|
+
backup_configuration = {
|
|
68
|
+
enabled = <%- enableBackups %>
|
|
69
|
+
binary_log_enabled = true
|
|
70
|
+
start_time = "04:00"
|
|
71
|
+
location = "europe-west1"
|
|
72
|
+
}
|
|
63
73
|
}
|
|
@@ -60,4 +60,14 @@ locals {
|
|
|
60
60
|
#Type: String
|
|
61
61
|
#Default: "PD_SSD"
|
|
62
62
|
# disk_type = "PD_SSD"
|
|
63
|
+
|
|
64
|
+
#Description: The database backup configuration.
|
|
65
|
+
#Type: Map
|
|
66
|
+
#Default: missing
|
|
67
|
+
backup_configuration = {
|
|
68
|
+
enabled = <%- enableBackups %>
|
|
69
|
+
start_time = "04:00"
|
|
70
|
+
location = "europe-west1"
|
|
71
|
+
point_in_time_recovery_enabled = true
|
|
72
|
+
}
|
|
63
73
|
}
|
|
@@ -12,7 +12,7 @@ include {
|
|
|
12
12
|
dependency "notification_channels" {
|
|
13
13
|
config_path = "../notification-channels"
|
|
14
14
|
mock_outputs = {
|
|
15
|
-
|
|
15
|
+
notification_channels = ["dummy-channel"]
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@ locals {
|
|
|
25
25
|
inputs = merge(local.project_vars.locals, local.common_vars.locals,
|
|
26
26
|
{
|
|
27
27
|
clan_project_id = local.project_vars.locals.project_id
|
|
28
|
-
notification_channels = dependency.notification_channels.outputs.
|
|
28
|
+
notification_channels = dependency.notification_channels.outputs.notification_channels
|
|
29
29
|
firestore_monitoring = true
|
|
30
30
|
user_labels = {
|
|
31
31
|
cc = local.common_vars.locals.cost_center
|
|
@@ -12,7 +12,7 @@ include {
|
|
|
12
12
|
dependency "notification_channels" {
|
|
13
13
|
config_path = "../notification-channels"
|
|
14
14
|
mock_outputs = {
|
|
15
|
-
|
|
15
|
+
notification_channels = ["dummy-channel"]
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@ locals {
|
|
|
25
25
|
inputs = merge(local.project_vars.locals, local.common_vars.locals,
|
|
26
26
|
{
|
|
27
27
|
clan_project_id = local.project_vars.locals.project_id
|
|
28
|
-
notification_channels = dependency.notification_channels.outputs.
|
|
28
|
+
notification_channels = dependency.notification_channels.outputs.notification_channels
|
|
29
29
|
memorystore_monitoring = true
|
|
30
30
|
user_labels = {
|
|
31
31
|
cc = local.common_vars.locals.cost_center
|
|
@@ -12,7 +12,7 @@ include {
|
|
|
12
12
|
dependency "notification_channels" {
|
|
13
13
|
config_path = "../notification-channels"
|
|
14
14
|
mock_outputs = {
|
|
15
|
-
|
|
15
|
+
notification_channels = ["dummy-channel"]
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@ locals {
|
|
|
25
25
|
inputs = merge(local.project_vars.locals, local.common_vars.locals,
|
|
26
26
|
{
|
|
27
27
|
clan_project_id = local.project_vars.locals.project_id
|
|
28
|
-
notification_channels = dependency.notification_channels.outputs.
|
|
28
|
+
notification_channels = dependency.notification_channels.outputs.notification_channels
|
|
29
29
|
cloudfunction_monitoring = true
|
|
30
30
|
user_labels = {
|
|
31
31
|
cc = local.common_vars.locals.cost_center
|
|
@@ -12,7 +12,7 @@ include {
|
|
|
12
12
|
dependency "notification_channels" {
|
|
13
13
|
config_path = "../notification-channels"
|
|
14
14
|
mock_outputs = {
|
|
15
|
-
|
|
15
|
+
notification_channels = ["dummy-channel"]
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@ locals {
|
|
|
25
25
|
inputs = merge(local.project_vars.locals, local.common_vars.locals,
|
|
26
26
|
{
|
|
27
27
|
clan_project_id = local.project_vars.locals.project_id
|
|
28
|
-
notification_channels = dependency.notification_channels.outputs.
|
|
28
|
+
notification_channels = dependency.notification_channels.outputs.notification_channels
|
|
29
29
|
cloudrun_monitoring = true
|
|
30
30
|
user_labels = {
|
|
31
31
|
cc = local.common_vars.locals.cost_center
|
|
@@ -12,7 +12,7 @@ include {
|
|
|
12
12
|
dependency "notification_channels" {
|
|
13
13
|
config_path = "../notification-channels"
|
|
14
14
|
mock_outputs = {
|
|
15
|
-
|
|
15
|
+
notification_channels = ["dummy-channel"]
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@ locals {
|
|
|
25
25
|
inputs = merge(local.project_vars.locals, local.common_vars.locals,
|
|
26
26
|
{
|
|
27
27
|
clan_project_id = local.project_vars.locals.project_id
|
|
28
|
-
notification_channels = dependency.notification_channels.outputs.
|
|
28
|
+
notification_channels = dependency.notification_channels.outputs.notification_channels
|
|
29
29
|
dataflow_monitoring = true
|
|
30
30
|
user_labels = {
|
|
31
31
|
cc = local.common_vars.locals.cost_center
|
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
validSystemName,
|
|
8
8
|
validVersion,
|
|
9
9
|
validSubscriberName,
|
|
10
|
+
checkExistingTopicPath,
|
|
10
11
|
} = require('./validate');
|
|
11
12
|
const handleSubscribers = require('./handle-subscribers');
|
|
12
13
|
const { getProjectId, getProdPushEndopint } = require('./get-gcp-projects');
|
|
@@ -117,7 +118,7 @@ module.exports = class extends BaseGenerator {
|
|
|
117
118
|
type: 'input',
|
|
118
119
|
name: 'existingTopic',
|
|
119
120
|
message: 'Please provide the name of the existing topic you want to subscribe to',
|
|
120
|
-
validate: required,
|
|
121
|
+
validate: (input) => required(input) && checkExistingTopicPath(input),
|
|
121
122
|
},
|
|
122
123
|
{
|
|
123
124
|
when: (response) => response.createResource === 'subscription' && response.pushOrPull === 'push',
|
|
@@ -12,7 +12,7 @@ include {
|
|
|
12
12
|
dependency "notification_channels" {
|
|
13
13
|
config_path = "../notification-channels"
|
|
14
14
|
mock_outputs = {
|
|
15
|
-
|
|
15
|
+
notification_channels = ["dummy-channel"]
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@ locals {
|
|
|
25
25
|
inputs = merge(local.project_vars.locals, local.common_vars.locals,
|
|
26
26
|
{
|
|
27
27
|
clan_project_id = local.project_vars.locals.project_id
|
|
28
|
-
notification_channels = dependency.notification_channels.outputs.
|
|
28
|
+
notification_channels = dependency.notification_channels.outputs.notification_channels
|
|
29
29
|
pubsub_monitoring = true
|
|
30
30
|
user_labels = {
|
|
31
31
|
cc = local.common_vars.locals.cost_center
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
1
4
|
const validSystemName = (input) => {
|
|
2
5
|
if (input.replace(/\s/g, '').length === 3) {
|
|
3
6
|
return true;
|
|
@@ -24,9 +27,18 @@ const validSubscriberName = (input) => {
|
|
|
24
27
|
return 'Not supported input for subscriber name';
|
|
25
28
|
};
|
|
26
29
|
|
|
30
|
+
const checkExistingTopicPath = (input) => {
|
|
31
|
+
const topicDirPath = path.join(process.cwd(), 'infra', 'staging', 'pubsub', input);
|
|
32
|
+
|
|
33
|
+
if (fs.existsSync(topicDirPath)) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return 'Topic does not exist. Check the spelling';
|
|
37
|
+
};
|
|
27
38
|
|
|
28
39
|
module.exports = {
|
|
29
40
|
validSystemName,
|
|
30
41
|
validVersion,
|
|
31
42
|
validSubscriberName,
|
|
43
|
+
checkExistingTopicPath,
|
|
32
44
|
};
|