@hiiretail/gcp-infra-cli 0.76.3 → 0.77.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.
@@ -51,7 +51,7 @@ module.exports = class extends BaseGenerator {
51
51
  type: 'input',
52
52
  name: 'runbookLink',
53
53
  message: 'Please provide the full URL to your runbook in confluence (Leave empty if none)',
54
- validate: required && validate.url,
54
+ validate: required && validate.confluenceUrl,
55
55
  },
56
56
  {
57
57
  when: (response) => response.alertResource === 'cloud_scheduler',
@@ -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.0"
4
+ source = "git::https://github.com/extenda/tf-module-gcp-alert-policy//?ref=v0.1.1"
5
5
  }
6
6
 
7
7
  # Include all settings from the root terragrunt.hcl file
@@ -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.0"
4
+ source = "git::https://github.com/extenda/tf-module-gcp-uptime-check//?ref=v0.1.1"
5
5
  }
6
6
 
7
7
  # Include all settings from the root terragrunt.hcl file
@@ -2,9 +2,16 @@ const validate = {};
2
2
 
3
3
  const hasWhitespace = (str) => /\s/.test(str);
4
4
 
5
+ const isUrl = (str) => {
6
+ try {
7
+ return Boolean(new URL(str));
8
+ } catch (error) {
9
+ return false;
10
+ }
11
+ };
12
+
5
13
  validate.hostName = (input) => {
6
- const regex = new RegExp(/^(?:[a-z-]+\.){1,3}[a-z-]+$/g);
7
- if (input.match(regex)) return true;
14
+ if (input.split('.').at(-1) === 'com' && !hasWhitespace(input)) return true;
8
15
  return 'Hostname must not include path to the page to run the check against or spaces';
9
16
  };
10
17
 
@@ -13,10 +20,8 @@ validate.systemName = (input) => {
13
20
  return 'System name must be 3 characters';
14
21
  };
15
22
 
16
- validate.url = (input) => {
17
- // eslint-disable-next-line no-useless-escape
18
- const regex = new RegExp(/^https:\/\/[a-zA-Z]*.[a-zA-Z]*.[a-zA-Z]*\/[a-zA-Z\/+_-]*.$/g);
19
- if ((regex.test(input) && !hasWhitespace(input)) || input === '') return true;
23
+ validate.confluenceUrl = (input) => {
24
+ if (input === '' || (isUrl(input) && !hasWhitespace(input))) return true;
20
25
  return 'You must enter a valid URL';
21
26
  };
22
27
 
@@ -200,7 +200,7 @@ module.exports = class extends BaseGenerator {
200
200
  });
201
201
  }
202
202
 
203
- const projectId = getProjectId(env);
203
+ let projectId = getProjectId(env);
204
204
  let oidcEmail = `${oidcName}@${projectId}.iam.gserviceaccount.com`;
205
205
  let pushEndpoint = '';
206
206
  if (env === 'prod' && pushOrPull === 'push') {
@@ -245,8 +245,8 @@ module.exports = class extends BaseGenerator {
245
245
  await handleSubscribers(env, this.answers, oidcEmail, pushEndpoint, `${subscriptionDirPath}/subscribers.yaml`, dlqTopic);
246
246
  }
247
247
  if (createResource === 'subscription' && externalSub === 'yes') {
248
- const externalDirPath = path.join(process.cwd(), 'infra', env, 'pubsub', existingTopic, clanName);
249
-
248
+ const externalDirPath = path.join(process.cwd(), 'infra', 'prod', 'pubsub', existingTopic, `${clanName}-${env}`);
249
+ projectId = getProjectId('prod');
250
250
  if (!fs.existsSync(externalDirPath)) {
251
251
  fs.mkdirSync(externalDirPath);
252
252
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiiretail/gcp-infra-cli",
3
- "version": "0.76.3",
3
+ "version": "0.77.1",
4
4
  "description": "Infrastructure as code generator for GCP.",
5
5
  "main": "src/cli.js",
6
6
  "bin": {