@hiiretail/gcp-infra-cli 0.104.0 → 1.0.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/README.md +9 -46
- package/bin/gcp-infra +5 -2
- package/package.json +7 -30
- package/src/gcp-infra.js +87 -0
- package/LICENSE +0 -21
- package/generators/clan-resources/clan-project/generator.json +0 -4
- package/generators/clan-resources/clan-project/index.js +0 -135
- package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat/terragrunt.hcl +0 -52
- package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat-static-ip/spec.hcl +0 -7
- package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat-static-ip/terragrunt.hcl +0 -25
- package/generators/clan-resources/clan-project/templates/clan-resources/cloud-router/terragrunt.hcl +0 -34
- package/generators/clan-resources/clan-project/templates/clan-resources/gke/gke-resources/terragrunt.hcl +0 -40
- package/generators/clan-resources/clan-project/templates/clan-resources/gke/spec.hcl +0 -18
- package/generators/clan-resources/clan-project/templates/clan-resources/gke/terragrunt.hcl +0 -52
- package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/config/main.tf +0 -41
- package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/config/vars.tf +0 -9
- package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/terragrunt.hcl +0 -32
- package/generators/clan-resources/clan-project/templates/clan-resources/network/spec.hcl +0 -54
- package/generators/clan-resources/clan-project/templates/clan-resources/network/terragrunt.hcl +0 -29
- package/generators/clan-resources/clan-project/templates/clan-resources/private-vpc-connection/config/main.tf +0 -18
- package/generators/clan-resources/clan-project/templates/clan-resources/private-vpc-connection/config/vars.tf +0 -27
- package/generators/clan-resources/clan-project/templates/clan-resources/private-vpc-connection/terragrunt.hcl +0 -35
- package/generators/clan-resources/clan-project/templates/clan-resources/serverless-vpc-connector/terragrunt.hcl +0 -40
- package/generators/clan-resources/clan-project/templates/clan-resources/terragrunt.hcl +0 -3
- package/generators/clan-resources/command.json +0 -7
- package/generators/common-resources/bigquery/generator.json +0 -4
- package/generators/common-resources/bigquery/index.js +0 -284
- package/generators/common-resources/bigquery/templates/bigquery/spec.hcl +0 -8
- package/generators/common-resources/bigquery/templates/bigquery/terragrunt.hcl +0 -53
- package/generators/common-resources/bigquery/templates/scheduled-queries/terragrunt.hcl +0 -56
- package/generators/common-resources/bigquery/templates/schema/schema.json +0 -14
- package/generators/common-resources/budget/generator.json +0 -4
- package/generators/common-resources/budget/index.js +0 -89
- package/generators/common-resources/budget/templates/budget/terragrunt.hcl +0 -45
- package/generators/common-resources/cloud-armor/generator.json +0 -4
- package/generators/common-resources/cloud-armor/index.js +0 -45
- package/generators/common-resources/cloud-armor/templates/policies.yaml +0 -53
- package/generators/common-resources/cloud-armor/templates/terragrunt.hcl +0 -30
- package/generators/common-resources/cloud-storage/generator.json +0 -4
- package/generators/common-resources/cloud-storage/index.js +0 -156
- package/generators/common-resources/cloud-storage/templates/cloud-storage/storage.yaml +0 -26
- package/generators/common-resources/cloud-storage/templates/cloud-storage/terragrunt.hcl +0 -32
- package/generators/common-resources/cloudsql/generator.json +0 -4
- package/generators/common-resources/cloudsql/index.js +0 -106
- package/generators/common-resources/cloudsql/templates/mssql/instance/spec.hcl +0 -76
- package/generators/common-resources/cloudsql/templates/mssql/instance/terragrunt.hcl +0 -38
- package/generators/common-resources/cloudsql/templates/mssql/instance-secrets/terragrunt.hcl +0 -37
- package/generators/common-resources/cloudsql/templates/mysql/instance/spec.hcl +0 -73
- package/generators/common-resources/cloudsql/templates/mysql/instance/terragrunt.hcl +0 -40
- package/generators/common-resources/cloudsql/templates/mysql/instance-secrets/terragrunt.hcl +0 -38
- package/generators/common-resources/cloudsql/templates/postgres-clan/instance/spec.hcl +0 -102
- package/generators/common-resources/cloudsql/templates/postgres-clan/instance/terragrunt.hcl +0 -36
- package/generators/common-resources/cloudsql/templates/postgres-clan/instance-secrets/terragrunt.hcl +0 -44
- package/generators/common-resources/cloudsql-database/generator.json +0 -4
- package/generators/common-resources/cloudsql-database/index.js +0 -70
- package/generators/common-resources/cloudsql-database/templates/mysql/database/proxy_port.hcl +0 -4
- package/generators/common-resources/cloudsql-database/templates/mysql/database/terragrunt.hcl +0 -69
- package/generators/common-resources/cloudsql-database/templates/mysql/outputs.json +0 -5
- package/generators/common-resources/cloudsql-database/templates/mysql/secrets/terragrunt.hcl +0 -30
- package/generators/common-resources/cloudsql-database/templates/postgres/database/proxy_port.hcl +0 -4
- package/generators/common-resources/cloudsql-database/templates/postgres/database/spec.hcl +0 -17
- package/generators/common-resources/cloudsql-database/templates/postgres/database/terragrunt.hcl +0 -74
- package/generators/common-resources/cloudsql-database/templates/postgres/outputs.json +0 -5
- package/generators/common-resources/cloudsql-database/templates/postgres/secrets/terragrunt.hcl +0 -30
- package/generators/common-resources/command.json +0 -8
- package/generators/common-resources/confluent-cluster/generator.json +0 -4
- package/generators/common-resources/confluent-cluster/index.js +0 -52
- package/generators/common-resources/confluent-cluster/templates/confluent/spec.hcl +0 -5
- package/generators/common-resources/confluent-cluster/templates/confluent/terragrunt.hcl +0 -25
- package/generators/common-resources/datastore/generator.json +0 -4
- package/generators/common-resources/datastore/index.js +0 -91
- package/generators/common-resources/datastore/templates/datastore/indexes.yaml +0 -6
- package/generators/common-resources/datastore/templates/datastore/terragrunt.hcl +0 -23
- package/generators/common-resources/elastic-cloud/generator.json +0 -4
- package/generators/common-resources/elastic-cloud/index.js +0 -52
- package/generators/common-resources/elastic-cloud/templates/elastic/spec.hcl +0 -27
- package/generators/common-resources/elastic-cloud/templates/elastic/terragrunt.hcl +0 -27
- package/generators/common-resources/elastic-index-policy/generator.json +0 -4
- package/generators/common-resources/elastic-index-policy/handle-yaml.js +0 -76
- package/generators/common-resources/elastic-index-policy/index.js +0 -210
- package/generators/common-resources/elastic-index-policy/templates/policy/policy.yaml +0 -28
- package/generators/common-resources/elastic-index-policy/templates/policy/terragrunt.hcl +0 -25
- package/generators/common-resources/elastic-template/generator.json +0 -4
- package/generators/common-resources/elastic-template/index.js +0 -84
- package/generators/common-resources/elastic-template/templates/elastic-template/mappings.json +0 -1
- package/generators/common-resources/elastic-template/templates/elastic-template/terragrunt.hcl +0 -35
- package/generators/common-resources/firestore/generator.json +0 -4
- package/generators/common-resources/firestore/index.js +0 -141
- package/generators/common-resources/firestore/templates/firestore/indexes/indexes.yaml +0 -12
- package/generators/common-resources/firestore/templates/firestore/indexes/terragrunt.hcl +0 -27
- package/generators/common-resources/firestore/templates/firestore/spec.hcl +0 -31
- package/generators/common-resources/firestore/templates/firestore/terragrunt.hcl +0 -25
- package/generators/common-resources/iam/generator.json +0 -4
- package/generators/common-resources/iam/index.js +0 -62
- package/generators/common-resources/iam/templates/github/workflows/iam.yml +0 -18
- package/generators/common-resources/iam/templates/iam.yaml +0 -8
- package/generators/common-resources/iam/valid-prefix.js +0 -8
- package/generators/common-resources/kafka-connect/generator.json +0 -4
- package/generators/common-resources/kafka-connect/index.js +0 -75
- package/generators/common-resources/kafka-connect/templates/elastic/terragrunt.hcl +0 -92
- package/generators/common-resources/kafka-connect/templates/pubsub/terragrunt.hcl +0 -75
- package/generators/common-resources/kafka-topics/generator.json +0 -4
- package/generators/common-resources/kafka-topics/index.js +0 -54
- package/generators/common-resources/kafka-topics/templates/kafka/kafka.yaml +0 -20
- package/generators/common-resources/kafka-topics/templates/kafka/terragrunt.hcl +0 -21
- package/generators/common-resources/kms/generator.json +0 -4
- package/generators/common-resources/kms/index.js +0 -69
- package/generators/common-resources/kms/templates/kms/spec.hcl +0 -5
- package/generators/common-resources/kms/templates/kms/terragrunt.hcl +0 -33
- package/generators/common-resources/memorystore/generator.json +0 -4
- package/generators/common-resources/memorystore/index.js +0 -69
- package/generators/common-resources/memorystore/templates/outputs.json +0 -3
- package/generators/common-resources/memorystore/templates/redis-instance/spec.hcl +0 -16
- package/generators/common-resources/memorystore/templates/redis-instance/terragrunt.hcl +0 -35
- package/generators/common-resources/memorystore/templates/secrets/terragrunt.hcl +0 -31
- package/generators/common-resources/monitoring/generator.json +0 -4
- package/generators/common-resources/monitoring/handle-yaml.js +0 -48
- package/generators/common-resources/monitoring/index.js +0 -192
- package/generators/common-resources/monitoring/templates/alerts/generic-infra.yaml +0 -633
- package/generators/common-resources/monitoring/templates/alerts/terragrunt.hcl +0 -37
- package/generators/common-resources/monitoring/templates/service/service.yaml +0 -16
- package/generators/common-resources/monitoring/templates/service/terragrunt.hcl +0 -37
- package/generators/common-resources/monitoring/templates/uptime-checks/terragrunt.hcl +0 -36
- package/generators/common-resources/monitoring/templates/uptime-checks/uptime-checks.yaml +0 -3
- package/generators/common-resources/monitoring/validate.js +0 -58
- package/generators/common-resources/pubsub/append.js +0 -120
- package/generators/common-resources/pubsub/generator.json +0 -4
- package/generators/common-resources/pubsub/get-gcp-projects.js +0 -34
- package/generators/common-resources/pubsub/handle-subscribers.js +0 -63
- package/generators/common-resources/pubsub/index.js +0 -316
- package/generators/common-resources/pubsub/templates/pubsub/spec.hcl +0 -7
- package/generators/common-resources/pubsub/templates/pubsub/subscribers.yaml +0 -16
- package/generators/common-resources/pubsub/templates/pubsub/terragrunt.hcl +0 -34
- package/generators/common-resources/pubsub/templates/pubsub-dlq/terragrunt.hcl +0 -42
- package/generators/common-resources/pubsub/templates/pubsub-external/spec.hcl +0 -10
- package/generators/common-resources/pubsub/templates/pubsub-external/subscribers.yaml +0 -16
- package/generators/common-resources/pubsub/templates/pubsub-external/terragrunt.hcl +0 -31
- package/generators/common-resources/pubsub/validate.js +0 -44
- package/generators/common-resources/scheduler/append.js +0 -83
- package/generators/common-resources/scheduler/generator.json +0 -4
- package/generators/common-resources/scheduler/index.js +0 -103
- package/generators/common-resources/scheduler/templates/scheduler/terragrunt.hcl +0 -44
- package/generators/common-resources/spanner/append.js +0 -27
- package/generators/common-resources/spanner/generator.json +0 -4
- package/generators/common-resources/spanner/index.js +0 -169
- package/generators/common-resources/spanner/templates/spanner/databases.yaml +0 -5
- package/generators/common-resources/spanner/templates/spanner/spec.hcl +0 -22
- package/generators/common-resources/spanner/templates/spanner/terragrunt.hcl +0 -33
- package/generators/common-resources/spanner/validate.js +0 -38
- package/generators/docs/command.json +0 -7
- package/generators/docs/rca/generator.json +0 -4
- package/generators/docs/rca/index.js +0 -50
- package/generators/docs/rca/templates/docs/rca_external.md +0 -43
- package/generators/docs/rca/templates/docs/rca_internal.md +0 -88
- package/generators/docs/runbook/generator.json +0 -4
- package/generators/docs/runbook/index.js +0 -42
- package/generators/docs/runbook/templates/docs/runbook.md +0 -106
- package/generators/docs/srb/generator.json +0 -4
- package/generators/docs/srb/index.js +0 -62
- package/generators/docs/srb/templates/docs/README.md +0 -42
- package/generators/docs/srb/templates/docs/adr.cmd +0 -3
- package/generators/docs/srb/templates/docs/adr.sh +0 -4
- package/generators/docs/srb/templates/docs/architecture.md +0 -68
- package/generators/docs/srb/templates/docs/cost-estimates.md +0 -39
- package/generators/docs/srb/templates/docs/dsl2png.cmd +0 -3
- package/generators/docs/srb/templates/docs/dsl2png.sh +0 -4
- package/generators/docs/srb/templates/docs/sre.md +0 -43
- package/generators/docs/srb/templates/sample.dsl +0 -36
- package/generators/init/clan-infra/gcp-projects.js +0 -36
- package/generators/init/clan-infra/generator.json +0 -4
- package/generators/init/clan-infra/index.js +0 -170
- package/generators/init/clan-infra/templates/.yamllint +0 -17
- package/generators/init/clan-infra/templates/env/project.hcl +0 -15
- package/generators/init/clan-infra/templates/env/secrets/secrets.yaml +0 -4
- package/generators/init/clan-infra/templates/env/secrets/terragrunt.hcl +0 -31
- package/generators/init/clan-infra/templates/github/CODEOWNERS +0 -1
- package/generators/init/clan-infra/templates/github/workflows/infra-verify.yml +0 -16
- package/generators/init/clan-infra/templates/github/workflows/infra.yml +0 -17
- package/generators/init/clan-infra/templates/github/workflows/release-notes.yml +0 -33
- package/generators/init/clan-infra/templates/github/workflows/sync-docs.yml +0 -29
- package/generators/init/clan-infra/templates/infra/.terraform-version +0 -1
- package/generators/init/clan-infra/templates/infra/.terragrunt-version +0 -1
- package/generators/init/clan-infra/templates/infra/README.md +0 -5
- package/generators/init/clan-infra/templates/infra/common.hcl +0 -24
- package/generators/init/clan-infra/templates/infra/terragrunt_root.hcl +0 -44
- package/generators/init/clan-infra/templates/notification-channels/notification-channels.yaml +0 -7
- package/generators/init/clan-infra/templates/notification-channels/terragrunt.hcl +0 -29
- package/generators/init/clan-infra/templates/release-notes/example-service.yaml +0 -23
- package/generators/init/clan-infra/templates/release-notes-schema/release-notes.schema.json +0 -63
- package/generators/init/clan-infra/tribe-clan-repo.js +0 -38
- package/generators/init/clan-infra/validate.js +0 -8
- package/generators/init/command.json +0 -7
- package/generators/maintenance/command.json +0 -7
- package/generators/maintenance/manage-states/generator.json +0 -4
- package/generators/maintenance/manage-states/index.js +0 -188
- package/generators/maintenance/update-modules/generator.json +0 -4
- package/generators/maintenance/update-modules/index.js +0 -102
- package/generators/organization/clan-project/__tests__/__snapshots__/googlecloud.test.js.snap +0 -27
- package/generators/organization/clan-project/generator.json +0 -4
- package/generators/organization/clan-project/googlecloud.js +0 -119
- package/generators/organization/clan-project/index.js +0 -139
- package/generators/organization/clan-project/templates/clan/clan.yaml +0 -22
- package/generators/organization/clan-project/templates/clan/terragrunt.hcl +0 -39
- package/generators/organization/clan-project/templates/clan-project/project.yaml +0 -14
- package/generators/organization/clan-project/templates/clan-project/terragrunt.hcl +0 -51
- package/generators/organization/clan-project/templates/clans-folder/terragrunt.hcl +0 -3
- package/generators/organization/clan-project/templates/department/terragrunt.hcl +0 -32
- package/generators/organization/clan-project/templates/tribe/terragrunt.hcl +0 -67
- package/generators/organization/clan-project/templates/tribe/tribe.yaml +0 -19
- package/generators/organization/command.json +0 -8
- package/src/BaseGenerator.js +0 -73
- package/src/SecretsGenerator.js +0 -105
- package/src/cli.js +0 -73
- package/src/dependency-check.js +0 -48
- package/src/update-check.js +0 -30
- package/src/validators.js +0 -32
- package/src/yeoman.js +0 -71
package/README.md
CHANGED
|
@@ -1,69 +1,32 @@
|
|
|
1
|
-

