@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.
Files changed (217) hide show
  1. package/README.md +9 -46
  2. package/bin/gcp-infra +5 -2
  3. package/package.json +7 -30
  4. package/src/gcp-infra.js +87 -0
  5. package/LICENSE +0 -21
  6. package/generators/clan-resources/clan-project/generator.json +0 -4
  7. package/generators/clan-resources/clan-project/index.js +0 -135
  8. package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat/terragrunt.hcl +0 -52
  9. package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat-static-ip/spec.hcl +0 -7
  10. package/generators/clan-resources/clan-project/templates/clan-resources/cloud-nat-static-ip/terragrunt.hcl +0 -25
  11. package/generators/clan-resources/clan-project/templates/clan-resources/cloud-router/terragrunt.hcl +0 -34
  12. package/generators/clan-resources/clan-project/templates/clan-resources/gke/gke-resources/terragrunt.hcl +0 -40
  13. package/generators/clan-resources/clan-project/templates/clan-resources/gke/spec.hcl +0 -18
  14. package/generators/clan-resources/clan-project/templates/clan-resources/gke/terragrunt.hcl +0 -52
  15. package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/config/main.tf +0 -41
  16. package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/config/vars.tf +0 -9
  17. package/generators/clan-resources/clan-project/templates/clan-resources/network/firewall-rules/terragrunt.hcl +0 -32
  18. package/generators/clan-resources/clan-project/templates/clan-resources/network/spec.hcl +0 -54
  19. package/generators/clan-resources/clan-project/templates/clan-resources/network/terragrunt.hcl +0 -29
  20. package/generators/clan-resources/clan-project/templates/clan-resources/private-vpc-connection/config/main.tf +0 -18
  21. package/generators/clan-resources/clan-project/templates/clan-resources/private-vpc-connection/config/vars.tf +0 -27
  22. package/generators/clan-resources/clan-project/templates/clan-resources/private-vpc-connection/terragrunt.hcl +0 -35
  23. package/generators/clan-resources/clan-project/templates/clan-resources/serverless-vpc-connector/terragrunt.hcl +0 -40
  24. package/generators/clan-resources/clan-project/templates/clan-resources/terragrunt.hcl +0 -3
  25. package/generators/clan-resources/command.json +0 -7
  26. package/generators/common-resources/bigquery/generator.json +0 -4
  27. package/generators/common-resources/bigquery/index.js +0 -284
  28. package/generators/common-resources/bigquery/templates/bigquery/spec.hcl +0 -8
  29. package/generators/common-resources/bigquery/templates/bigquery/terragrunt.hcl +0 -53
  30. package/generators/common-resources/bigquery/templates/scheduled-queries/terragrunt.hcl +0 -56
  31. package/generators/common-resources/bigquery/templates/schema/schema.json +0 -14
  32. package/generators/common-resources/budget/generator.json +0 -4
  33. package/generators/common-resources/budget/index.js +0 -89
  34. package/generators/common-resources/budget/templates/budget/terragrunt.hcl +0 -45
  35. package/generators/common-resources/cloud-armor/generator.json +0 -4
  36. package/generators/common-resources/cloud-armor/index.js +0 -45
  37. package/generators/common-resources/cloud-armor/templates/policies.yaml +0 -53
  38. package/generators/common-resources/cloud-armor/templates/terragrunt.hcl +0 -30
  39. package/generators/common-resources/cloud-storage/generator.json +0 -4
  40. package/generators/common-resources/cloud-storage/index.js +0 -156
  41. package/generators/common-resources/cloud-storage/templates/cloud-storage/storage.yaml +0 -26
  42. package/generators/common-resources/cloud-storage/templates/cloud-storage/terragrunt.hcl +0 -32
  43. package/generators/common-resources/cloudsql/generator.json +0 -4
  44. package/generators/common-resources/cloudsql/index.js +0 -106
  45. package/generators/common-resources/cloudsql/templates/mssql/instance/spec.hcl +0 -76
  46. package/generators/common-resources/cloudsql/templates/mssql/instance/terragrunt.hcl +0 -38
  47. package/generators/common-resources/cloudsql/templates/mssql/instance-secrets/terragrunt.hcl +0 -37
  48. package/generators/common-resources/cloudsql/templates/mysql/instance/spec.hcl +0 -73
  49. package/generators/common-resources/cloudsql/templates/mysql/instance/terragrunt.hcl +0 -40
  50. package/generators/common-resources/cloudsql/templates/mysql/instance-secrets/terragrunt.hcl +0 -38
  51. package/generators/common-resources/cloudsql/templates/postgres-clan/instance/spec.hcl +0 -102
  52. package/generators/common-resources/cloudsql/templates/postgres-clan/instance/terragrunt.hcl +0 -36
  53. package/generators/common-resources/cloudsql/templates/postgres-clan/instance-secrets/terragrunt.hcl +0 -44
  54. package/generators/common-resources/cloudsql-database/generator.json +0 -4
  55. package/generators/common-resources/cloudsql-database/index.js +0 -70
  56. package/generators/common-resources/cloudsql-database/templates/mysql/database/proxy_port.hcl +0 -4
  57. package/generators/common-resources/cloudsql-database/templates/mysql/database/terragrunt.hcl +0 -69
  58. package/generators/common-resources/cloudsql-database/templates/mysql/outputs.json +0 -5
  59. package/generators/common-resources/cloudsql-database/templates/mysql/secrets/terragrunt.hcl +0 -30
  60. package/generators/common-resources/cloudsql-database/templates/postgres/database/proxy_port.hcl +0 -4
  61. package/generators/common-resources/cloudsql-database/templates/postgres/database/spec.hcl +0 -17
  62. package/generators/common-resources/cloudsql-database/templates/postgres/database/terragrunt.hcl +0 -74
  63. package/generators/common-resources/cloudsql-database/templates/postgres/outputs.json +0 -5
  64. package/generators/common-resources/cloudsql-database/templates/postgres/secrets/terragrunt.hcl +0 -30
  65. package/generators/common-resources/command.json +0 -8
  66. package/generators/common-resources/confluent-cluster/generator.json +0 -4
  67. package/generators/common-resources/confluent-cluster/index.js +0 -52
  68. package/generators/common-resources/confluent-cluster/templates/confluent/spec.hcl +0 -5
  69. package/generators/common-resources/confluent-cluster/templates/confluent/terragrunt.hcl +0 -25
  70. package/generators/common-resources/datastore/generator.json +0 -4
  71. package/generators/common-resources/datastore/index.js +0 -91
  72. package/generators/common-resources/datastore/templates/datastore/indexes.yaml +0 -6
  73. package/generators/common-resources/datastore/templates/datastore/terragrunt.hcl +0 -23
  74. package/generators/common-resources/elastic-cloud/generator.json +0 -4
  75. package/generators/common-resources/elastic-cloud/index.js +0 -52
  76. package/generators/common-resources/elastic-cloud/templates/elastic/spec.hcl +0 -27
  77. package/generators/common-resources/elastic-cloud/templates/elastic/terragrunt.hcl +0 -27
  78. package/generators/common-resources/elastic-index-policy/generator.json +0 -4
  79. package/generators/common-resources/elastic-index-policy/handle-yaml.js +0 -76
  80. package/generators/common-resources/elastic-index-policy/index.js +0 -210
  81. package/generators/common-resources/elastic-index-policy/templates/policy/policy.yaml +0 -28
  82. package/generators/common-resources/elastic-index-policy/templates/policy/terragrunt.hcl +0 -25
  83. package/generators/common-resources/elastic-template/generator.json +0 -4
  84. package/generators/common-resources/elastic-template/index.js +0 -84
  85. package/generators/common-resources/elastic-template/templates/elastic-template/mappings.json +0 -1
  86. package/generators/common-resources/elastic-template/templates/elastic-template/terragrunt.hcl +0 -35
  87. package/generators/common-resources/firestore/generator.json +0 -4
  88. package/generators/common-resources/firestore/index.js +0 -141
  89. package/generators/common-resources/firestore/templates/firestore/indexes/indexes.yaml +0 -12
  90. package/generators/common-resources/firestore/templates/firestore/indexes/terragrunt.hcl +0 -27
  91. package/generators/common-resources/firestore/templates/firestore/spec.hcl +0 -31
  92. package/generators/common-resources/firestore/templates/firestore/terragrunt.hcl +0 -25
  93. package/generators/common-resources/iam/generator.json +0 -4
  94. package/generators/common-resources/iam/index.js +0 -62
  95. package/generators/common-resources/iam/templates/github/workflows/iam.yml +0 -18
  96. package/generators/common-resources/iam/templates/iam.yaml +0 -8
  97. package/generators/common-resources/iam/valid-prefix.js +0 -8
  98. package/generators/common-resources/kafka-connect/generator.json +0 -4
  99. package/generators/common-resources/kafka-connect/index.js +0 -75
  100. package/generators/common-resources/kafka-connect/templates/elastic/terragrunt.hcl +0 -92
  101. package/generators/common-resources/kafka-connect/templates/pubsub/terragrunt.hcl +0 -75
  102. package/generators/common-resources/kafka-topics/generator.json +0 -4
  103. package/generators/common-resources/kafka-topics/index.js +0 -54
  104. package/generators/common-resources/kafka-topics/templates/kafka/kafka.yaml +0 -20
  105. package/generators/common-resources/kafka-topics/templates/kafka/terragrunt.hcl +0 -21
  106. package/generators/common-resources/kms/generator.json +0 -4
  107. package/generators/common-resources/kms/index.js +0 -69
  108. package/generators/common-resources/kms/templates/kms/spec.hcl +0 -5
  109. package/generators/common-resources/kms/templates/kms/terragrunt.hcl +0 -33
  110. package/generators/common-resources/memorystore/generator.json +0 -4
  111. package/generators/common-resources/memorystore/index.js +0 -69
  112. package/generators/common-resources/memorystore/templates/outputs.json +0 -3
  113. package/generators/common-resources/memorystore/templates/redis-instance/spec.hcl +0 -16
  114. package/generators/common-resources/memorystore/templates/redis-instance/terragrunt.hcl +0 -35
  115. package/generators/common-resources/memorystore/templates/secrets/terragrunt.hcl +0 -31
  116. package/generators/common-resources/monitoring/generator.json +0 -4
  117. package/generators/common-resources/monitoring/handle-yaml.js +0 -48
  118. package/generators/common-resources/monitoring/index.js +0 -192
  119. package/generators/common-resources/monitoring/templates/alerts/generic-infra.yaml +0 -633
  120. package/generators/common-resources/monitoring/templates/alerts/terragrunt.hcl +0 -37
  121. package/generators/common-resources/monitoring/templates/service/service.yaml +0 -16
  122. package/generators/common-resources/monitoring/templates/service/terragrunt.hcl +0 -37
  123. package/generators/common-resources/monitoring/templates/uptime-checks/terragrunt.hcl +0 -36
  124. package/generators/common-resources/monitoring/templates/uptime-checks/uptime-checks.yaml +0 -3
  125. package/generators/common-resources/monitoring/validate.js +0 -58
  126. package/generators/common-resources/pubsub/append.js +0 -120
  127. package/generators/common-resources/pubsub/generator.json +0 -4
  128. package/generators/common-resources/pubsub/get-gcp-projects.js +0 -34
  129. package/generators/common-resources/pubsub/handle-subscribers.js +0 -63
  130. package/generators/common-resources/pubsub/index.js +0 -316
  131. package/generators/common-resources/pubsub/templates/pubsub/spec.hcl +0 -7
  132. package/generators/common-resources/pubsub/templates/pubsub/subscribers.yaml +0 -16
  133. package/generators/common-resources/pubsub/templates/pubsub/terragrunt.hcl +0 -34
  134. package/generators/common-resources/pubsub/templates/pubsub-dlq/terragrunt.hcl +0 -42
  135. package/generators/common-resources/pubsub/templates/pubsub-external/spec.hcl +0 -10
  136. package/generators/common-resources/pubsub/templates/pubsub-external/subscribers.yaml +0 -16
  137. package/generators/common-resources/pubsub/templates/pubsub-external/terragrunt.hcl +0 -31
  138. package/generators/common-resources/pubsub/validate.js +0 -44
  139. package/generators/common-resources/scheduler/append.js +0 -83
  140. package/generators/common-resources/scheduler/generator.json +0 -4
  141. package/generators/common-resources/scheduler/index.js +0 -103
  142. package/generators/common-resources/scheduler/templates/scheduler/terragrunt.hcl +0 -44
  143. package/generators/common-resources/spanner/append.js +0 -27
  144. package/generators/common-resources/spanner/generator.json +0 -4
  145. package/generators/common-resources/spanner/index.js +0 -169
  146. package/generators/common-resources/spanner/templates/spanner/databases.yaml +0 -5
  147. package/generators/common-resources/spanner/templates/spanner/spec.hcl +0 -22
  148. package/generators/common-resources/spanner/templates/spanner/terragrunt.hcl +0 -33
  149. package/generators/common-resources/spanner/validate.js +0 -38
  150. package/generators/docs/command.json +0 -7
  151. package/generators/docs/rca/generator.json +0 -4
  152. package/generators/docs/rca/index.js +0 -50
  153. package/generators/docs/rca/templates/docs/rca_external.md +0 -43
  154. package/generators/docs/rca/templates/docs/rca_internal.md +0 -88
  155. package/generators/docs/runbook/generator.json +0 -4
  156. package/generators/docs/runbook/index.js +0 -42
  157. package/generators/docs/runbook/templates/docs/runbook.md +0 -106
  158. package/generators/docs/srb/generator.json +0 -4
  159. package/generators/docs/srb/index.js +0 -62
  160. package/generators/docs/srb/templates/docs/README.md +0 -42
  161. package/generators/docs/srb/templates/docs/adr.cmd +0 -3
  162. package/generators/docs/srb/templates/docs/adr.sh +0 -4
  163. package/generators/docs/srb/templates/docs/architecture.md +0 -68
  164. package/generators/docs/srb/templates/docs/cost-estimates.md +0 -39
  165. package/generators/docs/srb/templates/docs/dsl2png.cmd +0 -3
  166. package/generators/docs/srb/templates/docs/dsl2png.sh +0 -4
  167. package/generators/docs/srb/templates/docs/sre.md +0 -43
  168. package/generators/docs/srb/templates/sample.dsl +0 -36
  169. package/generators/init/clan-infra/gcp-projects.js +0 -36
  170. package/generators/init/clan-infra/generator.json +0 -4
  171. package/generators/init/clan-infra/index.js +0 -170
  172. package/generators/init/clan-infra/templates/.yamllint +0 -17
  173. package/generators/init/clan-infra/templates/env/project.hcl +0 -15
  174. package/generators/init/clan-infra/templates/env/secrets/secrets.yaml +0 -4
  175. package/generators/init/clan-infra/templates/env/secrets/terragrunt.hcl +0 -31
  176. package/generators/init/clan-infra/templates/github/CODEOWNERS +0 -1
  177. package/generators/init/clan-infra/templates/github/workflows/infra-verify.yml +0 -16
  178. package/generators/init/clan-infra/templates/github/workflows/infra.yml +0 -17
  179. package/generators/init/clan-infra/templates/github/workflows/release-notes.yml +0 -33
  180. package/generators/init/clan-infra/templates/github/workflows/sync-docs.yml +0 -29
  181. package/generators/init/clan-infra/templates/infra/.terraform-version +0 -1
  182. package/generators/init/clan-infra/templates/infra/.terragrunt-version +0 -1
  183. package/generators/init/clan-infra/templates/infra/README.md +0 -5
  184. package/generators/init/clan-infra/templates/infra/common.hcl +0 -24
  185. package/generators/init/clan-infra/templates/infra/terragrunt_root.hcl +0 -44
  186. package/generators/init/clan-infra/templates/notification-channels/notification-channels.yaml +0 -7
  187. package/generators/init/clan-infra/templates/notification-channels/terragrunt.hcl +0 -29
  188. package/generators/init/clan-infra/templates/release-notes/example-service.yaml +0 -23
  189. package/generators/init/clan-infra/templates/release-notes-schema/release-notes.schema.json +0 -63
  190. package/generators/init/clan-infra/tribe-clan-repo.js +0 -38
  191. package/generators/init/clan-infra/validate.js +0 -8
  192. package/generators/init/command.json +0 -7
  193. package/generators/maintenance/command.json +0 -7
  194. package/generators/maintenance/manage-states/generator.json +0 -4
  195. package/generators/maintenance/manage-states/index.js +0 -188
  196. package/generators/maintenance/update-modules/generator.json +0 -4
  197. package/generators/maintenance/update-modules/index.js +0 -102
  198. package/generators/organization/clan-project/__tests__/__snapshots__/googlecloud.test.js.snap +0 -27
  199. package/generators/organization/clan-project/generator.json +0 -4
  200. package/generators/organization/clan-project/googlecloud.js +0 -119
  201. package/generators/organization/clan-project/index.js +0 -139
  202. package/generators/organization/clan-project/templates/clan/clan.yaml +0 -22
  203. package/generators/organization/clan-project/templates/clan/terragrunt.hcl +0 -39
  204. package/generators/organization/clan-project/templates/clan-project/project.yaml +0 -14
  205. package/generators/organization/clan-project/templates/clan-project/terragrunt.hcl +0 -51
  206. package/generators/organization/clan-project/templates/clans-folder/terragrunt.hcl +0 -3
  207. package/generators/organization/clan-project/templates/department/terragrunt.hcl +0 -32
  208. package/generators/organization/clan-project/templates/tribe/terragrunt.hcl +0 -67
  209. package/generators/organization/clan-project/templates/tribe/tribe.yaml +0 -19
  210. package/generators/organization/command.json +0 -8
  211. package/src/BaseGenerator.js +0 -73
  212. package/src/SecretsGenerator.js +0 -105
  213. package/src/cli.js +0 -73
  214. package/src/dependency-check.js +0 -48
  215. package/src/update-check.js +0 -30
  216. package/src/validators.js +0 -32
  217. package/src/yeoman.js +0 -71
