@hiiretail/gcp-infra-cli 0.95.0 → 0.95.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.
|
@@ -10,6 +10,25 @@ module.exports = class extends BaseGenerator {
|
|
|
10
10
|
name: 'monitoringNotificationChannels',
|
|
11
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
12
|
},
|
|
13
|
+
{
|
|
14
|
+
type: 'list',
|
|
15
|
+
name: 'usingGKE',
|
|
16
|
+
message: 'Is the clan using GKE?',
|
|
17
|
+
default: 'false',
|
|
18
|
+
choices: ['true', 'false'],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: 'input',
|
|
22
|
+
name: 'expectedServiceCount',
|
|
23
|
+
message: 'How many services will eventually be in use simultanously?',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'list',
|
|
27
|
+
name: 'usingInternalTraffic',
|
|
28
|
+
message: 'Is the clan using internal traffic (service to service communication)?',
|
|
29
|
+
default: 'true',
|
|
30
|
+
choices: ['true', 'false'],
|
|
31
|
+
},
|
|
13
32
|
];
|
|
14
33
|
return this.prompt(prompts).then((props) => {
|
|
15
34
|
this.answers = props;
|
|
@@ -18,6 +37,40 @@ module.exports = class extends BaseGenerator {
|
|
|
18
37
|
|
|
19
38
|
writing() {
|
|
20
39
|
const channelsArray = this.answers.monitoringNotificationChannels ? this.answers.monitoringNotificationChannels.split(',').map((channel) => channel.trim()) : [];
|
|
40
|
+
let overheadPercentage = 0.01;
|
|
41
|
+
if (this.answers.usingInternalTraffic === 'false'
|
|
42
|
+
&& this.answers.usingGKE === 'false'
|
|
43
|
+
&& this.answers.expectedServiceCount < 8) {
|
|
44
|
+
overheadPercentage = 0.01;
|
|
45
|
+
} else if (this.answers.usingInternalTraffic === 'true'
|
|
46
|
+
&& this.answers.usingGKE === 'false'
|
|
47
|
+
&& this.answers.expectedServiceCount < 8) {
|
|
48
|
+
overheadPercentage = 0.03;
|
|
49
|
+
} else if (this.answers.usingInternalTraffic === 'true'
|
|
50
|
+
&& this.answers.usingGKE === 'false'
|
|
51
|
+
&& this.answers.expectedServiceCount > 8) {
|
|
52
|
+
overheadPercentage = 0.04;
|
|
53
|
+
} else if (this.answers.usingInternalTraffic === 'true'
|
|
54
|
+
&& this.answers.usingGKE === 'true'
|
|
55
|
+
&& this.answers.expectedServiceCount < 8) {
|
|
56
|
+
overheadPercentage = 0.04;
|
|
57
|
+
} else if (this.answers.usingInternalTraffic === 'true'
|
|
58
|
+
&& this.answers.usingGKE === 'true'
|
|
59
|
+
&& this.answers.expectedServiceCount > 8) {
|
|
60
|
+
overheadPercentage = 0.05;
|
|
61
|
+
} else if (this.answers.usingInternalTraffic === 'false'
|
|
62
|
+
&& this.answers.usingGKE === 'false'
|
|
63
|
+
&& this.answers.expectedServiceCount > 8) {
|
|
64
|
+
overheadPercentage = 0.03;
|
|
65
|
+
} else if (this.answers.usingInternalTraffic === 'false'
|
|
66
|
+
&& this.answers.usingGKE === 'true'
|
|
67
|
+
&& this.answers.expectedServiceCount < 8) {
|
|
68
|
+
overheadPercentage = 0.03;
|
|
69
|
+
} else if (this.answers.usingInternalTraffic === 'false'
|
|
70
|
+
&& this.answers.usingGKE === 'true'
|
|
71
|
+
&& this.answers.expectedServiceCount > 8) {
|
|
72
|
+
overheadPercentage = 0.04;
|
|
73
|
+
}
|
|
21
74
|
|
|
22
75
|
['prod', 'staging'].forEach((env) => {
|
|
23
76
|
this.copyDir(
|
|
@@ -27,6 +80,7 @@ module.exports = class extends BaseGenerator {
|
|
|
27
80
|
...this.answers,
|
|
28
81
|
env,
|
|
29
82
|
monitoringNotificationChannels: channelsArray,
|
|
83
|
+
overheadPercentage,
|
|
30
84
|
},
|
|
31
85
|
);
|
|
32
86
|
});
|
|
@@ -15,12 +15,17 @@ locals {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
18
|
+
# The amount has a percentage added if one or more of the following is true:
|
|
19
|
+
# - Clan makes use of GKE
|
|
20
|
+
# - Clan makes use of more than 10 services
|
|
21
|
+
# - Clan makes use of service to service communication (internal traffic)
|
|
22
|
+
# where combinations make steps of 3%, 4% or 5% or 1% if none applies
|
|
18
23
|
inputs = merge(
|
|
19
24
|
{
|
|
20
25
|
projects = [local.project_vars.locals.project_id]
|
|
21
26
|
display_name = "${local.project_vars.locals.project_name}-budget"
|
|
22
27
|
billing_account = "01580F-3DD16A-C066A5"
|
|
23
|
-
amount = local.project_vars.locals.amount
|
|
28
|
+
amount = (local.project_vars.locals.amount + (local.project_vars.locals.amount * <%- overheadPercentage %>))
|
|
24
29
|
monitoring_notification_channels = <%-JSON.stringify(monitoringNotificationChannels)%>
|
|
25
30
|
disable_default_iam_recipients = true
|
|
26
31
|
alert_spent_percents = [0.8, 1.0, 1.2]
|