@hiiretail/gcp-infra-cli 0.103.1 → 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 (215) 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 -81
  89. package/generators/common-resources/firestore/templates/firestore/indexes.yaml +0 -10
  90. package/generators/common-resources/firestore/templates/firestore/terragrunt.hcl +0 -25
  91. package/generators/common-resources/iam/generator.json +0 -4
  92. package/generators/common-resources/iam/index.js +0 -62
  93. package/generators/common-resources/iam/templates/github/workflows/iam.yml +0 -18
  94. package/generators/common-resources/iam/templates/iam.yaml +0 -8
  95. package/generators/common-resources/iam/valid-prefix.js +0 -8
  96. package/generators/common-resources/kafka-connect/generator.json +0 -4
  97. package/generators/common-resources/kafka-connect/index.js +0 -75
  98. package/generators/common-resources/kafka-connect/templates/elastic/terragrunt.hcl +0 -92
  99. package/generators/common-resources/kafka-connect/templates/pubsub/terragrunt.hcl +0 -75
  100. package/generators/common-resources/kafka-topics/generator.json +0 -4
  101. package/generators/common-resources/kafka-topics/index.js +0 -54
  102. package/generators/common-resources/kafka-topics/templates/kafka/kafka.yaml +0 -20
  103. package/generators/common-resources/kafka-topics/templates/kafka/terragrunt.hcl +0 -21
  104. package/generators/common-resources/kms/generator.json +0 -4
  105. package/generators/common-resources/kms/index.js +0 -69
  106. package/generators/common-resources/kms/templates/kms/spec.hcl +0 -5
  107. package/generators/common-resources/kms/templates/kms/terragrunt.hcl +0 -33
  108. package/generators/common-resources/memorystore/generator.json +0 -4
  109. package/generators/common-resources/memorystore/index.js +0 -69
  110. package/generators/common-resources/memorystore/templates/outputs.json +0 -3
  111. package/generators/common-resources/memorystore/templates/redis-instance/spec.hcl +0 -16
  112. package/generators/common-resources/memorystore/templates/redis-instance/terragrunt.hcl +0 -35
  113. package/generators/common-resources/memorystore/templates/secrets/terragrunt.hcl +0 -31
  114. package/generators/common-resources/monitoring/generator.json +0 -4
  115. package/generators/common-resources/monitoring/handle-yaml.js +0 -48
  116. package/generators/common-resources/monitoring/index.js +0 -192
  117. package/generators/common-resources/monitoring/templates/alerts/generic-infra.yaml +0 -633
  118. package/generators/common-resources/monitoring/templates/alerts/terragrunt.hcl +0 -37
  119. package/generators/common-resources/monitoring/templates/service/service.yaml +0 -16
  120. package/generators/common-resources/monitoring/templates/service/terragrunt.hcl +0 -37
  121. package/generators/common-resources/monitoring/templates/uptime-checks/terragrunt.hcl +0 -36
  122. package/generators/common-resources/monitoring/templates/uptime-checks/uptime-checks.yaml +0 -3
  123. package/generators/common-resources/monitoring/validate.js +0 -58
  124. package/generators/common-resources/pubsub/append.js +0 -120
  125. package/generators/common-resources/pubsub/generator.json +0 -4
  126. package/generators/common-resources/pubsub/get-gcp-projects.js +0 -34
  127. package/generators/common-resources/pubsub/handle-subscribers.js +0 -63
  128. package/generators/common-resources/pubsub/index.js +0 -316
  129. package/generators/common-resources/pubsub/templates/pubsub/spec.hcl +0 -7
  130. package/generators/common-resources/pubsub/templates/pubsub/subscribers.yaml +0 -16
  131. package/generators/common-resources/pubsub/templates/pubsub/terragrunt.hcl +0 -34
  132. package/generators/common-resources/pubsub/templates/pubsub-dlq/terragrunt.hcl +0 -42
  133. package/generators/common-resources/pubsub/templates/pubsub-external/spec.hcl +0 -10
  134. package/generators/common-resources/pubsub/templates/pubsub-external/subscribers.yaml +0 -16
  135. package/generators/common-resources/pubsub/templates/pubsub-external/terragrunt.hcl +0 -31
  136. package/generators/common-resources/pubsub/validate.js +0 -44
  137. package/generators/common-resources/scheduler/append.js +0 -83
  138. package/generators/common-resources/scheduler/generator.json +0 -4
  139. package/generators/common-resources/scheduler/index.js +0 -103
  140. package/generators/common-resources/scheduler/templates/scheduler/terragrunt.hcl +0 -44
  141. package/generators/common-resources/spanner/append.js +0 -27
  142. package/generators/common-resources/spanner/generator.json +0 -4
  143. package/generators/common-resources/spanner/index.js +0 -169
  144. package/generators/common-resources/spanner/templates/spanner/databases.yaml +0 -5
  145. package/generators/common-resources/spanner/templates/spanner/spec.hcl +0 -22
  146. package/generators/common-resources/spanner/templates/spanner/terragrunt.hcl +0 -33
  147. package/generators/common-resources/spanner/validate.js +0 -38
  148. package/generators/docs/command.json +0 -7
  149. package/generators/docs/rca/generator.json +0 -4
  150. package/generators/docs/rca/index.js +0 -50
  151. package/generators/docs/rca/templates/docs/rca_external.md +0 -43
  152. package/generators/docs/rca/templates/docs/rca_internal.md +0 -88
  153. package/generators/docs/runbook/generator.json +0 -4
  154. package/generators/docs/runbook/index.js +0 -42
  155. package/generators/docs/runbook/templates/docs/runbook.md +0 -106
  156. package/generators/docs/srb/generator.json +0 -4
  157. package/generators/docs/srb/index.js +0 -62
  158. package/generators/docs/srb/templates/docs/README.md +0 -42
  159. package/generators/docs/srb/templates/docs/adr.cmd +0 -3
  160. package/generators/docs/srb/templates/docs/adr.sh +0 -4
  161. package/generators/docs/srb/templates/docs/architecture.md +0 -68
  162. package/generators/docs/srb/templates/docs/cost-estimates.md +0 -39
  163. package/generators/docs/srb/templates/docs/dsl2png.cmd +0 -3
  164. package/generators/docs/srb/templates/docs/dsl2png.sh +0 -4
  165. package/generators/docs/srb/templates/docs/sre.md +0 -43
  166. package/generators/docs/srb/templates/sample.dsl +0 -36
  167. package/generators/init/clan-infra/gcp-projects.js +0 -36
  168. package/generators/init/clan-infra/generator.json +0 -4
  169. package/generators/init/clan-infra/index.js +0 -170
  170. package/generators/init/clan-infra/templates/.yamllint +0 -17
  171. package/generators/init/clan-infra/templates/env/project.hcl +0 -15
  172. package/generators/init/clan-infra/templates/env/secrets/secrets.yaml +0 -4
  173. package/generators/init/clan-infra/templates/env/secrets/terragrunt.hcl +0 -31
  174. package/generators/init/clan-infra/templates/github/CODEOWNERS +0 -1
  175. package/generators/init/clan-infra/templates/github/workflows/infra-verify.yml +0 -16
  176. package/generators/init/clan-infra/templates/github/workflows/infra.yml +0 -17
  177. package/generators/init/clan-infra/templates/github/workflows/release-notes.yml +0 -33
  178. package/generators/init/clan-infra/templates/github/workflows/sync-docs.yml +0 -29
  179. package/generators/init/clan-infra/templates/infra/.terraform-version +0 -1
  180. package/generators/init/clan-infra/templates/infra/.terragrunt-version +0 -1
  181. package/generators/init/clan-infra/templates/infra/README.md +0 -5
  182. package/generators/init/clan-infra/templates/infra/common.hcl +0 -24
  183. package/generators/init/clan-infra/templates/infra/terragrunt_root.hcl +0 -44
  184. package/generators/init/clan-infra/templates/notification-channels/notification-channels.yaml +0 -7
  185. package/generators/init/clan-infra/templates/notification-channels/terragrunt.hcl +0 -29
  186. package/generators/init/clan-infra/templates/release-notes/example-service.yaml +0 -23
  187. package/generators/init/clan-infra/templates/release-notes-schema/release-notes.schema.json +0 -63
  188. package/generators/init/clan-infra/tribe-clan-repo.js +0 -38
  189. package/generators/init/clan-infra/validate.js +0 -8
  190. package/generators/init/command.json +0 -7
  191. package/generators/maintenance/command.json +0 -7
  192. package/generators/maintenance/manage-states/generator.json +0 -4
  193. package/generators/maintenance/manage-states/index.js +0 -188
  194. package/generators/maintenance/update-modules/generator.json +0 -4
  195. package/generators/maintenance/update-modules/index.js +0 -102
  196. package/generators/organization/clan-project/__tests__/__snapshots__/googlecloud.test.js.snap +0 -27
  197. package/generators/organization/clan-project/generator.json +0 -4
  198. package/generators/organization/clan-project/googlecloud.js +0 -119
  199. package/generators/organization/clan-project/index.js +0 -139
  200. package/generators/organization/clan-project/templates/clan/clan.yaml +0 -22
  201. package/generators/organization/clan-project/templates/clan/terragrunt.hcl +0 -39
  202. package/generators/organization/clan-project/templates/clan-project/project.yaml +0 -14
  203. package/generators/organization/clan-project/templates/clan-project/terragrunt.hcl +0 -51
  204. package/generators/organization/clan-project/templates/clans-folder/terragrunt.hcl +0 -3
  205. package/generators/organization/clan-project/templates/department/terragrunt.hcl +0 -32
  206. package/generators/organization/clan-project/templates/tribe/terragrunt.hcl +0 -67
  207. package/generators/organization/clan-project/templates/tribe/tribe.yaml +0 -19
  208. package/generators/organization/command.json +0 -8
  209. package/src/BaseGenerator.js +0 -73
  210. package/src/SecretsGenerator.js +0 -105
  211. package/src/cli.js +0 -73
  212. package/src/dependency-check.js +0 -48
  213. package/src/update-check.js +0 -30
  214. package/src/validators.js +0 -32
  215. package/src/yeoman.js +0 -71
