@hiiretail/gcp-infra-cli 0.99.12 → 0.100.0

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.
@@ -94,7 +94,7 @@ locals {
94
94
  #Default: missing
95
95
  backup_configuration = {
96
96
  enabled = <%- enableBackups %>
97
- start_time = "04:00"
97
+ start_time = "00:00"
98
98
  location = "europe-west1"
99
99
  point_in_time_recovery_enabled = true
100
100
  }
@@ -14,6 +14,7 @@ const appendToDatabasesYaml = (databasesYamlPath, newDbEntry) => {
14
14
  name: newDbEntry.name,
15
15
  ...(newDbEntry.ddl ? { ddl: [newDbEntry.ddl] } : {}),
16
16
  ...(newDbEntry.retentionPeriod ? { version_retention_period: newDbEntry.retentionPeriod } : {}),
17
+ ...(newDbEntry.backupSchedule ? { backup_schedule: newDbEntry.backupSchedule } : {}),
17
18
  };
18
19
 
19
20
  databases.push(cleanNewDatabaseEntry);
@@ -3,7 +3,7 @@ const chalk = require('chalk');
3
3
  const fs = require('fs');
4
4
  const BaseGenerator = require('../../../src/BaseGenerator');
5
5
  const { required } = require('../../../src/validators');
6
- const { validName, validRetentionPeriod } = require('./validate');
6
+ const { validName, validRetentionPeriod, validBackupSchedule } = require('./validate');
7
7
  const appendToDatabasesYaml = require('./append');
8
8
 
9
9
  module.exports = class extends BaseGenerator {
@@ -80,6 +80,13 @@ module.exports = class extends BaseGenerator {
80
80
  message: 'Please provide version retention period. Maximum value 7d, possible values include 84000s, 1h, 2d. Leave empty for default value 1h.',
81
81
  validate: validRetentionPeriod,
82
82
  },
83
+ {
84
+ when: (response) => response.resourceType === 'database',
85
+ type: 'input',
86
+ name: 'backupSchedule',
87
+ message: 'Please provide backup schedule. Possible values are valid cron expressions like "0 2 * * *". Leave empty to add later.',
88
+ validate: validBackupSchedule,
89
+ },
83
90
  ];
84
91
 
85
92
  return this.prompt(prompts).then((props) => {
@@ -96,6 +103,7 @@ module.exports = class extends BaseGenerator {
96
103
  databaseName,
97
104
  ddl,
98
105
  retentionPeriod,
106
+ backupSchedule,
99
107
  } = this.answers;
100
108
 
101
109
  ['prod', 'staging'].forEach((env) => {
@@ -118,6 +126,7 @@ module.exports = class extends BaseGenerator {
118
126
  databaseName,
119
127
  ddl,
120
128
  retentionPeriod,
129
+ backupSchedule,
121
130
  },
122
131
  );
123
132
  });
@@ -133,6 +142,7 @@ module.exports = class extends BaseGenerator {
133
142
  databaseName,
134
143
  ddl,
135
144
  retentionPeriod,
145
+ backupSchedule,
136
146
  },
137
147
  );
138
148
  });
@@ -143,6 +153,7 @@ module.exports = class extends BaseGenerator {
143
153
  name: databaseName,
144
154
  ddl,
145
155
  retentionPeriod,
156
+ backupSchedule,
146
157
  };
147
158
  appendToDatabasesYaml(databasesYamlPath, newDatabaseEntry);
148
159
  }
@@ -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-spanner//?ref=v0.1.5"
4
+ source = "git::https://github.com/extenda/tf-module-gcp-spanner//?ref=v1.0.0"
5
5
  }
6
6
 
7
7
  # Include all settings from the root terragrunt.hcl file
@@ -18,7 +18,21 @@ const validRetentionPeriod = (input) => {
18
18
  return 'Invalid retention period format. Possible values are 84000s, 1h, 2d, or leave empty for default value 1h';
19
19
  };
20
20
 
21
+ const validBackupSchedule = (input) => {
22
+ const validFormats = /^(((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5}$/;
23
+
24
+ if (input === '') {
25
+ return true;
26
+ }
27
+ if (validFormats.test(input)) {
28
+ return true;
29
+ }
30
+
31
+ return 'Invalid backup schedule format. Possible values are cron expressions like "0 2 * * *"';
32
+ };
33
+
21
34
  module.exports = {
22
35
  validName,
23
36
  validRetentionPeriod,
37
+ validBackupSchedule,
24
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiiretail/gcp-infra-cli",
3
- "version": "0.99.12",
3
+ "version": "0.100.0",
4
4
  "description": "Infrastructure as code generator for GCP.",
5
5
  "main": "src/cli.js",
6
6
  "bin": {