|
|
2
|
-
[](https://sonarcloud.io/dashboard?id=extenda_gcp-infra-cli)
|
|
3
|
-
|
|
4
1
|
# gcp-infra-cli
|
|
5
2
|
|
|
6
|
-
This
|
|
3
|
+
This package is the CLI used to generate Terragrunt specifications for GCP infrastructure.
|
|
7
4
|
|
|
8
5
|
The CLI groups resource-specific generators into commands.
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
* `init` -- Initialize repositories for infrastructure
|
|
8
|
+
* `clan-resources` -- Create GCP resources
|
|
9
|
+
* `common-resources` -- Create GCP resources
|
|
10
|
+
* `docs` - Create documentation templates
|
|
12
11
|
|
|
13
|
-
The normal workflow is to run `init` once in a repository and then use the
|
|
12
|
+
The normal workflow is to run `init` once in a repository and then use one of the resources generators to
|
|
14
13
|
add GCP resources required by the developed services.
|
|
15
14
|
|
|
16
15
|
See the [`tf-infra-gcp` clan resources](https://github.com/extenda/tf-infra-gcp/tree/master/docs/clan-resources.md)
|
|
17
16
|
documentation for a in-depth description of the contents this CLI is able to generate.
|
|
18
17
|
|
|
19
|
-
|
|
20
18
|
## Usage
|
|
21
19
|
|
|
22
20
|
Download the CLI using NPM.
|
|
23
21
|
|
|
24
22
|
```bash
|
|
25
|
-
|
|
23
|
+
npm install --global @hiiretail/gcp-infra-cli
|
|
26
24
|
```
|
|
27
25
|
|
|
28
26
|
If run without the arguments, the help will be displayed.
|
|
29
27
|
|
|
30
28
|
```
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
See detail documentation for all supported commands in [DOCUMENTATION.md](./DOCUMENTATION.md).
|
|
35
|
-
|
|
36
|
-
Changelog of key features is available in [CHANGELOG.md](./CHANGELOG.md)
|
|
37
|
-
|
|
38
|
-
## Development
|
|
39
|
-
|
|
40
|
-
Development tools needed are:
|
|
41
|
-
|
|
42
|
-
* Latest Node 16 LTS release
|
|
43
|
-
* Docker
|
|
44
|
-
* Pre-commit
|
|
45
|
-
|
|
46
|
-
### Pre-commit hooks
|
|
47
|
-
|
|
48
|
-
Developers should use [pre-commit](https://pre-commit.com) on this repository to validate file formatting and commit
|
|
49
|
-
messages on every commit. After pre-commit has been installed on your system, activate on the repository.
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
$ pre-commit install -t pre-commit -t commit-msg
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Get started
|
|
56
|
-
|
|
57
|
-
After cloning the repository, install the dependencies.
|
|
58
|
-
```bash
|
|
59
|
-
$ npm install
|
|
29
|
+
gcp-infra --help
|
|
60
30
|
```
|
|
61
31
|
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
$ npm link
|
|
65
|
-
```
|
|
66
|
-
This will symlink the binary, making it possible to run like this:
|
|
67
|
-
```bash
|
|
68
|
-
$ gcp-infra
|
|
69
|
-
```
|
|
32
|
+
See detail documentation for all supported commands in [DOCUMENTATION.md](../../DOCUMENTATION.md).
|
package/bin/gcp-infra
CHANGED
package/package.json
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hiiretail/gcp-infra-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Infrastructure as code generator for GCP.",
|
|
5
|
-
"main": "src/
|
|
5
|
+
"main": "src/gcp-infra.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"gcp-infra": "bin/gcp-infra",
|
|
8
8
|
"@hiiretail/gcp-infra": "bin/gcp-infra"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"
|
|
12
|
-
"start": "node src/cli.js",
|
|
13
|
-
"test": "jest"
|
|
11
|
+
"start": "bin/gcp-infra"
|
|
14
12
|
},
|
|
15
13
|
"files": [
|
|
16
|
-
"
|
|
17
|
-
"!generators/**/*.test.js",
|
|
14
|
+
"!src/*.test.js",
|
|
18
15
|
"src"
|
|
19
16
|
],
|
|
20
17
|
"repository": "github:extenda/gcp-infra-cli",
|
|
18
|
+
"readme": "https://github.com/extenda/gcp-infra-cli/tree/master/packages/gcp-infra#readme",
|
|
21
19
|
"author": {
|
|
22
20
|
"name": "Extenda Retail",
|
|
23
21
|
"email": "info@extendaretail.com",
|
|
@@ -30,28 +28,7 @@
|
|
|
30
28
|
"cli"
|
|
31
29
|
],
|
|
32
30
|
"dependencies": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"commander": "^5.1.0",
|
|
36
|
-
"enquirer-separator": "^0.1.0",
|
|
37
|
-
"glob": "^7.1.6",
|
|
38
|
-
"inquirer": "^7.3.3",
|
|
39
|
-
"js-yaml": "^4.1.0",
|
|
40
|
-
"npm-api": "^1.0.0",
|
|
41
|
-
"semver": "^7.3.2",
|
|
42
|
-
"sprintf-js": "^1.1.2",
|
|
43
|
-
"yeoman-environment": "^2.10.3",
|
|
44
|
-
"yeoman-generator": "^4.13.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"eslint": "^6.8.0",
|
|
48
|
-
"eslint-config-airbnb-base": "^14.0.0",
|
|
49
|
-
"eslint-plugin-import": "^2.21.1",
|
|
50
|
-
"jest": "^27.5.1",
|
|
51
|
-
"jest-sonar": "^0.2.5",
|
|
52
|
-
"mock-fs": "^4.12.0",
|
|
53
|
-
"sprintf-js": "^1.1.2",
|
|
54
|
-
"yeoman-assert": "^3.1.1",
|
|
55
|
-
"yeoman-test": "^2.7.0"
|
|
31
|
+
"semver": "^7.7.2",
|
|
32
|
+
"tar": "^7.4.3"
|
|
56
33
|
}
|
|
57
34
|
}
|
package/src/gcp-infra.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const { existsSync, createWriteStream } = require('fs');
|
|
2
|
+
const fs = require('fs/promises');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const { Readable } = require('stream');
|
|
5
|
+
const { finished } = require('stream/promises');
|
|
6
|
+
const tar = require('tar');
|
|
7
|
+
const semver = require('semver');
|
|
8
|
+
const home = require('os').homedir();
|
|
9
|
+
const { version: cliVersion } = require('../package.json');
|
|
10
|
+
|
|
11
|
+
const downloads = path.resolve(home, 'extenda', 'gcp-infra');
|
|
12
|
+
const PROD_SOURCE = path.resolve(downloads, 'src');
|
|
13
|
+
const DEV_SOURCE = path.resolve(__dirname, '..', '..', 'generators', 'src');
|
|
14
|
+
|
|
15
|
+
const packageName = '@hiiretail/gcp-infra-generators';
|
|
16
|
+
|
|
17
|
+
const downloadGenerators = async (version) => {
|
|
18
|
+
try {
|
|
19
|
+
await fs.rm(downloads, { recursive: true, force: true });
|
|
20
|
+
await fs.mkdir(downloads, { recursive: true });
|
|
21
|
+
const tarball = path.resolve(downloads, `generators-${version}.tgz`);
|
|
22
|
+
const registryName = packageName.replace('@hiiretail/', '');
|
|
23
|
+
const url = `https://registry.npmjs.org/${packageName}/-/${registryName}-${version}.tgz`;
|
|
24
|
+
|
|
25
|
+
const response = await fetch(url);
|
|
26
|
+
if (response.ok && response.body) {
|
|
27
|
+
await finished(
|
|
28
|
+
Readable.fromWeb(response.body).pipe(createWriteStream(tarball)),
|
|
29
|
+
);
|
|
30
|
+
await tar.x({ f: tarball, z: true, C: downloads, strip: 1 });
|
|
31
|
+
await fs.rm(tarball);
|
|
32
|
+
return `downloaded ${version}`;
|
|
33
|
+
}
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.error('Failed to download generators', err);
|
|
36
|
+
}
|
|
37
|
+
return 'download failed';
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const getRegistryVersion = async () =>
|
|
41
|
+
fetch(`https://registry.npmjs.org/${packageName}`)
|
|
42
|
+
.then((response) => response.json())
|
|
43
|
+
.then((data) => {
|
|
44
|
+
const {
|
|
45
|
+
'dist-tags': { latest },
|
|
46
|
+
} = data;
|
|
47
|
+
return latest;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const clientSource = () => [DEV_SOURCE, PROD_SOURCE].find(existsSync);
|
|
51
|
+
|
|
52
|
+
const autoUpdate = async (source = clientSource()) => {
|
|
53
|
+
if (!source) {
|
|
54
|
+
console.log(`Installing ${packageName} from npmjs.org`);
|
|
55
|
+
return downloadGenerators(await getRegistryVersion());
|
|
56
|
+
} else if (source === PROD_SOURCE) {
|
|
57
|
+
const registryVersion = await getRegistryVersion();
|
|
58
|
+
const { version: installedVersion } = JSON.parse(
|
|
59
|
+
await fs.readFile(path.resolve(source, '..', 'package.json'), 'utf8'),
|
|
60
|
+
);
|
|
61
|
+
if (semver.gt(registryVersion, installedVersion)) {
|
|
62
|
+
console.log(
|
|
63
|
+
`Updating ${packageName}@${installedVersion} to ${registryVersion}`,
|
|
64
|
+
);
|
|
65
|
+
return downloadGenerators(registryVersion);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return 'no update';
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const execute = async (argv, exitOverride) => {
|
|
72
|
+
const source = clientSource();
|
|
73
|
+
if (source) {
|
|
74
|
+
const modulePath = path.resolve(source, 'cli');
|
|
75
|
+
if (existsSync(`${modulePath}.js`)) {
|
|
76
|
+
await require(modulePath)(argv, exitOverride, cliVersion);
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
console.log('No generators found!');
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
module.exports = {
|
|
84
|
+
productionSource: () => PROD_SOURCE,
|
|
85
|
+
autoUpdate,
|
|
86
|
+
execute,
|
|
87
|
+
};
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Extenda Retail
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,135 +0,0 @@
|
|
|
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
|
-
};
|
package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat/terragrunt.hcl
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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-cloud-nat//?ref=v5.2.0"
|
|
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 "network" {
|
|
13
|
-
config_path = "../network"
|
|
14
|
-
mock_outputs = {
|
|
15
|
-
network_name = "network-dummy-name"
|
|
16
|
-
project_id = "dummy-id"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
dependency "router" {
|
|
21
|
-
config_path = "../cloud-router"
|
|
22
|
-
mock_outputs = {
|
|
23
|
-
router = {
|
|
24
|
-
name = "router-dummy-name"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
dependency "static_ip" {
|
|
30
|
-
config_path = "../cloud-nat-static-ip"
|
|
31
|
-
mock_outputs = {
|
|
32
|
-
names = ["ip-name"]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
locals {
|
|
37
|
-
clan_name = basename(dirname(dirname(dirname(get_terragrunt_dir()))))
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
41
|
-
inputs = merge(
|
|
42
|
-
{
|
|
43
|
-
name = "${local.clan_name}-cloud-nat"
|
|
44
|
-
region = "europe-west1"
|
|
45
|
-
project_id = dependency.network.outputs.project_id
|
|
46
|
-
network = dependency.network.outputs.network_name
|
|
47
|
-
router = dependency.router.outputs.router.name
|
|
48
|
-
nat_ips = dependency.static_ip.outputs.names
|
|
49
|
-
|
|
50
|
-
enable_endpoint_independent_mapping = false
|
|
51
|
-
}
|
|
52
|
-
)
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
terraform {
|
|
2
|
-
source = "git::https://github.com/terraform-google-modules/terraform-google-address//?ref=v4.0.0"
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
dependency "project" {
|
|
6
|
-
config_path = "../../"
|
|
7
|
-
mock_outputs = {
|
|
8
|
-
project_id = "project-dummy-id"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
include {
|
|
13
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
locals {
|
|
17
|
-
spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
inputs = merge(
|
|
21
|
-
local.spec_vars.locals,
|
|
22
|
-
{
|
|
23
|
-
project_id = dependency.project.outputs.project_id
|
|
24
|
-
}
|
|
25
|
-
)
|
package/generators/clan-resources/clan-project/templates/clan-resources/cloud-router/terragrunt.hcl
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
terraform {
|
|
2
|
-
source = "git::https://github.com/terraform-google-modules/terraform-google-cloud-router//?ref=v6.0.2"
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
dependency "project" {
|
|
6
|
-
config_path = "../../"
|
|
7
|
-
mock_outputs = {
|
|
8
|
-
project_id = "project-dummy-id"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
dependency "network" {
|
|
13
|
-
config_path = "../network"
|
|
14
|
-
mock_outputs = {
|
|
15
|
-
network_name = "network-dummy-name"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
include {
|
|
20
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
locals {
|
|
24
|
-
clan_name = basename(dirname(dirname(dirname(get_terragrunt_dir()))))
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
inputs = merge(
|
|
28
|
-
{
|
|
29
|
-
name = "${local.clan_name}-router"
|
|
30
|
-
region = "europe-west1"
|
|
31
|
-
project = dependency.project.outputs.project_id
|
|
32
|
-
network = dependency.network.outputs.network_name
|
|
33
|
-
}
|
|
34
|
-
)
|
|
@@ -1,40 +0,0 @@
|
|
|
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 = base64encode("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
|
-
)
|
|
@@ -1,18 +0,0 @@
|
|
|
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 = false #needs to be changed to true after the first apply
|
|
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,52 +0,0 @@
|
|
|
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
|
-
# temp solution, change to the latest release once this is merged
|
|
5
|
-
source = "git::https://github.com/pziggo/terraform-google-kubernetes-engine//modules/beta-autopilot-private-cluster?ref=pziggo_autopilot_dns_config"
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
# Include all settings from the root terragrunt.hcl file
|
|
9
|
-
include {
|
|
10
|
-
path = find_in_parent_folders("terragrunt_root.hcl")
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
dependency "project" {
|
|
14
|
-
config_path = "../../"
|
|
15
|
-
mock_outputs = {
|
|
16
|
-
project_id = "project-dummy-id"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
dependency "network" {
|
|
21
|
-
config_path = "../network"
|
|
22
|
-
mock_outputs = {
|
|
23
|
-
network_name = "network-dummy-name"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
locals {
|
|
28
|
-
spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
|
|
29
|
-
tribe_yaml = yamldecode(file(find_in_parent_folders("tribe.yaml")))
|
|
30
|
-
clan_name = basename(dirname(dirname(dirname(get_terragrunt_dir()))))
|
|
31
|
-
env_name = basename(dirname(dirname(get_terragrunt_dir())))
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above
|
|
35
|
-
inputs = merge(
|
|
36
|
-
local.spec_vars.locals,
|
|
37
|
-
{
|
|
38
|
-
name = "${local.clan_name}-cluster-${local.env_name}"
|
|
39
|
-
project_id = dependency.project.outputs.project_id
|
|
40
|
-
network = dependency.network.outputs.network_name
|
|
41
|
-
subnetwork = "k8s-subnet"
|
|
42
|
-
identity_namespace = "${dependency.project.outputs.project_id}.svc.id.goog"
|
|
43
|
-
authenticator_security_group = "gke-security-groups@extendaretail.com"
|
|
44
|
-
registry_project_ids = ["extenda"]
|
|
45
|
-
cluster_resource_labels = {
|
|
46
|
-
cc = local.tribe_yaml.costcenter
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Binary Auth must be Enabled manually in this console - not supported by the module yet
|
|
50
|
-
enable_binary_authorization = true
|
|
51
|
-
}
|
|
52
|
-
)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
resource "google_compute_firewall" "dataflow-workers" {
|
|
2
|
-
name = "allow-dataflow-workers"
|
|
3
|
-
network = var.network
|
|
4
|
-
project = var.project
|
|
5
|
-
|
|
6
|
-
allow {
|
|
7
|
-
protocol = "tcp"
|
|
8
|
-
ports = ["12345-12346"]
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
priority = 0
|
|
12
|
-
direction = "INGRESS"
|
|
13
|
-
source_tags = ["dataflow"]
|
|
14
|
-
target_tags = ["dataflow"]
|
|
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
|
-
}
|
|
29
|
-
|
|
30
|
-
resource "google_compute_firewall" "allow_internal_lb" {
|
|
31
|
-
name = "allow-internal-lb"
|
|
32
|
-
network = var.network
|
|
33
|
-
project = var.project
|
|
34
|
-
|
|
35
|
-
allow {
|
|
36
|
-
protocol = "all"
|
|
37
|
-
}
|
|
38
|
-
source_ranges = ["10.10.0.0/23"]
|
|
39
|
-
priority = 1000
|
|
40
|
-
direction = "INGRESS"
|
|
41
|
-
}
|