@@ -1,43 +0,0 @@
1
- # Observability and SRE
2
-
3
- <!--
4
- Explain what metrics you will monitor and how you will monitor them. Read through the SRE Chapter documentation
5
- and adopt the guidelines and naming convetions that exist, https://github.com/extenda/chap-sre-docs/blob/master/README.md
6
-
7
- List
8
-
9
- * that the clan will use GCP Operations to monitor their service and GCP-resources
10
- * that the clan will keep this documentation up-to-date through the lifecycle of the service
11
- * that the clan will create and maintain a Runbook
12
- -->
13
-
14
- ## Service A
15
-
16
- <!--
17
- List the SLIs and SLOs per service, more information about SLIs and SLOs can be found here, https://github.com/extenda/chap-sre-docs/blob/master/docs/service-levels.md
18
- All services must list and explain how they will monitor and have SLOs set for:
19
-
20
- * Availability
21
- * Latency
22
- * Throughput
23
- * Error rate
24
-
25
- If the team need to monitor any additional SLOs, it must be mentioned how they plan to monitor that.
26
-
27
- If not using fully-managed services by Google, SLIs and SLOs needs to be set for those as well. When using fully-managed services, only SLIs needs to be monitored
28
- Example:
29
-
30
- * A clan is using Cloud SQL
31
- * Then they need to set SLIs and SLOs based on when they need to increase CPU and Memory for example
32
-
33
- -->
34
-
35
- ### SLIs
36
-
37
- ### SLOs
38
-
39
- ## Service B
40
-
41
- ### SLIs
42
-
43
- ### SLOs
@@ -1,36 +0,0 @@
1
- workspace {
2
- model {
3
- user = person "User" "A user"
4
-
5
- search = softwareSystem "Product Search" "Search capabilities offered over GraphQL" "Existing System"
6
-
7
- priceRunner = softwareSystem "PriceRunner" "Compare prices from multiple suppliers" "External"
8
-
9
- system = softwareSystem "<%-system%>" "A system to track prices on products." {
10
- web = container "Web App" "A web app to track prices" "React"
11
- app = container "Mobile App" "An Android app to track prices" "React Native"
12
- db = container "Database" "User profile data" "CouchDB" "Database"
13
- bff = container "App Backend" "Backend for the app" "Node JS"
14
- topic = container "ptr.public.event.price-changed" "Topic for price changed events" "Cloud Pub/Sub" "Topic"
15
- }
16
-
17
- user -> app "Uses"
18
- user -> web "Uses"
19
- app -> bff "Uses" "HTTP, gRPC"
20
- web -> bff "Uses" "HTTP, gRPC"
21
- bff -> db "Read/Write" "TCP"
22
- bff -> search "Search" "HTTP, GraphQL"
23
- bff -> priceRunner "Search" "HTTP"
24
- bff -> topic "Publishes events" "Pub/Sub"
25
- }
26
-
27
- views {
28
- systemContext system {
29
- include *
30
- }
31
-
32
- container system {
33
- include *
34
- }
35
- }
36
- }
@@ -1,36 +0,0 @@
1
- const gcpProjects = {};
2
-
3
- const getGcpProjects = ({ spawnCommandSync }, name) => {
4
- let projects = gcpProjects[name];
5
-
6
- if (!projects) {
7
- const result = spawnCommandSync('gcloud', [
8
- 'projects',
9
- 'list',
10
- `--filter=NAME~${name}`,
11
- '--format=value(PROJECT_ID)',
12
- ], { encoding: 'utf8', stdio: 'pipe' });
13
-
14
- if (result.status !== 0) {
15
- throw new Error("gcloud error. Please run 'gcloud auth application-defaults login' and try again.");
16
- }
17
- projects = result.stdout.split(/\s+/).filter((line) => line.trim().length > 0).sort();
18
- gcpProjects[name] = projects;
19
- }
20
-
21
- return projects;
22
- };
23
-
24
- const validateGcpProjects = ({ spawnCommandSync }, name) => {
25
- try {
26
- const projects = getGcpProjects({ spawnCommandSync }, name);
27
- return projects.length > 0 ? true : 'Invalid input. No matching GCP project(s) found.';
28
- } catch (err) {
29
- return err.message;
30
- }
31
- };
32
-
33
- module.exports = {
34
- getGcpProjects,
35
- validateGcpProjects,
36
- };
@@ -1,4 +0,0 @@
1
- {
2
- "name": "Clan infrastructure repository",
3
- "description": "Initialize a new clan infrastructure repository."
4
- }
@@ -1,170 +0,0 @@
1
- const path = require('path');
2
- const chalk = require('chalk');
3
- const BaseGenerator = require('../../../src/BaseGenerator');
4
- const { chain, required } = require('../../../src/validators');
5
- const { getGcpProjects, validateGcpProjects } = require('./gcp-projects');
6
- const getTribeAndClanName = require('./tribe-clan-repo');
7
- const validate = require('./validate');
8
-
9
- module.exports = class extends BaseGenerator {
10
- prompting() {
11
- const { tribe: defaultTribe, clan: defaultClan } = getTribeAndClanName();
12
- const validateGcpInput = (input) => validateGcpProjects(this, input);
13
- const prompts = [
14
- {
15
- type: 'input',
16
- name: 'tribe',
17
- default: defaultTribe,
18
- message: 'Tribe name',
19
- validate: (input) => chain(input, required, validateGcpInput),
20
- },
21
- {
22
- type: 'input',
23
- name: 'clan',
24
- default: defaultClan,
25
- message: 'Clan name',
26
- validate: (input) => chain(input, required, validateGcpInput),
27
- },
28
- {
29
- type: 'input',
30
- name: 'group',
31
- message: 'Name of GitHub team that can apply changes',
32
- validate: required,
33
- },
34
- {
35
- type: 'input',
36
- name: 'costCenter',
37
- message: 'Provide the cost center your tribe belongs to',
38
- validate: required,
39
- },
40
- {
41
- type: 'input',
42
- name: 'product',
43
- message: 'Provide the product your resources belongs to. Can be modified for a specific resource later on',
44
- validate: required,
45
- },
46
- {
47
- type: 'input',
48
- name: 'component',
49
- message: 'Provide the component your resources belongs to. Can be modified for a specific resource later on',
50
- validate: required,
51
- },
52
- {
53
- type: 'input',
54
- name: 'tenantAlias',
55
- message: 'Provide the tenant alias for the resources or use \'multi-tenant\'. Can be modified for a specific resource later on.',
56
- validate: required,
57
- },
58
- {
59
- type: 'input',
60
- name: 'jiraProjectKey',
61
- message: 'Provide the "jira project key" for your clan, which is the prefix of your task names (e.g. srt, hii, hcc)',
62
- validate: required && validate.jiraProjectKey,
63
- },
64
- {
65
- type: 'input',
66
- name: 'repoName',
67
- default: `${defaultTribe}-${defaultClan}-common`,
68
- message: 'Provide the name of your common repository',
69
- validate: required,
70
- },
71
- {
72
- type: 'input',
73
- name: 'foldersToSync',
74
- message: 'Provide the name of docs subfolders that you want to sync to the Developer Portal (comma-seperated). Leave empty to add it later.',
75
- },
76
- {
77
- type: 'list',
78
- name: 'syncReleaseNotes',
79
- message: 'Do you want to sync release notes to the Developer Portal?',
80
- default: 'false',
81
- choices: ['true', 'false'],
82
- },
83
- {
84
- type: 'input',
85
- name: 'serviceName',
86
- message: 'Provide the name of your service',
87
- validate: required,
88
- },
89
- ];
90
-
91
- return this.prompt(prompts).then((props) => {
92
- this.answers = props;
93
- });
94
- }
95
-
96
- writing() {
97
- const {
98
- clan,
99
- tribe,
100
- group,
101
- serviceName,
102
- } = this.answers;
103
- const groups = group.startsWith('@') ? group : `@extenda/${group}`;
104
- const [tribeProd, tribeStaging] = getGcpProjects(this, tribe);
105
- const [clanProd, clanStaging] = getGcpProjects(this, clan);
106
-
107
- this.fs.copy(
108
- this.templatePath('infra', '.terragrunt-version'),
109
- this.destinationPath('infra', '.terragrunt-version'),
110
- );
111
- this.fs.copy(
112
- this.templatePath('infra', '.terraform-version'),
113
- this.destinationPath('infra', '.terraform-version'),
114
- );
115
- this.copyDir(
116
- 'infra',
117
- this.destinationPath('infra'),
118
- this.answers,
119
- );
120
-
121
- const createEnv = (env, tribeProject, clanProject) => {
122
- this.copyDir(
123
- 'env',
124
- this.destinationPath(path.join('infra', env)),
125
- {
126
- ...this.answers,
127
- env,
128
- clanProject,
129
- tribeProject,
130
- },
131
- );
132
- };
133
-
134
- createEnv('prod', tribeProd, clanProd);
135
- createEnv('staging', tribeStaging, clanStaging);
136
-
137
- // Init notification channels for clan
138
- this.copyDir('notification-channels',
139
- path.join('infra', 'prod', 'monitoring', 'notification-channels'),
140
- this.answers);
141
-
142
- this.copyDir('github',
143
- this.destinationPath(path.join('.github')),
144
- {
145
- ...this.answers,
146
- groups,
147
- });
148
- this.copyDir(
149
- 'release-notes',
150
- this.destinationPath(`docs/${serviceName}/release-notes`),
151
- this.answers,
152
- );
153
- this.copyDir(
154
- 'release-notes-schema',
155
- this.destinationPath('docs/'),
156
- this.answers,
157
- );
158
- this.fs.copy(
159
- this.templatePath('.yamllint'),
160
- this.destinationPath('.yamllint'),
161
- );
162
- }
163
-
164
- end() {
165
- this.log(`
166
- ${chalk.green(`Your repository has been initialized. To finalize your configuration, please continue
167
- with manual creating folders and files that you want to sync to the Developer Portal.`)}
168
- `);
169
- }
170
- };
@@ -1,17 +0,0 @@
1
- extends: relaxed
2
- rules:
3
- colons:
4
- max-spaces-before: 0
5
- max-spaces-after: -1
6
- indentation:
7
- spaces: 2
8
- indent-sequences: true
9
- check-multi-line-strings: false
10
- line-length:
11
- max: 120
12
- allow-non-breakable-words: true
13
- level: error
14
- new-line-at-end-of-file: enable
15
- new-lines:
16
- type: unix
17
- trailing-spaces: {}
@@ -1,15 +0,0 @@
1
- # Set project-wide variables here. This is automatically pulled in at the root terragrunt.hcl configuration to
2
- # set the remote state configuration and to feed variables forward to the child modules.
3
- locals {
4
- project_name = "<%-clan%>-<%-env%>"
5
- project_id = "<%-clanProject%>"
6
- project_env = "<%-env%>"
7
-
8
- project = local.project_id
9
- network = "tribe-network"
10
- tribe_project_id = "<%-tribeProject%>"
11
-
12
- default_user_labels = {
13
- environment = local.project_env,
14
- }
15
- }
@@ -1,4 +0,0 @@
1
- # Modify the following map by adding secrets for your GCP project
2
- # secrets:
3
- # secret-name: "secret-value"
4
- secrets: {}
@@ -1,31 +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
- locals {
8
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
9
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
10
- labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
11
- component = local.common_vars.locals.component
12
- product = local.common_vars.locals.product
13
- tenant-alias = local.common_vars.locals.tenant_alias
14
- terraform = ""
15
- })
16
- }
17
-
18
- # Include all settings from the root terragrunt.hcl file
19
- include {
20
- path = find_in_parent_folders("terragrunt_root.hcl")
21
- }
22
-
23
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
24
- inputs = merge(
25
- {
26
- secrets = merge(yamldecode(file("${get_terragrunt_dir()}/secrets.yaml")).secrets,
27
- { "clan_slack_channel" = local.common_vars.locals.clan_slack_channels[0].name })
28
- project_id = local.project_vars.locals.project_id
29
- labels = local.labels
30
- }
31
- )
@@ -1 +0,0 @@
1
- infra/** <%-groups%>
@@ -1,16 +0,0 @@
1
- name: Infra verify
2
- on:
3
- push:
4
- branches:
5
- - master
6
- paths: infra/**
7
-
8
- jobs:
9
- dispatch:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - uses: extenda/actions/repository-dispatch@v0
13
- with:
14
- service-account-key: ${{ secrets.SECRET_AUTH }}
15
- repository: extenda/tf-infra-gcp
16
- event-type: clan-infra-verify
@@ -1,17 +0,0 @@
1
- name: Infra
2
- on:
3
- pull_request:
4
- paths: infra/**
5
- issue_comment:
6
- types:
7
- - created
8
-
9
- jobs:
10
- dispatch:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: extenda/actions/repository-dispatch@v0
14
- with:
15
- service-account-key: ${{ secrets.SECRET_AUTH }}
16
- repository: extenda/tf-infra-gcp
17
- event-type: clan-infra
@@ -1,33 +0,0 @@
1
- name: Release Notes
2
- on:
3
- pull_request:
4
- paths:
5
- - 'docs/**/release-notes/*.yaml'
6
- - 'docs/release-notes.schema.json'
7
- - '.github/workflows/release-notes.yaml'
8
-
9
- jobs:
10
- yamllint:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v2
14
-
15
- - uses: actions/setup-python@v1
16
-
17
- - name: Pip install
18
- run: sudo pip install yamllint
19
-
20
- - name: YAML lint
21
- run: |
22
- for f in docs/**/release-notes/*.yaml; do
23
- yamllint docs/release-notes.schema.json -d "$f"
24
- done
25
-
26
- - name: Install pajv
27
- run: sudo npm install -g pajv
28
-
29
- - name: Validate YAML schema
30
- run: |
31
- for f in docs/**/release-notes/*.yaml; do
32
- pajv -s docs/release-notes.schema.json -d "$f"
33
- done
@@ -1,29 +0,0 @@
1
- name: Update docs in Hii Retail Developer Portal
2
-
3
- concurrency: sync-docs
4
-
5
- on:
6
- push:
7
- branches:
8
- - master
9
- paths:
10
- - 'docs/**'
11
- - '.github/workflows/sync-docs.yml'
12
-
13
- jobs:
14
- run:
15
- runs-on: ubuntu-latest
16
- steps:
17
- - uses: extenda/actions/gcp-secret-manager@v0
18
- with:
19
- service-account-key: ${{ secrets.SECRET_AUTH }}
20
- secrets: |
21
- ORG_TOKEN: github-token
22
-
23
- - uses: extenda/actions/repository-dispatch@v0
24
- with:
25
- service-account-key: ${{ secrets.SECRET_AUTH }}
26
- repository: extenda/hiiretail-developer-docs
27
- event-type: docs-updated
28
- client-payload: '{"repository": "<%-repoName%>", "folders-to-sync": "<%-foldersToSync%>", "sync-release-notes": <%-syncReleaseNotes%>}'
29
- github-token: ${{ env.ORG_TOKEN }}
@@ -1,5 +0,0 @@
1
- # Infrastructure
2
-
3
- This directory contains the infrastructure in form on Terragrunt definitions.
4
- The infrastructure is declared for two environments, `prod` and `staging` that
5
- can change indepently of each other.
@@ -1,24 +0,0 @@
1
- # Set clan-wide variables here. These are automatically pulled in at the root terragrunt.hcl configuration to
2
- # set the remote state configuration and to feed variables forward to the child modules.
3
- locals {
4
- tribe_name = "<%-tribe%>"
5
- clan_name = "<%-clan%>"
6
- region = "europe-west1"
7
- cost_center = "<%-costCenter%>"
8
- jira_project_key = "<%-jiraProjectKey%>"
9
- component = "<%-component%>"
10
- product = "<%-product%>"
11
- tenant_alias = "<%-tenantAlias%>"
12
-
13
- project_id_slack_token = "tf-admin-90301274"
14
- slack_token_secret_name = "monitoring-slack-token"
15
-
16
- clan_group_email = "tribe-<%-tribe%>-<%-clan%>@extendaretail.com"
17
- clan_slack_channels = [{ name = "#<%-tribe%>-<%-clan%>-monitor" }]
18
-
19
- default_user_labels = {
20
- clan = local.clan_name
21
- cc = local.cost_center
22
- jira_project_key = local.jira_project_key
23
- }
24
- }
@@ -1,44 +0,0 @@
1
- # ---------------------------------------------------------------------------------------------------------------------
2
- # TERRAGRUNT CONFIGURATION
3
- # Terragrunt is a thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules,
4
- # remote state, and locking: https://github.com/gruntwork-io/terragrunt
5
- # ---------------------------------------------------------------------------------------------------------------------
6
-
7
- locals {
8
- # Automatically load clan variables
9
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
10
-
11
- # Automatically load project-level variables
12
- project_vars = read_terragrunt_config(find_in_parent_folders("project.hcl"))
13
-
14
- # Extract the variables we need for the creating the remote state
15
- tribe_name = local.common_vars.locals.tribe_name
16
- clan_name = local.common_vars.locals.clan_name
17
- project_name = local.project_vars.locals.project_name
18
- project_env = local.project_vars.locals.project_env
19
- }
20
-
21
- # Configure Terragrunt to automatically store tfstate files in a GCS bucket
22
- remote_state {
23
- backend = "gcs"
24
- config = {
25
- bucket = "tf-state-${local.tribe_name}-${local.clan_name}-${local.project_env}"
26
- prefix = "${path_relative_to_include()}/terraform.tfstate"
27
- }
28
- generate = {
29
- path = "backend.tf"
30
- if_exists = "overwrite_terragrunt"
31
- }
32
- }
33
- # ---------------------------------------------------------------------------------------------------------------------
34
- # GLOBAL PARAMETERS
35
- # These variables apply to all configurations in this subfolder. These are automatically merged into the child
36
- # `terragrunt.hcl` config via the include block.
37
- # ---------------------------------------------------------------------------------------------------------------------
38
-
39
- # Configure root level variables that all resources can inherit. This is especially helpful with multi-account configs
40
- # where terraform_remote_state data sources are placed directly into the modules.
41
- inputs = merge(
42
- local.common_vars.locals,
43
- local.project_vars.locals
44
- )
@@ -1,7 +0,0 @@
1
- slack:
2
- - channel_name: "#<%-tribe%>-<%-clan%>-monitor"
3
- fallback_channel: true
4
-
5
- email:
6
- - email_address: tribe-<%-tribe%>-<%-clan%>@extendaretail.com
7
- fallback_channel: true
@@ -1,29 +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-notification-channels//?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
- common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
15
- labels = merge(local.common_vars.locals.default_user_labels, local.project_vars.locals.default_user_labels, {
16
- component = local.common_vars.locals.component
17
- product = local.common_vars.locals.product
18
- tenant-alias = local.common_vars.locals.tenant_alias
19
- })
20
- }
21
-
22
- # These are the variables we have to pass in to use the module specified in the terragrunt configuration above
23
- inputs = {
24
- project = local.project_vars.locals.tribe_project_id,
25
- notification_channels = yamldecode(file("${get_terragrunt_dir()}/notification-channels.yaml"))
26
- slack_token_secret_project_id = local.common_vars.locals.project_id_slack_token,
27
- slack_token_secret_name = local.common_vars.locals.slack_token_secret_name,
28
- default_user_labels = local.labels,
29
- }
@@ -1,23 +0,0 @@
1
- service_name: Example service
2
- service_repository: github.com/extenda/service1
3
- service_description: |
4
- Add service description in markdown format
5
- releases:
6
- - date: 2020-08-29
7
- version: 1.1.1
8
- items:
9
- - type: Feature
10
- exposure: public
11
- description: |
12
- New feature was added to the service
13
- - type: Changed
14
- exposure: internal
15
- description: |
16
- Published changes to the service from (service2)[http://example.com]
17
- - date: 2020-10-14
18
- version: 1.1.2
19
- items:
20
- - type: Feature
21
- exposure: public
22
- description: |
23
- Serivce now supports ...