@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,210 +0,0 @@
1
- const path = require('path');
2
- const chalk = require('chalk');
3
- const fs = require('fs');
4
- const BaseGenerator = require('../../../src/BaseGenerator');
5
- const { required } = require('../../../src/validators');
6
- const handlePolicies = require('./handle-yaml');
7
-
8
- module.exports = class extends BaseGenerator {
9
- prompting() {
10
- const prompts = [
11
- {
12
- type: 'input',
13
- name: 'policyName',
14
- message: 'Please provide the name of the lifecycle policy',
15
- validate: required,
16
- },
17
- {
18
- type: 'checkbox',
19
- name: 'phase',
20
- message: 'Please select lifecycle phases to be used within the policy',
21
- choices: [{
22
- name: 'The index is actively being updated and queried - hot',
23
- value: 'hot',
24
- },
25
- {
26
- name: 'The index is no longer being updated but is still being queried - warm',
27
- value: 'warm',
28
- },
29
- {
30
- name: 'The index is no longer being updated and is queried infrequently - cold',
31
- value: 'cold',
32
- },
33
- {
34
- name: 'The index is no longer being updated and is queried rarely - frozen',
35
- value: 'frozen',
36
- },
37
- {
38
- name: 'The index is no longer needed and can safely be removed - delete',
39
- value: 'delete',
40
- }],
41
- },
42
- ];
43
-
44
- return this.prompt(prompts).then((props) => {
45
- this.answers = props;
46
-
47
- const additionalPrompts = [];
48
-
49
- if (this.answers.phase.includes('hot')) {
50
- additionalPrompts.push({
51
- type: 'input',
52
- name: 'hotMinAge',
53
- message: 'Please provide a minimum age for the hot phase to control the timing of the transition. Format: 10s, 10h, 10d',
54
- validate: required,
55
- });
56
-
57
- additionalPrompts.push({
58
- type: 'list',
59
- name: 'hotReadonly',
60
- message: 'Please select true to make the index read-only',
61
- choices: ['true', 'false'],
62
- });
63
-
64
- additionalPrompts.push({
65
- type: 'input',
66
- name: 'hotPriority',
67
- message: 'Please provide the priority for the index. Must be 0 or greater (leave empty to add later)',
68
- });
69
- }
70
-
71
- if (this.answers.phase.includes('cold')) {
72
- additionalPrompts.push({
73
- type: 'input',
74
- name: 'coldMinAge',
75
- message: 'Please provide a minimum age for the cold phase to control the timing of the transition. Format: 10s, 10h, 10d',
76
- validate: required,
77
- });
78
-
79
- additionalPrompts.push({
80
- type: 'list',
81
- name: 'coldReadonly',
82
- message: 'Please select true to make the index read-only',
83
- choices: ['true', 'false'],
84
- });
85
-
86
- additionalPrompts.push({
87
- type: 'input',
88
- name: 'coldPriority',
89
- message: 'Please provide the priority for the index. Must be 0 or greater (leave empty to add later)',
90
- });
91
-
92
- additionalPrompts.push({
93
- type: 'list',
94
- name: 'coldFreeze',
95
- message: 'Please select true if you want to freeze the index to minimize its memory footprint',
96
- choices: ['true', 'false'],
97
- });
98
- }
99
-
100
- if (this.answers.phase.includes('warm')) {
101
- additionalPrompts.push({
102
- type: 'input',
103
- name: 'warmMinAge',
104
- message: 'Please provide a minimum age for the warm phase to control the timing of the transition. Format: 10s, 10h, 10d',
105
- validate: required,
106
- });
107
-
108
- additionalPrompts.push({
109
- type: 'list',
110
- name: 'warmReadonly',
111
- message: 'Please select true to make the index read-only',
112
- choices: ['true', 'false'],
113
- });
114
-
115
- additionalPrompts.push({
116
- type: 'input',
117
- name: 'warmPriority',
118
- message: 'Please provide the priority for the index. Must be 0 or greater (leave empty to add later)',
119
- });
120
-
121
- additionalPrompts.push({
122
- type: 'list',
123
- name: 'warmMigrate',
124
- message: 'Please select true if you want to move the index to the data tier that corresponds to the current phase',
125
- choices: ['true', 'false'],
126
- });
127
- }
128
-
129
- if (this.answers.phase.includes('frozen')) {
130
- additionalPrompts.push({
131
- type: 'input',
132
- name: 'frozenMinAge',
133
- message: 'Please provide a minimum age for the frozen phase to control the timing of the transition. Format: 10s, 10h, 10d',
134
- validate: required,
135
- });
136
- }
137
-
138
- if (this.answers.phase.includes('delete')) {
139
- additionalPrompts.push({
140
- type: 'input',
141
- name: 'deleteMinAge',
142
- message: 'Please provide a minimum age for the delete phase to control the timing of the transition. Format: 10s, 10h, 10d',
143
- validate: required,
144
- });
145
- }
146
-
147
- return this.prompt(additionalPrompts).then((promptProps) => {
148
- this.answers = {
149
- ...this.answers,
150
- ...promptProps,
151
- };
152
- });
153
- });
154
- }
155
-
156
- writing() {
157
- const {
158
- policyName,
159
- phase,
160
- } = this.answers;
161
-
162
- return Promise.all(['prod', 'staging'].map(async (env) => {
163
- const resourceDir = path.join(process.cwd(), 'infra', env, 'elastic-index-policy');
164
- this.fs.copyTpl(
165
- this.templatePath('policy/terragrunt.hcl'),
166
- this.destinationPath(`${resourceDir}/terragrunt.hcl`),
167
- {
168
- ...this.answers,
169
- env,
170
- policyName,
171
- phase,
172
- },
173
- );
174
-
175
- const yamlPath = `${resourceDir}/policy.yaml`;
176
- if (!fs.existsSync(resourceDir)) {
177
- fs.mkdirSync(resourceDir, { recursive: true });
178
- }
179
-
180
- if (!fs.existsSync(yamlPath)) {
181
- fs.writeFileSync(yamlPath, '');
182
- this.fs.copyTpl(
183
- this.templatePath('policy/policy.yaml'),
184
- this.destinationPath(yamlPath),
185
- {
186
- ...this.answers,
187
- env,
188
- policyName,
189
- phase,
190
- },
191
- );
192
- } else {
193
- await handlePolicies(this.answers, yamlPath);
194
- }
195
- }));
196
- }
197
-
198
- end() {
199
- const specStageFile = path.join('infra', 'staging', 'elastic-index-policy');
200
- const specProdFile = path.join('infra', 'prod', 'elastic-index-policy');
201
- this.log(`
202
- ${chalk.green(`Your Elastic Lifecycle policy configurations have now been created. To finalize your configuration, please continue
203
- with manual editing of the generated files. Check tf-module-gcp-elastic/policy module for more options you can add to the policy.`)}
204
- ${chalk.green('1.')} Review policy configuration
205
- \u2192 ${chalk.cyan(path.join(specStageFile, 'policy.yaml'))}
206
- \u2192 ${chalk.cyan(path.join(specProdFile, 'policy.yaml'))}
207
- ${chalk.green('2.')} Push this change in a feature branch and open a pull request.
208
- `);
209
- }
210
- };
@@ -1,28 +0,0 @@
1
- policies:
2
- - name: "<%-policyName%>" <% phase.forEach(function(item) { %><% if (item === 'hot') { %>
3
- <%- item %>: <% if (hotMinAge != '') { %>
4
- min_age: "<%-hotMinAge%>" <% } %> <% if (hotReadonly === 'true') { %>
5
- readonly:
6
- enabled: true <% } %> <% if (hotPriority != '') { %>
7
- set_priority:
8
- priority: "<%-hotPriority%>" <% } %> <% } %> <% if (item === 'cold') { %>
9
- <%- item %>: <% if (coldMinAge != '') { %>
10
- min_age: "<%-coldMinAge%>" <% } %> <% if (coldReadonly === 'true') { %>
11
- readonly:
12
- enabled: true <% } %> <% if (coldPriority != '') { %>
13
- set_priority:
14
- priority: "<%-coldPriority%>" <% } %> <% if (coldFreeze === 'true') { %>
15
- freeze:
16
- enabled: true <% } %> <% } %> <% if (item === 'warm') { %>
17
- <%- item %>: <% if (warmMinAge != '') { %>
18
- min_age: "<%-warmMinAge%>" <% } %> <% if (warmReadonly === 'true') { %>
19
- readonly:
20
- enabled: true <% } %> <% if (warmPriority != '') { %>
21
- set_priority:
22
- priority: "<%-warmPriority%>" <% } %> <% if (warmMigrate === 'true') { %>
23
- migrate:
24
- enabled: true <% } %> <% } %> <% if (item === 'frozen') { %>
25
- <%- item %>: <% if (frozenMinAge != '') { %>
26
- min_age: "<%-frozenMinAge%>" <% } %> <% } %> <% if (item === 'delete') { %>
27
- <%- item %>: <% if (deleteMinAge != '') { %>
28
- min_age: "<%-deleteMinAge%>" <% } %> <% } %> <% }) %>
@@ -1,25 +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//policy?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
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
14
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
15
- }
16
-
17
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
18
- inputs = merge(
19
- yamldecode(file("${get_terragrunt_dir()}/policy.yaml")),
20
- local.project_vars.locals,
21
- {
22
- project_id = local.project_vars.locals.project_id
23
- create_policy = true
24
- }
25
- )
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Elastic Index",
3
- "description": "Create an Elastic Cloud Index resource"
4
- }
@@ -1,84 +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: 'indexName',
12
- message: 'Please provide the name of the index',
13
- validate: required,
14
- },
15
- {
16
- type: 'input',
17
- name: 'numberOfShards',
18
- message: 'Please provide the number of shards for the index',
19
- validate: required,
20
- },
21
- {
22
- type: 'input',
23
- name: 'numberOfReplicas',
24
- message: 'Please provide the number of shard replicas',
25
- validate: required,
26
- },
27
- {
28
- type: 'input',
29
- name: 'aliasName',
30
- message: 'Please provide the alias name of the index or leave empty',
31
- },
32
- {
33
- type: 'list',
34
- name: 'isWriteIndex',
35
- message: 'Please select true if the index is the write index for the alias. If previous step is empty this one will be considered empty as well',
36
- choices: ['true', 'false'],
37
- },
38
- {
39
- type: 'input',
40
- name: 'policyName',
41
- message: 'Please provide the lifecycle policy name for the index that has been previously created or leave empty to add later',
42
- },
43
- ];
44
-
45
- return this.prompt(prompts).then((props) => {
46
- this.answers = props;
47
- });
48
- }
49
-
50
- writing() {
51
- const {
52
- indexName,
53
- } = this.answers;
54
-
55
- ['prod', 'staging'].forEach((env) => {
56
- this.copyDir(
57
- 'elastic-template',
58
- path.join('infra', env, 'elastic-template', indexName),
59
- {
60
- ...this.answers,
61
- env,
62
- indexName,
63
- },
64
- );
65
- });
66
- }
67
-
68
- end() {
69
- const {
70
- indexName,
71
- } = this.answers;
72
-
73
- const specStageFile = path.join('infra', 'staging', 'elastic-template', indexName);
74
- const specProdFile = path.join('infra', 'prod', 'elastic-template', indexName);
75
- this.log(`
76
- ${chalk.green(`Your Elastic Cloud index configurations have now been created. To finalize your configuration, please continue
77
- with manual editing of the generated files.`)}
78
- ${chalk.green('1.')} Review Mappings configuration
79
- \u2192 ${chalk.cyan(path.join(specStageFile, 'mappings.json'))}
80
- \u2192 ${chalk.cyan(path.join(specProdFile, 'mappings.json'))}
81
- ${chalk.green('2.')} Push this change in a feature branch and open a pull request.
82
- `);
83
- }
84
- };
@@ -1,35 +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//index?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
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
14
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
15
- }
16
-
17
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
18
- inputs = merge(
19
- local.project_vars.locals,
20
- {
21
- index_name = "<%-indexName%>"
22
- project_id = local.project_vars.locals.project_id
23
- mappings = jsondecode(file("${get_terragrunt_dir()}/mappings.json"))
24
- number_of_shards = "<%-numberOfShards%>"
25
- number_of_replicas = "<%-numberOfReplicas%>" <% if (policyName != '') { %>
26
- lifecycle_policy = "<%-policyName%>" <% } %>
27
- <% if (aliasName != '') { %>
28
- alias = [
29
- {
30
- name = "<%-aliasName%>"
31
- is_write_index = <%-isWriteIndex%>
32
- }
33
- ] <% } %>
34
- }
35
- )
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Firestore",
3
- "description": "Create Firestore database"
4
- }
@@ -1,141 +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: 'databaseName',
13
- default: getTribeAndClanName().clan,
14
- message: 'Please provide the database name or leave blank for common database.',
15
- validate: required,
16
- },
17
- {
18
- type: 'list',
19
- name: 'databaseType',
20
- message: 'Select the type of database.',
21
- default: 'FIRESTORE_NATIVE',
22
- choices: ['FIRESTORE_NATIVE', 'DATASTORE_MODE'],
23
- },
24
- {
25
- type: 'list',
26
- name: 'databaseConcurrencyMode',
27
- message: 'Select the database concurrency mode.',
28
- default: 'OPTIMISTIC',
29
- choices: ['OPTIMISTIC', 'PESSIMISTIC'],
30
- },
31
- {
32
- type: 'list',
33
- name: 'databaseBackupEnabled',
34
- message: 'Enable database backup?',
35
- default: 'true',
36
- choices: ['true', 'false'],
37
- },
38
- {
39
- when: (response) => response.databaseBackupEnabled === 'true',
40
- type: 'list',
41
- name: 'databaseBackupSchedule',
42
- message: 'Select the backup schedule.',
43
- default: 'daily-backup',
44
- choices: ['daily-backup', 'weekly-backup'],
45
- },
46
- {
47
- when: (response) => response.databaseBackupSchedule === 'weekly-backup',
48
- type: 'list',
49
- name: 'databaseBackupWeeklyRecurrence',
50
- message: 'Please provide the day of the week the backup must be created.',
51
- default: 'SUNDAY',
52
- choices: ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY'],
53
- },
54
- {
55
- when: (response) => response.databaseBackupEnabled === 'true',
56
- type: 'input',
57
- name: 'databaseBackupRetention',
58
- default: '259200s',
59
- message: 'Please provide how long to keep the backups in seconds. ex. "259200s" is 3 days',
60
- validate: required,
61
- },
62
- {
63
- type: 'input',
64
- name: 'databaseCollectionName',
65
- message: 'Please provide the name of the collection being indexed.',
66
- validate: required,
67
- },
68
- {
69
- type: 'input',
70
- name: 'databaseCollectionIndexName',
71
- message: 'Please provide the name of the index.',
72
- validate: required,
73
- },
74
- {
75
- type: 'input',
76
- name: 'databaseCollectionFieldPath',
77
- message: 'Please provide the name of the field.',
78
- validate: required,
79
- },
80
- {
81
- type: 'list',
82
- name: 'databaseCollectionFieldorder',
83
- message: 'Select the specified order for the field.',
84
- default: 'ASCENDING',
85
- choices: ['ASCENDING', 'DESCENDING'],
86
- },
87
- ];
88
-
89
- return this.prompt(prompts).then((props) => {
90
- this.answers = props;
91
- });
92
- }
93
-
94
- writing() {
95
- const { databaseName, databaseCollectionName, ...rest } = this.answers;
96
-
97
- ['prod', 'staging'].forEach((env) => {
98
- const context = {
99
- ...rest,
100
- databaseName,
101
- databaseCollectionName,
102
- env,
103
- };
104
- const baseDest = path.join('infra', env, 'firestore', databaseName);
105
- const collectionDest = path.join(baseDest, 'indexes', databaseCollectionName);
106
-
107
- // Files to copy at database root
108
- ['spec.hcl', 'terragrunt.hcl'].forEach((file) => {
109
- this.fs.copyTpl(
110
- this.templatePath('firestore', file),
111
- this.destinationPath(baseDest, file),
112
- context,
113
- );
114
- });
115
-
116
- // Files to copy inside indexes/<databaseCollectionName>/
117
- ['indexes.yaml', 'terragrunt.hcl'].forEach((file) => {
118
- this.fs.copyTpl(
119
- this.templatePath('firestore/indexes', file),
120
- this.destinationPath(collectionDest, file),
121
- context,
122
- );
123
- });
124
- });
125
- }
126
-
127
- end() {
128
- const {
129
- databaseName,
130
- } = this.answers;
131
-
132
- const firestoreDir = path.join(databaseName);
133
- this.log(`
134
- ${chalk.green(`Your Firestore database has now been created. To finalize your configuration, please continue
135
- with manual editing of the generated files.`)}
136
- ${chalk.green('1.')} Review and add more indexes as the firestore module requires at least two.
137
- \u2192 ${chalk.cyan(path.join(firestoreDir, 'indexes.yaml'))}
138
- ${chalk.green('2.')} Push this change in a feature branch and open a pull request.
139
- `);
140
- }
141
- };
@@ -1,12 +0,0 @@
1
- # The last field entry is always for the field path __name__.
2
- # If, on creation, __name__ was not specified as the last field,
3
- # it will be added automatically with the same direction as that of the last field defined.
4
- # If the final field in a composite index is not directional, the __name__ will be ordered "ASCENDING".
5
- indexes:
6
- <%-databaseCollectionIndexName%>:
7
- - field_path: "<%-databaseCollectionFieldPath%>"
8
- array_config: "CONTAINS"
9
- order: "<%-databaseCollectionFieldorder%>"
10
- - field_path: "__name__"
11
- order: "<%-databaseCollectionFieldorder%>"
12
- array_config: null
@@ -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-firestore//modules/index?ref=v1.0.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
- collection = basename(get_terragrunt_dir())
15
- database_name = basename(dirname(dirname(get_terragrunt_dir())))
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
- yamldecode(
21
- file("${get_terragrunt_dir()}/indexes.yaml")),
22
- {
23
- project_id = local.project_vars.locals.project_id
24
- database_name = local.database_name
25
- collection = local.collection
26
- }
27
- )
@@ -1,31 +0,0 @@
1
- locals {
2
- ###################
3
- # REQUIRED INPUTS #
4
- ###################
5
-
6
- database_location_id = "europe-west1"
7
- database_type = "<%- databaseType %>"
8
- database_concurrency_mode = "<%- databaseConcurrencyMode %>"
9
-
10
- ###################
11
- # OPTIONAL INPUTS #
12
- ###################
13
-
14
- # Description: Enables protection of a Firestore database from accidental deletion across all surfaces (API, gcloud, Cloud Console, and Terraform).
15
- #Type: String
16
- #Default: "DELETE_PROTECTION_DISABLED"
17
- database_delete_protection_state = "DELETE_PROTECTION_ENABLED"
18
-
19
- <% if (databaseBackupEnabled === 'true') { %>
20
- #Type: Bool
21
- #Default: true
22
- # Description: Firestore backup settings
23
- database_backup_enabled = true
24
- database_backup_schedule = "<%- databaseBackupSchedule %>"
25
- <% if (databaseBackupSchedule === 'weekly-backup') { %>
26
- database_backup_weekly_recurrence = "<%- databaseBackupWeeklyRecurrence %>"
27
- <% } %>
28
- database_point_in_time_recovery_enablement = "POINT_IN_TIME_RECOVERY_DISABLED"
29
- database_backup_retention = "<%- databaseBackupRetention %>"
30
- <% } %>
31
- }
@@ -1,25 +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-firestore//modules/database?ref=v1.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
- locals {
13
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
14
- database_name = basename(get_terragrunt_dir())
15
- database_spec_vars = read_terragrunt_config("${get_terragrunt_dir()}/spec.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.database_spec_vars.locals,
21
- {
22
- project_id = local.project_vars.locals.project_id,
23
- database_name = local.database_name
24
- }
25
- )
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Hii Retail IAM",
3
- "description": "Create a Hii Retail IAM resource"
4
- }