@hiiretail/gcp-infra-cli 0.93.1 → 0.94.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.
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const chalk = require('chalk');
|
|
3
|
+
const BaseGenerator = require('../../../src/BaseGenerator');
|
|
4
|
+
|
|
5
|
+
module.exports = class extends BaseGenerator {
|
|
6
|
+
prompting() {
|
|
7
|
+
const prompts = [
|
|
8
|
+
{
|
|
9
|
+
type: 'input',
|
|
10
|
+
name: 'monitoringNotificationChannels',
|
|
11
|
+
message: 'Enter a comma-separated list of monitoring notification channels (format: projects/{project_id}/notificationChannels/{channel_id}). At least one email address must be included. Up to 5 channels are permitted.',
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
return this.prompt(prompts).then((props) => {
|
|
15
|
+
this.answers = props;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
writing() {
|
|
20
|
+
const channelsArray = this.answers.monitoringNotificationChannels ? this.answers.monitoringNotificationChannels.split(',').map((channel) => channel.trim()) : [];
|
|
21
|
+
|
|
22
|
+
['prod', 'staging'].forEach((env) => {
|
|
23
|
+
this.copyDir(
|
|
24
|
+
'budget',
|
|
25
|
+
path.join('infra', env, 'budget'),
|
|
26
|
+
{
|
|
27
|
+
...this.answers,
|
|
28
|
+
env,
|
|
29
|
+
monitoringNotificationChannels: channelsArray,
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
end() {
|
|
36
|
+
this.log(`
|
|
37
|
+
${chalk.green('Your budget has been created.')}
|
|
38
|
+
${chalk.green('1.')} To finalize your configuration, please continue with manual editing of the generated files.
|
|
39
|
+
${chalk.green('2.')} Push the changes in a feature branch and open a pull request.
|
|
40
|
+
`);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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/terraform-google-project-factory//modules/budget?ref=feat/CNP-25"
|
|
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(
|
|
19
|
+
{
|
|
20
|
+
projects = [local.project_vars.locals.project_id]
|
|
21
|
+
display_name = "${local.project_vars.locals.project_name}-budget"
|
|
22
|
+
billing_account = "01580F-3DD16A-C066A5"
|
|
23
|
+
amount = local.project_vars.locals.amount
|
|
24
|
+
monitoring_notification_channels = <%-JSON.stringify(monitoringNotificationChannels)%>
|
|
25
|
+
disable_default_iam_recipients = true
|
|
26
|
+
alert_spent_percents = [0.8, 1.0, 1.2]
|
|
27
|
+
}
|
|
28
|
+
)
|