@hiiretail/gcp-infra-cli 0.87.4 → 0.88.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.
- package/generators/clan-resources/clan-project/generator.json +4 -0
- package/generators/clan-resources/clan-project/index.js +135 -0
- package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/cloud-nat/terragrunt.hcl +9 -3
- package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/cloud-nat-static-ip/terragrunt.hcl +2 -2
- package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/cloud-router/terragrunt.hcl +7 -4
- package/generators/clan-resources/clan-project/templates/clan-resources/gke/gke-resources/terragrunt.hcl +40 -0
- package/generators/clan-resources/clan-project/templates/clan-resources/gke/spec.hcl +18 -0
- package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/gke/terragrunt.hcl +12 -7
- package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/network/firewall-rules/config/main.tf +13 -0
- package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/config/vars.tf +9 -0
- package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/network/firewall-rules/terragrunt.hcl +3 -3
- package/generators/clan-resources/clan-project/templates/clan-resources/network/spec.hcl +46 -0
- package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/network/terragrunt.hcl +2 -2
- package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/private-vpc-connection/config/main.tf +2 -1
- package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/private-vpc-connection/terragrunt.hcl +3 -3
- package/generators/clan-resources/clan-project/templates/clan-resources/serverless-vpc-connector/terragrunt.hcl +40 -0
- package/generators/{tribe-resources → clan-resources}/command.json +1 -1
- package/generators/{resources → common-resources}/command.json +1 -1
- package/generators/{resources → common-resources}/spanner/index.js +2 -8
- package/generators/common-resources/spanner/validate.js +24 -0
- package/generators/organization/clan-project/index.js +6 -0
- package/generators/organization/clan-project/templates/clan/clan.yaml +3 -1
- package/generators/organization/clan-project/templates/clan-project/terragrunt.hcl +4 -37
- package/package.json +1 -1
- package/generators/resources/spanner/validate.js +0 -27
- package/generators/tribe-resources/tribe-project/generator.json +0 -4
- package/generators/tribe-resources/tribe-project/index.js +0 -106
- package/generators/tribe-resources/tribe-project/templates/project/gke/opa/config/main.tf +0 -33
- package/generators/tribe-resources/tribe-project/templates/project/gke/opa/config/vars.tf +0 -14
- package/generators/tribe-resources/tribe-project/templates/project/gke/opa/terragrunt.hcl +0 -34
- package/generators/tribe-resources/tribe-project/templates/project/gke/spec.hcl +0 -35
- package/generators/tribe-resources/tribe-project/templates/project/gke-ingress-static-ip/spec.hcl +0 -7
- package/generators/tribe-resources/tribe-project/templates/project/gke-ingress-static-ip/terragrunt.hcl +0 -25
- package/generators/tribe-resources/tribe-project/templates/project/network/firewall-rules/config/vars.tf +0 -9
- package/generators/tribe-resources/tribe-project/templates/project/network/spec.hcl +0 -40
- package/generators/tribe-resources/tribe-project/templates/project/project.yaml +0 -7
- package/generators/tribe-resources/tribe-project/templates/project/terragrunt.hcl +0 -51
- /package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/cloud-nat-static-ip/spec.hcl +0 -0
- /package/generators/{tribe-resources/tribe-project/templates/project → clan-resources/clan-project/templates/clan-resources}/private-vpc-connection/config/vars.tf +0 -0
- /package/generators/{tribe-resources/tribe-project/templates → clan-resources/clan-project/templates/clan-resources}/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/bigquery/generator.json +0 -0
- /package/generators/{resources → common-resources}/bigquery/index.js +0 -0
- /package/generators/{resources → common-resources}/bigquery/templates/bigquery/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/bigquery/templates/bigquery/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/bigquery/templates/scheduled-queries/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/bigquery/templates/schema/schema.json +0 -0
- /package/generators/{resources → common-resources}/cloud-storage/generator.json +0 -0
- /package/generators/{resources → common-resources}/cloud-storage/index.js +0 -0
- /package/generators/{resources → common-resources}/cloud-storage/templates/cloud-storage/storage.yaml +0 -0
- /package/generators/{resources → common-resources}/cloud-storage/templates/cloud-storage/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql/generator.json +0 -0
- /package/generators/{resources → common-resources}/cloudsql/index.js +0 -0
- /package/generators/{resources → common-resources}/cloudsql/templates/mssql/instance/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql/templates/mssql/instance/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql/templates/mssql/instance-secrets/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql/templates/mysql/instance/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql/templates/mysql/instance/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql/templates/mysql/instance-secrets/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql/templates/postgres/instance/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql/templates/postgres/instance/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql/templates/postgres/instance-secrets/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/generator.json +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/index.js +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/templates/mysql/database/proxy_port.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/templates/mysql/database/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/templates/mysql/outputs.json +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/templates/mysql/secrets/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/templates/postgres/database/proxy_port.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/templates/postgres/database/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/templates/postgres/database/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/templates/postgres/outputs.json +0 -0
- /package/generators/{resources → common-resources}/cloudsql-database/templates/postgres/secrets/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/confluent-cluster/generator.json +0 -0
- /package/generators/{resources → common-resources}/confluent-cluster/index.js +0 -0
- /package/generators/{resources → common-resources}/confluent-cluster/templates/confluent/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/confluent-cluster/templates/confluent/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/datastore/generator.json +0 -0
- /package/generators/{resources → common-resources}/datastore/index.js +0 -0
- /package/generators/{resources → common-resources}/datastore/templates/datastore/indexes.yaml +0 -0
- /package/generators/{resources → common-resources}/datastore/templates/datastore/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/elastic-cloud/generator.json +0 -0
- /package/generators/{resources → common-resources}/elastic-cloud/index.js +0 -0
- /package/generators/{resources → common-resources}/elastic-cloud/templates/elastic/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/elastic-cloud/templates/elastic/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/elastic-index-policy/generator.json +0 -0
- /package/generators/{resources → common-resources}/elastic-index-policy/handle-yaml.js +0 -0
- /package/generators/{resources → common-resources}/elastic-index-policy/index.js +0 -0
- /package/generators/{resources → common-resources}/elastic-index-policy/templates/policy/policy.yaml +0 -0
- /package/generators/{resources → common-resources}/elastic-index-policy/templates/policy/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/elastic-template/generator.json +0 -0
- /package/generators/{resources → common-resources}/elastic-template/index.js +0 -0
- /package/generators/{resources → common-resources}/elastic-template/templates/elastic-template/mappings.json +0 -0
- /package/generators/{resources → common-resources}/elastic-template/templates/elastic-template/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/firestore/generator.json +0 -0
- /package/generators/{resources → common-resources}/firestore/index.js +0 -0
- /package/generators/{resources → common-resources}/firestore/templates/firestore/indexes.yaml +0 -0
- /package/generators/{resources → common-resources}/firestore/templates/firestore/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/iam/generator.json +0 -0
- /package/generators/{resources → common-resources}/iam/index.js +0 -0
- /package/generators/{resources → common-resources}/iam/templates/github/workflows/iam.yml +0 -0
- /package/generators/{resources → common-resources}/iam/templates/iam.yaml +0 -0
- /package/generators/{resources → common-resources}/iam/valid-prefix.js +0 -0
- /package/generators/{resources → common-resources}/kafka-connect/generator.json +0 -0
- /package/generators/{resources → common-resources}/kafka-connect/index.js +0 -0
- /package/generators/{resources → common-resources}/kafka-connect/templates/elastic/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/kafka-connect/templates/pubsub/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/kafka-topics/generator.json +0 -0
- /package/generators/{resources → common-resources}/kafka-topics/index.js +0 -0
- /package/generators/{resources → common-resources}/kafka-topics/templates/kafka/kafka.yaml +0 -0
- /package/generators/{resources → common-resources}/kafka-topics/templates/kafka/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/kms/generator.json +0 -0
- /package/generators/{resources → common-resources}/kms/index.js +0 -0
- /package/generators/{resources → common-resources}/kms/templates/kms/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/kms/templates/kms/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/memorystore/generator.json +0 -0
- /package/generators/{resources → common-resources}/memorystore/index.js +0 -0
- /package/generators/{resources → common-resources}/memorystore/templates/outputs.json +0 -0
- /package/generators/{resources → common-resources}/memorystore/templates/redis-instance/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/memorystore/templates/redis-instance/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/memorystore/templates/secrets/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/monitoring/generator.json +0 -0
- /package/generators/{resources → common-resources}/monitoring/handle-yaml.js +0 -0
- /package/generators/{resources → common-resources}/monitoring/index.js +0 -0
- /package/generators/{resources → common-resources}/monitoring/templates/alerts/generic-infra.yaml +0 -0
- /package/generators/{resources → common-resources}/monitoring/templates/alerts/service.yaml +0 -0
- /package/generators/{resources → common-resources}/monitoring/templates/alerts/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/monitoring/templates/slos/slos.yaml +0 -0
- /package/generators/{resources → common-resources}/monitoring/templates/slos/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/monitoring/templates/uptime-checks/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/monitoring/templates/uptime-checks/uptime-checks.yaml +0 -0
- /package/generators/{resources → common-resources}/monitoring/validate.js +0 -0
- /package/generators/{resources → common-resources}/pubsub/append.js +0 -0
- /package/generators/{resources → common-resources}/pubsub/generator.json +0 -0
- /package/generators/{resources → common-resources}/pubsub/get-gcp-projects.js +0 -0
- /package/generators/{resources → common-resources}/pubsub/handle-subscribers.js +0 -0
- /package/generators/{resources → common-resources}/pubsub/index.js +0 -0
- /package/generators/{resources → common-resources}/pubsub/templates/pubsub/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/pubsub/templates/pubsub/subscribers.yaml +0 -0
- /package/generators/{resources → common-resources}/pubsub/templates/pubsub/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/pubsub/templates/pubsub-dlq/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/pubsub/templates/pubsub-external/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/pubsub/templates/pubsub-external/subscribers.yaml +0 -0
- /package/generators/{resources → common-resources}/pubsub/templates/pubsub-external/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/pubsub/validate.js +0 -0
- /package/generators/{resources → common-resources}/scheduler/append.js +0 -0
- /package/generators/{resources → common-resources}/scheduler/generator.json +0 -0
- /package/generators/{resources → common-resources}/scheduler/index.js +0 -0
- /package/generators/{resources → common-resources}/scheduler/templates/scheduler/terragrunt.hcl +0 -0
- /package/generators/{resources → common-resources}/spanner/append.js +0 -0
- /package/generators/{resources → common-resources}/spanner/generator.json +0 -0
- /package/generators/{resources → common-resources}/spanner/templates/spanner/databases.yaml +0 -0
- /package/generators/{resources → common-resources}/spanner/templates/spanner/spec.hcl +0 -0
- /package/generators/{resources → common-resources}/spanner/templates/spanner/terragrunt.hcl +0 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const BaseGenerator = require('../../../src/BaseGenerator');
|
|
5
|
+
const { required } = require('../../../src/validators');
|
|
6
|
+
|
|
7
|
+
module.exports = class extends BaseGenerator {
|
|
8
|
+
constructor(args, opts) {
|
|
9
|
+
super(args, opts);
|
|
10
|
+
|
|
11
|
+
// Output directory relative to the tf-infra-gcp directory.
|
|
12
|
+
this.destinationRoot('organization');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
prompting() {
|
|
16
|
+
const prompts = [
|
|
17
|
+
{
|
|
18
|
+
type: 'list',
|
|
19
|
+
name: 'domain',
|
|
20
|
+
default: 'extendaretail-com',
|
|
21
|
+
message: 'Choose GCP Organization',
|
|
22
|
+
store: true,
|
|
23
|
+
choices: this.listSubDirectories(this.destinationPath()),
|
|
24
|
+
validate: required,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'list',
|
|
28
|
+
name: 'department',
|
|
29
|
+
message: 'Choose department',
|
|
30
|
+
store: true,
|
|
31
|
+
choices: (answers) => this.listSubDirectories(
|
|
32
|
+
path.join(this.destinationPath(), answers.domain, 'departments'),
|
|
33
|
+
),
|
|
34
|
+
validate: required,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'list',
|
|
38
|
+
name: 'tribe',
|
|
39
|
+
message: 'Choose tribe',
|
|
40
|
+
store: true,
|
|
41
|
+
choices: (answers) => this.listSubDirectories(
|
|
42
|
+
path.join(this.destinationPath(), answers.domain, 'departments', answers.department),
|
|
43
|
+
),
|
|
44
|
+
validate: required,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'list',
|
|
48
|
+
name: 'clan',
|
|
49
|
+
message: 'Choose clan',
|
|
50
|
+
store: true,
|
|
51
|
+
choices: (answers) => this.listSubDirectories(
|
|
52
|
+
path.join(this.destinationPath(), answers.domain, 'departments', answers.department, answers.tribe, 'clans'),
|
|
53
|
+
),
|
|
54
|
+
validate: required,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'list',
|
|
58
|
+
name: 'migration',
|
|
59
|
+
message: 'Is the project in the process of migration to Autopilot?',
|
|
60
|
+
default: 'yes',
|
|
61
|
+
choices: ['yes', 'no'],
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
return this.prompt(prompts).then((props) => {
|
|
66
|
+
this.answers = props;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
writing() {
|
|
71
|
+
const {
|
|
72
|
+
domain,
|
|
73
|
+
department,
|
|
74
|
+
tribe,
|
|
75
|
+
clan,
|
|
76
|
+
migration,
|
|
77
|
+
} = this.answers;
|
|
78
|
+
|
|
79
|
+
['prod', 'staging'].forEach((env) => {
|
|
80
|
+
this.copyDir(
|
|
81
|
+
'clan-resources',
|
|
82
|
+
path.join(domain, 'departments', department, tribe, 'clans', clan, env, 'resources'),
|
|
83
|
+
{
|
|
84
|
+
...this.answers,
|
|
85
|
+
env,
|
|
86
|
+
},
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
if (migration === 'yes') {
|
|
91
|
+
['prod', 'staging'].forEach((env) => {
|
|
92
|
+
const terragruntFilePath = path.join(domain, 'departments', department, tribe, 'clans', clan, env, 'terragrunt.hcl');
|
|
93
|
+
|
|
94
|
+
fs.readFile(terragruntFilePath, 'utf8', (err, data) => {
|
|
95
|
+
if (err) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const modifiedData = data.replace(
|
|
100
|
+
/source\s*=\s*"git::https:\/\/github\.com\/extenda\/tf-module-gcp-project\/\/\?ref=.+"/,
|
|
101
|
+
'source = "git::https://github.com/extenda/tf-module-gcp-project//?ref=migration"',
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
fs.writeFile(terragruntFilePath, modifiedData, 'utf8', (error) => {
|
|
105
|
+
if (error) {
|
|
106
|
+
console.error(`Error writing file ${terragruntFilePath}: ${error}`);
|
|
107
|
+
} else {
|
|
108
|
+
console.log(`Updated file ${terragruntFilePath}`);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
end() {
|
|
117
|
+
const {
|
|
118
|
+
domain,
|
|
119
|
+
department,
|
|
120
|
+
tribe,
|
|
121
|
+
clan,
|
|
122
|
+
} = this.answers;
|
|
123
|
+
const clanDir = path.join(domain, 'departments', department, tribe, 'clans', clan);
|
|
124
|
+
this.log(`
|
|
125
|
+
${chalk.green(`Your clan resources have now been created. To finalize your configuration, please continue
|
|
126
|
+
with manual editing of the generated files.`)}
|
|
127
|
+
${chalk.green('1.')} Review the configurations
|
|
128
|
+
\u2192 ${chalk.cyan(path.join(clanDir, 'prod', 'network', 'spec.hcl'))}
|
|
129
|
+
\u2192 ${chalk.cyan(path.join(clanDir, 'prod', 'gke', 'spec.hcl'))}
|
|
130
|
+
\u2192 ${chalk.cyan(path.join(clanDir, 'staging', 'network', 'spec.hcl'))}
|
|
131
|
+
\u2192 ${chalk.cyan(path.join(clanDir, 'staging', 'gke', 'spec.hcl'))}
|
|
132
|
+
${chalk.green('2.')} Push this change in a feature branch and open a pull request.
|
|
133
|
+
`);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
@@ -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/terraform-google-modules/terraform-google-cloud-nat//?ref=v2.
|
|
4
|
+
source = "git::https://github.com/terraform-google-modules/terraform-google-cloud-nat//?ref=v2.2.2"
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
# Include all settings from the root terragrunt.hcl file
|
|
@@ -29,18 +29,24 @@ dependency "router" {
|
|
|
29
29
|
dependency "static_ip" {
|
|
30
30
|
config_path = "../cloud-nat-static-ip"
|
|
31
31
|
mock_outputs = {
|
|
32
|
-
|
|
32
|
+
names = "ip-name"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
locals {
|
|
37
|
+
clan_name = basename(dirname(dirname(dirname(get_terragrunt_dir()))))
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
37
41
|
inputs = merge(
|
|
38
42
|
{
|
|
39
|
-
name = "
|
|
43
|
+
name = "${local.clan_name}-cloud-nat"
|
|
40
44
|
region = "europe-west1"
|
|
41
45
|
project_id = dependency.network.outputs.project_id
|
|
42
46
|
network = dependency.network.outputs.network_name
|
|
43
47
|
router = dependency.router.outputs.router.name
|
|
44
48
|
nat_ips = dependency.static_ip.outputs.self_links
|
|
49
|
+
|
|
50
|
+
enable_endpoint_independent_mapping = false
|
|
45
51
|
}
|
|
46
52
|
)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
terraform {
|
|
2
|
-
source = "git::https://github.com/terraform-google-modules/terraform-google-address//?ref=v3.
|
|
2
|
+
source = "git::https://github.com/terraform-google-modules/terraform-google-address//?ref=v3.1.2"
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
dependency "project" {
|
|
6
|
-
config_path = "
|
|
6
|
+
config_path = "../../"
|
|
7
7
|
mock_outputs = {
|
|
8
8
|
project_id = "project-dummy-id"
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
terraform {
|
|
2
|
-
source = "git::https://github.com/terraform-google-modules/terraform-google-cloud-router//?ref=
|
|
2
|
+
source = "git::https://github.com/terraform-google-modules/terraform-google-cloud-router//?ref=v5.0.0"
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
dependency "project" {
|
|
6
|
-
config_path = "
|
|
6
|
+
config_path = "../../"
|
|
7
7
|
mock_outputs = {
|
|
8
8
|
project_id = "project-dummy-id"
|
|
9
9
|
}
|
|
@@ -13,7 +13,6 @@ dependency "network" {
|
|
|
13
13
|
config_path = "../network"
|
|
14
14
|
mock_outputs = {
|
|
15
15
|
network_name = "network-dummy-name"
|
|
16
|
-
subnets_names = "subnet-dummy-name"
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -21,9 +20,13 @@ include {
|
|
|
21
20
|
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
locals {
|
|
24
|
+
clan_name = basename(dirname(dirname(dirname(get_terragrunt_dir()))))
|
|
25
|
+
}
|
|
26
|
+
|
|
24
27
|
inputs = merge(
|
|
25
28
|
{
|
|
26
|
-
name = "
|
|
29
|
+
name = "${local.clan_name}-router"
|
|
27
30
|
region = "europe-west1"
|
|
28
31
|
project = dependency.project.outputs.project_id
|
|
29
32
|
network = dependency.network.outputs.network_name
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
terraform {
|
|
2
|
+
source = "git::https://github.com/extenda/tf-module-gcp-project//modules/gke-resources?ref=v2.0.0"
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
dependency "project" {
|
|
6
|
+
config_path = "../../../"
|
|
7
|
+
mock_outputs = {
|
|
8
|
+
project_id = "project-dummy-id"
|
|
9
|
+
ci_cd_service_account_email = {
|
|
10
|
+
"ci-cd-pipeline" = "dummy"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
dependency "gke" {
|
|
16
|
+
config_path = "../"
|
|
17
|
+
mock_outputs = {
|
|
18
|
+
endpoint = "dummy-endpoint"
|
|
19
|
+
ca_certificate = "dummy-ca-certificate"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
include {
|
|
24
|
+
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
locals {
|
|
28
|
+
clan_name = basename(dirname(dirname(dirname(get_terragrunt_dir()))))
|
|
29
|
+
project_yaml = yamldecode(file(find_in_parent_folders("project.yaml")))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
inputs = merge(
|
|
33
|
+
{
|
|
34
|
+
services = local.project_yaml.services
|
|
35
|
+
project_id = dependency.project.outputs.project_id
|
|
36
|
+
gke_host = dependency.gke.outputs.endpoint
|
|
37
|
+
gke_ca_certificate = dependency.gke.outputs.ca_certificate
|
|
38
|
+
cicd_service = dependency.project.outputs.ci_cd_service_account_email["ci-cd-pipeline"]
|
|
39
|
+
}
|
|
40
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
locals {
|
|
2
|
+
regional = true
|
|
3
|
+
region = "europe-west1"
|
|
4
|
+
zones = ["europe-west1-d", "europe-west1-c", "europe-west1-b"]
|
|
5
|
+
ip_range_pods = "pods-cidr"
|
|
6
|
+
ip_range_services = "services-cidr"
|
|
7
|
+
create_service_account = true
|
|
8
|
+
grant_registry_access = true
|
|
9
|
+
http_load_balancing = true
|
|
10
|
+
add_cluster_firewall_rules = true
|
|
11
|
+
dns_cache = true
|
|
12
|
+
enable_vertical_pod_autoscaling = true
|
|
13
|
+
enable_private_nodes = true
|
|
14
|
+
master_global_access_enabled = false
|
|
15
|
+
release_channel = "REGULAR"
|
|
16
|
+
enable_cost_allocation = true
|
|
17
|
+
maintenance_start_time = "01:00" #UTC
|
|
18
|
+
}
|
|
@@ -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/terraform-google-modules/terraform-google-kubernetes-engine//modules/beta-private-cluster?ref=
|
|
4
|
+
source = "git::https://github.com/terraform-google-modules/terraform-google-kubernetes-engine//modules/beta-autopilot-private-cluster?ref=v25.0.0"
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
# Include all settings from the root terragrunt.hcl file
|
|
@@ -10,7 +10,7 @@ include {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
dependency "project" {
|
|
13
|
-
config_path = "
|
|
13
|
+
config_path = "../../"
|
|
14
14
|
mock_outputs = {
|
|
15
15
|
project_id = "project-dummy-id"
|
|
16
16
|
}
|
|
@@ -20,27 +20,32 @@ dependency "network" {
|
|
|
20
20
|
config_path = "../network"
|
|
21
21
|
mock_outputs = {
|
|
22
22
|
network_name = "network-dummy-name"
|
|
23
|
-
subnets_names = "subnet-dummy-name"
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
locals {
|
|
28
|
-
spec_vars
|
|
29
|
-
|
|
27
|
+
spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
|
|
28
|
+
clan_yaml = yamldecode(file(find_in_parent_folders("clan.yaml")))
|
|
29
|
+
clan_name = basename(dirname(dirname(dirname(get_terragrunt_dir()))))
|
|
30
|
+
env_name = basename(dirname(dirname(get_terragrunt_dir())))
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
33
34
|
inputs = merge(
|
|
34
35
|
local.spec_vars.locals,
|
|
35
36
|
{
|
|
37
|
+
name = "${local.clan_name}-cluster-${local.env_name}"
|
|
36
38
|
project_id = dependency.project.outputs.project_id
|
|
37
39
|
network = dependency.network.outputs.network_name
|
|
38
40
|
subnetwork = "k8s-subnet"
|
|
39
41
|
identity_namespace = "${dependency.project.outputs.project_id}.svc.id.goog"
|
|
40
42
|
authenticator_security_group = "gke-security-groups@extendaretail.com"
|
|
41
|
-
|
|
43
|
+
registry_project_ids = ["extenda"]
|
|
42
44
|
cluster_resource_labels = {
|
|
43
|
-
cc = local.
|
|
45
|
+
cc = local.clan_yaml.costcenter
|
|
44
46
|
}
|
|
47
|
+
|
|
48
|
+
// Binary Auth must be Enabled manually in this console - not supported by the module yet
|
|
49
|
+
enable_binary_authorization = true
|
|
45
50
|
}
|
|
46
51
|
)
|
|
@@ -13,3 +13,16 @@ resource "google_compute_firewall" "dataflow-workers" {
|
|
|
13
13
|
source_tags = ["dataflow"]
|
|
14
14
|
target_tags = ["dataflow"]
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
resource "google_compute_firewall" "allow_negs" {
|
|
18
|
+
name = "allow-negs"
|
|
19
|
+
network = var.network
|
|
20
|
+
project = var.project
|
|
21
|
+
|
|
22
|
+
allow {
|
|
23
|
+
protocol = "all"
|
|
24
|
+
}
|
|
25
|
+
source_ranges = ["35.191.0.0/16", "130.211.0.0/22"]
|
|
26
|
+
priority = 1000
|
|
27
|
+
direction = "INGRESS"
|
|
28
|
+
}
|
|
@@ -16,8 +16,8 @@ dependency "network" {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
dependency "
|
|
20
|
-
config_path = "
|
|
19
|
+
dependency "clan_project" {
|
|
20
|
+
config_path = "../../../"
|
|
21
21
|
mock_outputs = {
|
|
22
22
|
project_id = "dummy-id"
|
|
23
23
|
}
|
|
@@ -27,6 +27,6 @@ dependency "tribe_project" {
|
|
|
27
27
|
inputs = merge(
|
|
28
28
|
{
|
|
29
29
|
network = dependency.network.outputs.network_self_link
|
|
30
|
-
project = dependency.
|
|
30
|
+
project = dependency.clan_project.outputs.project_id
|
|
31
31
|
}
|
|
32
32
|
)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
locals {
|
|
2
|
+
network_name = "clan-network"
|
|
3
|
+
|
|
4
|
+
subnets = [
|
|
5
|
+
{
|
|
6
|
+
subnet_name = "k8s-subnet"
|
|
7
|
+
subnet_ip = "10.152.16.0/23"
|
|
8
|
+
subnet_region = "europe-west1"
|
|
9
|
+
subnet_private_access = true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
subnet_name = "clan-resources"
|
|
13
|
+
subnet_ip = "10.152.20.0/22"
|
|
14
|
+
subnet_region = "europe-west1"
|
|
15
|
+
subnet_private_access = true
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
subnet_name = "vpc-connector-subnet"
|
|
19
|
+
subnet_ip = "10.8.0.0/28"
|
|
20
|
+
subnet_region = "europe-west1"
|
|
21
|
+
description = "The subnet must be used only for Serverless VPC connector"
|
|
22
|
+
subnet_private_access = true
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
subnet_name = "internal-lb-subnet"
|
|
26
|
+
subnet_ip = "10.10.0.0/23"
|
|
27
|
+
subnet_region = "europe-west1"
|
|
28
|
+
purpose = "REGIONAL_MANAGED_PROXY"
|
|
29
|
+
role = "ACTIVE"
|
|
30
|
+
description = "The subnet must be used only for Serverless VPC connector"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
secondary_ranges = {
|
|
35
|
+
"k8s-subnet" = [
|
|
36
|
+
{
|
|
37
|
+
range_name = "pods-cidr"
|
|
38
|
+
ip_cidr_range = "172.18.0.0/20"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
range_name = "services-cidr"
|
|
42
|
+
ip_cidr_range = "172.19.0.0/20"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -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/terraform-google-modules/terraform-google-network//?ref=
|
|
4
|
+
source = "git::https://github.com/terraform-google-modules/terraform-google-network//?ref=v6.0.1"
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
# Include all settings from the root terragrunt.hcl file
|
|
@@ -10,7 +10,7 @@ include {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
dependency "project" {
|
|
13
|
-
config_path = "
|
|
13
|
+
config_path = "../../"
|
|
14
14
|
mock_outputs = {
|
|
15
15
|
project_id = "project-dummy-id"
|
|
16
16
|
}
|
|
@@ -2,7 +2,8 @@ resource "google_compute_global_address" "private_ip_alloc" {
|
|
|
2
2
|
provider = google-beta
|
|
3
3
|
|
|
4
4
|
project = var.project
|
|
5
|
-
name = "private-ip-
|
|
5
|
+
name = "private-ip-peering"
|
|
6
|
+
description = "VPC Private connection"
|
|
6
7
|
purpose = var.purpose
|
|
7
8
|
address_type = var.address_type
|
|
8
9
|
prefix_length = var.prefix_length
|
|
@@ -3,7 +3,7 @@ terraform {
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
dependency "project" {
|
|
6
|
-
config_path = "
|
|
6
|
+
config_path = "../../"
|
|
7
7
|
mock_outputs = {
|
|
8
8
|
project_id = "project-dummy-id"
|
|
9
9
|
}
|
|
@@ -21,7 +21,7 @@ include {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
locals {
|
|
24
|
-
|
|
24
|
+
clan_yaml = yamldecode(file(find_in_parent_folders("clan.yaml")))
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
inputs = merge(
|
|
@@ -29,7 +29,7 @@ inputs = merge(
|
|
|
29
29
|
project = dependency.project.outputs.project_id
|
|
30
30
|
network = dependency.network.outputs.network_self_link
|
|
31
31
|
address_labels = {
|
|
32
|
-
cc = local.
|
|
32
|
+
cc = local.clan_yaml.costcenter
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
)
|
|
@@ -0,0 +1,40 @@
|
|
|
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/terraform-google-modules/terraform-google-network//modules/vpc-serverless-connector-beta?ref=v6.0.1"
|
|
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
|
+
dependency "project" {
|
|
13
|
+
config_path = "../../"
|
|
14
|
+
mock_outputs = {
|
|
15
|
+
project_id = "project-dummy-id"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
locals {
|
|
20
|
+
clan_name = basename(dirname(dirname(dirname(get_terragrunt_dir()))))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
24
|
+
inputs = merge(
|
|
25
|
+
{
|
|
26
|
+
project_id = dependency.project.outputs.project_id
|
|
27
|
+
vpc_connectors = [
|
|
28
|
+
{
|
|
29
|
+
name = "${local.clan_name}-connector"
|
|
30
|
+
region = "europe-west1"
|
|
31
|
+
subnet_name = "vpc-connector-subnet"
|
|
32
|
+
host_project_id = dependency.project.outputs.project_id
|
|
33
|
+
machine_type = "e2-micro"
|
|
34
|
+
min_instances = 2
|
|
35
|
+
max_instances = 3
|
|
36
|
+
max_throughput = 300
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
)
|
|
@@ -63,10 +63,7 @@ module.exports = class extends BaseGenerator {
|
|
|
63
63
|
type: 'input',
|
|
64
64
|
name: 'databaseName',
|
|
65
65
|
message: 'Please provide a name for the database',
|
|
66
|
-
validate:
|
|
67
|
-
const validation = validName(input);
|
|
68
|
-
return validation.valid ? true : validation.message;
|
|
69
|
-
},
|
|
66
|
+
validate: validName,
|
|
70
67
|
},
|
|
71
68
|
{
|
|
72
69
|
when: (response) => response.resourceType === 'database',
|
|
@@ -79,10 +76,7 @@ module.exports = class extends BaseGenerator {
|
|
|
79
76
|
type: 'input',
|
|
80
77
|
name: 'retentionPeriod',
|
|
81
78
|
message: 'Please provide version retention period. Maximum value 7d, possible values include 84000s, 1h, 2d. Leave empty for default value 1h.',
|
|
82
|
-
validate:
|
|
83
|
-
const validation = validRetentionPeriod(input);
|
|
84
|
-
return validation.valid ? true : validation.message;
|
|
85
|
-
},
|
|
79
|
+
validate: validRetentionPeriod,
|
|
86
80
|
},
|
|
87
81
|
];
|
|
88
82
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const validName = (input) => {
|
|
2
|
+
if (input.replace(/\s/g, '').length >= 6 && input.length <= 30) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
return 'Name must be between 6 and 30 characters in length';
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const validRetentionPeriod = (input) => {
|
|
9
|
+
const validFormats = /^(84000s|1h|2d|7d)$/;
|
|
10
|
+
|
|
11
|
+
if (input === '') {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (validFormats.test(input)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return 'Invalid retention period format. Possible values are 84000s, 1h, 2d, or leave empty for default value 1h';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports = {
|
|
22
|
+
validName,
|
|
23
|
+
validRetentionPeriod,
|
|
24
|
+
};
|
|
@@ -55,6 +55,12 @@ module.exports = class extends BaseGenerator {
|
|
|
55
55
|
message: 'Name of GitHub repository for clan common infrastructure',
|
|
56
56
|
default: (answers) => `${answers.tribe}-${answers.clan}-common`,
|
|
57
57
|
},
|
|
58
|
+
{
|
|
59
|
+
type: 'input',
|
|
60
|
+
name: 'costCenter',
|
|
61
|
+
message: 'Please provide the Cost Center of the Clan',
|
|
62
|
+
validate: required,
|
|
63
|
+
},
|
|
58
64
|
];
|
|
59
65
|
|
|
60
66
|
return this.prompt(prompts).then((props) => {
|