@@ -1,4 +0,0 @@
1
- # This file need to specify unique cloud_sql_proxy port for every database for Terraform to work correctly
2
- locals {
3
- port = <%- randomPort %>
4
- }
@@ -1,17 +0,0 @@
1
- locals {
2
- ###################
3
- # Optional Inputs #
4
- ###################
5
-
6
- # Collation order (LC_COLLATE) to use in the database. This affects the sort order applied to strings, e.g. in queries
7
- # with ORDER BY, as well as the order used in indexes on text columns. If unset or set to an empty string the default
8
- # collation is set to C. If set to DEFAULT Terraform will use the same collation order as the specified template
9
- # database. Changing this value will force the creation of a new resource as this value can only be changed when a
10
- # database is created.
11
- lc_collate = "C"
12
-
13
- # The name of the template database from which to create the database, or DEFAULT to use the default template
14
- # (template0). NOTE: the default in Terraform is template0, not template1. Changing this value will force the creation
15
- # of a new resource as this value can only be changed when a database is created.
16
- template = "template0"
17
- }
@@ -1,74 +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/extenda/tf-module-postgresql//?ref=v0.1.3"
5
-
6
- before_hook "run_postgres_proxy" {
7
- commands = ["apply", "plan"]
8
- execute = ["sh", "-c",
9
- <<-EOF
10
- set -e
11
- if [ ! -f "cloud_sql_proxy" ]; then
12
- echo "Downloading cloud_sql_proxy binary"
13
- curl -o cloud_sql_proxy https://dl.google.com/cloudsql/cloud_sql_proxy.$(uname | tr '[:upper:]' '[:lower:]').amd64
14
- chmod +x cloud_sql_proxy
15
- fi
16
-
17
- instance="${dependency.instance.outputs.instance_connection_name}"
18
- port="${local.proxy_port.locals.port}"
19
- if pgrep -afx "./cloud_sql_proxy -instances=$instance=tcp:$port"; then
20
- pkill -fx "./cloud_sql_proxy -instances=$instance=tcp:$port"
21
- fi
22
- echo "Starting cloud_sql_proxy for database"
23
- screen -d -m ./cloud_sql_proxy -instances=$instance=tcp:$port
24
- EOF
25
- ]
26
- }
27
-
28
- after_hook "cleanup_proxy" {
29
- commands = ["apply", "plan"]
30
- execute = ["sh", "-c",
31
- <<-EOF
32
- set -e
33
- echo "Killing cloud_sql_proxy for database"
34
- instance="${dependency.instance.outputs.instance_connection_name}"
35
- port="${local.proxy_port.locals.port}"
36
- pkill -fx "./cloud_sql_proxy -instances=$instance=tcp:$port"
37
- EOF
38
- ]
39
- }
40
- }
41
-
42
- include {
43
- path = find_in_parent_folders("terragrunt_root.hcl")
44
- }
45
-
46
- dependency "instance" {
47
- config_path = "../../instance"
48
- mock_outputs = {
49
- generated_user_password = "dummy-password"
50
- }
51
- }
52
-
53
- locals {
54
- spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
55
- db_name = basename(get_terragrunt_dir())
56
- role_name = "${local.db_name}-admin"
57
- proxy_port = read_terragrunt_config("${get_terragrunt_dir()}/proxy_port.hcl")
58
- }
59
-
60
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
61
- inputs = merge(
62
- local.spec_vars.locals,
63
- {
64
- # connect to cloudsql postgres instance through cloudsql proxy
65
- host = "127.0.0.1"
66
- port = local.proxy_port.locals.port
67
- sslmode = "disable"
68
- password = dependency.instance.outputs.generated_user_password
69
- # create postgres database
70
- db_name = local.db_name
71
- role_name = local.role_name
72
- role_allow_login = true
73
- }
74
- )
@@ -1,5 +0,0 @@
1
- {
2
- "password": "role_password",
3
- "user": "role_name",
4
- "name": "db_name"
5
- }
@@ -1,30 +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/extenda/tf-module-gcp-secret-manager//?ref=v0.1.2"
5
- }
6
-
7
- include {
8
- path = find_in_parent_folders("terragrunt_root.hcl")
9
- }
10
-
11
- locals {
12
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
13
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
14
- labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
15
- component = local.common_vars.locals.component
16
- product = local.common_vars.locals.product
17
- tenant-alias = local.common_vars.locals.tenant_alias
18
- terraform = ""
19
- })
20
- }
21
-
22
- <%-dependencies%>
23
-
24
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
25
- inputs = {
26
- project_id = local.project_vars.locals.project_id
27
- secrets = {<%-secrets%>
28
- }
29
- labels = local.labels,
30
- }
@@ -1,8 +0,0 @@
1
- {
2
- "description": "Create common clan GCP resources.",
3
- "query": "What do you want to create?",
4
- "require": [
5
- "git-repo",
6
- "init"
7
- ]
8
- }
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Confluent cluster",
3
- "description": "Create Confluent cluster resources"
4
- }
@@ -1,52 +0,0 @@
1
- const path = require('path');
2
- const chalk = require('chalk');
3
- const BaseGenerator = require('../../../src/BaseGenerator');
4
- const { required } = require('../../../src/validators');
5
-
6
- module.exports = class extends BaseGenerator {
7
- prompting() {
8
- const prompts = [
9
- {
10
- type: 'input',
11
- name: 'clusterName',
12
- message: 'Please provide the cluster name (clan_name and env will be added after the provided name)',
13
- validate: required,
14
- },
15
- ];
16
-
17
- return this.prompt(prompts).then((props) => {
18
- this.answers = props;
19
- });
20
- }
21
-
22
- writing() {
23
- const {
24
- clusterName,
25
- } = this.answers;
26
-
27
- ['prod', 'staging'].forEach((env) => {
28
- this.copyDir(
29
- 'confluent',
30
- path.join('infra', env, 'confluent'),
31
- {
32
- ...this.answers,
33
- env,
34
- clusterName,
35
- },
36
- );
37
- });
38
- }
39
-
40
- end() {
41
- const specStageFile = path.join('infra', 'staging', 'confluent');
42
- const specProdFile = path.join('infra', 'prod', 'confluent');
43
- this.log(`
44
- ${chalk.green(`Your Confluent clusters have now been created. To finalize your configuration, please continue
45
- with manual editing of the generated files.`)}
46
- ${chalk.green('1.')} Review Confluent configuration
47
- \u2192 ${chalk.cyan(path.join(specStageFile, 'spec.hcl'))}
48
- \u2192 ${chalk.cyan(path.join(specProdFile, 'spec.hcl'))}
49
- ${chalk.green('2.')} Push this change in a feature branch and open a pull request.
50
- `);
51
- }
52
- };
@@ -1,5 +0,0 @@
1
- locals {
2
- region = "europe-west1"
3
- availability = "SINGLE_ZONE"
4
- schema_registry_region = "sgreg-5" #europe-west3
5
- }
@@ -1,25 +0,0 @@
1
- terraform {
2
- source = "git::https://github.com/extenda/tf-module-gcp-confluent//?ref=v1.0.0"
3
- }
4
-
5
- locals {
6
- spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
7
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
8
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
9
- }
10
-
11
- # Include all settings from the root terragrunt.hcl file
12
- include {
13
- path = find_in_parent_folders("terragrunt_root.hcl")
14
- }
15
-
16
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
17
- inputs = merge(
18
- local.spec_vars.locals,
19
- {
20
- environment = "${local.common_vars.locals.tribe_name}-${local.common_vars.locals.clan_name}"
21
- name = "<%-clusterName%>-${local.common_vars.locals.tribe_name}-${local.common_vars.locals.clan_name}-${local.project_vars.locals.project_env}"
22
- project_env = "${local.project_vars.locals.project_env}"
23
- project_id = local.project_vars.locals.project_id
24
- }
25
- )
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Datastore",
3
- "description": "Create Datastore indexes"
4
- }
@@ -1,91 +0,0 @@
1
- const path = require('path');
2
- const chalk = require('chalk');
3
- const BaseGenerator = require('../../../src/BaseGenerator');
4
- const { required } = require('../../../src/validators');
5
- const getTribeAndClanName = require('../../init/clan-infra/tribe-clan-repo');
6
-
7
- module.exports = class extends BaseGenerator {
8
- prompting() {
9
- const prompts = [
10
- {
11
- type: 'input',
12
- name: 'serviceName',
13
- default: getTribeAndClanName().clan,
14
- message: 'Enter your service name or press enter to use clan name',
15
- validate: required,
16
- },
17
- {
18
- type: 'input',
19
- name: 'kind',
20
- message: 'Please provide the entity kind which the index applies to',
21
- validate: required,
22
- },
23
- {
24
- type: 'list',
25
- name: 'ancestor',
26
- message: 'Select a policy for including ancestors in the index. Default value is NONE',
27
- default: 'NONE',
28
- choices: ['NONE', 'ALL_ANCESTORS'],
29
- },
30
- {
31
- type: 'list',
32
- name: 'createProperties',
33
- message: 'Do you want to add an ordered list of properties to index on?',
34
- default: 'yes',
35
- choices: ['yes', 'no'],
36
- },
37
- {
38
- when: (response) => response.createProperties === 'yes',
39
- type: 'input',
40
- name: 'propertyName',
41
- message: 'Please provide the property name to index',
42
- validate: required,
43
- },
44
- {
45
- when: (response) => response.createProperties === 'yes',
46
- type: 'input',
47
- name: 'propertyDirection',
48
- message: 'Select the direction the index should optimize for sorting',
49
- default: 'ASCENDING',
50
- choices: ['ASCENDING', 'DESCENDING'],
51
- },
52
- ];
53
-
54
- return this.prompt(prompts).then((props) => {
55
- this.answers = props;
56
- });
57
- }
58
-
59
- writing() {
60
- const {
61
- serviceName,
62
- kind,
63
- ancestor,
64
- createProperties,
65
- } = this.answers;
66
-
67
- ['prod', 'staging'].forEach((env) => {
68
- this.copyDir(
69
- 'datastore',
70
- path.join('infra', env, 'datastore', serviceName),
71
- {
72
- ...this.answers,
73
- env,
74
- serviceName,
75
- kind,
76
- ancestor,
77
- createProperties,
78
- },
79
- );
80
- });
81
- }
82
-
83
- end() {
84
- this.log(`
85
- ${chalk.green(`Your Datastore index has now been created. To finalize your configuration, please continue
86
- with manual editing of the generated files.`)}
87
- ${chalk.green('1.')} Review and add more indexes if needed.
88
- ${chalk.green('2.')} Push this change in a feature branch and open a pull request.
89
- `);
90
- }
91
- };
@@ -1,6 +0,0 @@
1
- indexes:
2
- - kind: "<%-kind%>"
3
- ancestor: "<%-ancestor%>"<% if (createProperties == 'yes') { %>
4
- properties:
5
- - name: "<%-propertyName%>"
6
- direction: "<%-propertyDirection%>"<% } %>
@@ -1,23 +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/extenda/tf-module-gcp-datastore//?ref=v0.1.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
- locals {
13
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
14
- }
15
-
16
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
17
- inputs = merge(
18
- yamldecode(
19
- file("${get_terragrunt_dir()}/indexes.yaml")),
20
- {
21
- project_id = local.project_vars.locals.project_id
22
- }
23
- )
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Elastic Cloud",
3
- "description": "Create an Elastic Cloud resource"
4
- }
@@ -1,52 +0,0 @@
1
- const path = require('path');
2
- const chalk = require('chalk');
3
- const BaseGenerator = require('../../../src/BaseGenerator');
4
- const { required } = require('../../../src/validators');
5
-
6
- module.exports = class extends BaseGenerator {
7
- prompting() {
8
- const prompts = [
9
- {
10
- type: 'input',
11
- name: 'deploymentName',
12
- message: 'Please provide the name of the deployment',
13
- validate: required,
14
- },
15
- ];
16
-
17
- return this.prompt(prompts).then((props) => {
18
- this.answers = props;
19
- });
20
- }
21
-
22
- writing() {
23
- const {
24
- deploymentName,
25
- } = this.answers;
26
-
27
- ['prod', 'staging'].forEach((env) => {
28
- this.copyDir(
29
- 'elastic',
30
- path.join('infra', env, 'elastic'),
31
- {
32
- ...this.answers,
33
- env,
34
- deploymentName,
35
- },
36
- );
37
- });
38
- }
39
-
40
- end() {
41
- const specStageFile = path.join('infra', 'staging', 'elastic');
42
- const specProdFile = path.join('infra', 'prod', 'elastic');
43
- this.log(`
44
- ${chalk.green(`Your Elastic Cloud deployments have now been created. To finalize your configuration, please continue
45
- with manual editing of the generated files.`)}
46
- ${chalk.green('1.')} Review Elastic configuration
47
- \u2192 ${chalk.cyan(path.join(specStageFile, 'spec.hcl'))}
48
- \u2192 ${chalk.cyan(path.join(specProdFile, 'spec.hcl'))}
49
- ${chalk.green('2.')} Push this change in a feature branch and open a pull request.
50
- `);
51
- }
52
- };
@@ -1,27 +0,0 @@
1
- locals {
2
- # Deployment Template identifier to create the deployment from. More details:
3
- # https://www.elastic.co/guide/en/cloud/current/ec-regions-templates-instances.html (gcp-europe-west1 region)
4
- deployment_template_id = "gcp-io-optimized"
5
-
6
- autoscale = false
7
-
8
- topology = [
9
- {
10
- id = "hot_content"
11
- size = "4g"
12
- zone_count = 1
13
- autoscaling = {
14
- #min_size = 4g
15
- #max_size = "32g"
16
- }
17
- },
18
- ]
19
-
20
- #enable_kibana = true
21
- #kibana_size = "1g"
22
- #kibana_zone_count = 1
23
-
24
- #enable_apm = true
25
- #apm_size = "1g"
26
- #apm_zone_count = 1
27
- }
@@ -1,27 +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/extenda/tf-module-gcp-elastic//?ref=v0.1.7"
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
- spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.hcl")
14
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
15
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
16
- }
17
-
18
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
19
- inputs = merge(
20
- local.spec_vars.locals,
21
- local.project_vars.locals,
22
- {
23
- name = "<%-deploymentName%>"
24
- region = "gcp-${local.common_vars.locals.region}"
25
- project_id = local.project_vars.locals.project_id
26
- }
27
- )
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Elastic Lifecycle policy",
3
- "description": "Create an Elastic Cloud Lifecycle policy resource"
4
- }
@@ -1,76 +0,0 @@
1
- const fs = require('fs');
2
- const yaml = require('js-yaml');
3
-
4
- /* eslint-disable no-param-reassign */
5
- const handleHotPhase = (answers, phaseData) => {
6
- if (answers.hotReadonly === 'true') {
7
- phaseData.readonly = { enabled: true };
8
- }
9
-
10
- if (answers.hotPriority) {
11
- phaseData.set_priority = { priority: answers.hotPriority };
12
- }
13
- };
14
-
15
- const handleColdPhase = (answers, phaseData) => {
16
- if (answers.coldReadonly === 'true') {
17
- phaseData.readonly = { enabled: true };
18
- }
19
-
20
- if (answers.coldPriority) {
21
- phaseData.set_priority = { priority: answers.coldPriority };
22
- }
23
-
24
- if (answers.coldFreeze === 'true') {
25
- phaseData.freeze = { enabled: true };
26
- }
27
- };
28
-
29
- const handleWarmPhase = (answers, phaseData) => {
30
- if (answers.warmReadonly === 'true') {
31
- phaseData.readonly = { enabled: true };
32
- }
33
-
34
- if (answers.warmPriority) {
35
- phaseData.set_priority = { priority: answers.warmPriority };
36
- }
37
-
38
- if (answers.warmMigrate === 'true') {
39
- phaseData.migrate = { enabled: true };
40
- }
41
- };
42
- /* eslint-enable no-param-reassign */
43
-
44
- const handlePolicies = async (answers, yamlPath) => {
45
- const existingData = yaml.load(fs.readFileSync(yamlPath, 'utf8')) || { policies: [] };
46
-
47
- const policy = {
48
- name: answers.policyName,
49
- };
50
-
51
- answers.phase.forEach((phase) => {
52
- const phaseData = {
53
- min_age: answers[`${phase}MinAge`],
54
- };
55
-
56
- if (phase === 'hot') {
57
- handleHotPhase(answers, phaseData);
58
- }
59
-
60
- if (phase === 'cold') {
61
- handleColdPhase(answers, phaseData);
62
- }
63
-
64
- if (phase === 'warm') {
65
- handleWarmPhase(answers, phaseData);
66
- }
67
-
68
- policy[phase] = phaseData;
69
- });
70
-
71
- existingData.policies.push(policy);
72
-
73
- fs.writeFileSync(yamlPath, yaml.dump(existingData));
74
- };
75
-
76
- module.exports = handlePolicies;