@gradientedge/cdk-utils 10.6.0 → 10.8.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 (200) hide show
  1. package/dist/app/api-destined-function/src/lib/lambda.d.ts +1 -0
  2. package/dist/app/api-destined-function/src/lib/lambda.d.ts.map +1 -0
  3. package/dist/app/api-destined-function/src/lib/lambda.js +1 -0
  4. package/dist/app/api-destined-function/src/lib/lambda.js.map +1 -0
  5. package/dist/app/api-destined-function/tsconfig.tsbuildinfo +1 -0
  6. package/dist/src/lib/aws/services/cloudwatch/main.d.ts +11 -11
  7. package/dist/src/lib/azure/common/constants.d.ts +74 -0
  8. package/dist/src/lib/azure/common/constants.js +77 -0
  9. package/dist/src/lib/azure/common/construct.d.ts +15 -3
  10. package/dist/src/lib/azure/common/construct.js +40 -4
  11. package/dist/src/lib/azure/common/stack.d.ts +3 -2
  12. package/dist/src/lib/azure/common/stack.js +25 -42
  13. package/dist/src/lib/azure/common/types.d.ts +13 -2
  14. package/dist/src/lib/azure/construct/event-handler/index.d.ts +2 -0
  15. package/dist/src/lib/azure/construct/event-handler/index.js +2 -0
  16. package/dist/src/lib/azure/construct/event-handler/main.d.ts +20 -0
  17. package/dist/src/lib/azure/construct/event-handler/main.js +139 -0
  18. package/dist/src/lib/azure/construct/event-handler/types.d.ts +35 -0
  19. package/dist/src/lib/azure/construct/event-handler/types.js +1 -0
  20. package/dist/src/lib/azure/construct/function-app/index.d.ts +2 -0
  21. package/dist/src/lib/azure/construct/function-app/index.js +2 -0
  22. package/dist/src/lib/azure/construct/function-app/main.d.ts +51 -0
  23. package/dist/src/lib/azure/construct/function-app/main.js +297 -0
  24. package/dist/src/lib/azure/construct/function-app/types.d.ts +33 -0
  25. package/dist/src/lib/azure/construct/function-app/types.js +1 -0
  26. package/dist/src/lib/azure/construct/index.d.ts +6 -0
  27. package/dist/src/lib/azure/construct/index.js +6 -0
  28. package/dist/src/lib/azure/construct/rest-api/index.d.ts +2 -0
  29. package/dist/src/lib/azure/construct/rest-api/index.js +2 -0
  30. package/dist/src/lib/azure/construct/rest-api/main.d.ts +20 -0
  31. package/dist/src/lib/azure/construct/rest-api/main.js +172 -0
  32. package/dist/src/lib/azure/construct/rest-api/types.d.ts +25 -0
  33. package/dist/src/lib/azure/construct/rest-api/types.js +1 -0
  34. package/dist/src/lib/azure/construct/rest-api-function/index.d.ts +2 -0
  35. package/dist/src/lib/azure/construct/rest-api-function/index.js +2 -0
  36. package/dist/src/lib/azure/construct/rest-api-function/main.d.ts +19 -0
  37. package/dist/src/lib/azure/construct/rest-api-function/main.js +255 -0
  38. package/dist/src/lib/azure/construct/rest-api-function/types.d.ts +29 -0
  39. package/dist/src/lib/azure/construct/rest-api-function/types.js +1 -0
  40. package/dist/src/lib/azure/construct/rest-api-with-cache/index.d.ts +2 -0
  41. package/dist/src/lib/azure/construct/rest-api-with-cache/index.js +2 -0
  42. package/dist/src/lib/azure/construct/rest-api-with-cache/main.d.ts +12 -0
  43. package/dist/src/lib/azure/construct/rest-api-with-cache/main.js +56 -0
  44. package/dist/src/lib/azure/construct/rest-api-with-cache/types.d.ts +13 -0
  45. package/dist/src/lib/azure/construct/rest-api-with-cache/types.js +1 -0
  46. package/dist/src/lib/azure/construct/site-with-webapp/index.d.ts +2 -0
  47. package/dist/src/lib/azure/construct/site-with-webapp/index.js +2 -0
  48. package/dist/src/lib/azure/construct/site-with-webapp/main.d.ts +19 -0
  49. package/dist/src/lib/azure/construct/site-with-webapp/main.js +135 -0
  50. package/dist/src/lib/azure/construct/site-with-webapp/types.d.ts +30 -0
  51. package/dist/src/lib/azure/construct/site-with-webapp/types.js +1 -0
  52. package/dist/src/lib/azure/index.d.ts +1 -0
  53. package/dist/src/lib/azure/index.js +1 -0
  54. package/dist/src/lib/azure/services/api-management/main.d.ts +83 -5
  55. package/dist/src/lib/azure/services/api-management/main.js +114 -148
  56. package/dist/src/lib/azure/services/api-management/types.d.ts +22 -1
  57. package/dist/src/lib/azure/services/app-configuration/main.d.ts +13 -1
  58. package/dist/src/lib/azure/services/app-configuration/main.js +21 -2
  59. package/dist/src/lib/azure/services/app-service/main.d.ts +5 -2
  60. package/dist/src/lib/azure/services/app-service/main.js +12 -4
  61. package/dist/src/lib/azure/services/application-insights/main.d.ts +15 -4
  62. package/dist/src/lib/azure/services/application-insights/main.js +27 -6
  63. package/dist/src/lib/azure/services/application-insights/types.d.ts +4 -1
  64. package/dist/src/lib/azure/services/authorisation/constants.d.ts +13 -0
  65. package/dist/src/lib/azure/services/authorisation/constants.js +14 -0
  66. package/dist/src/lib/azure/services/authorisation/index.d.ts +3 -0
  67. package/dist/src/lib/azure/services/authorisation/index.js +3 -0
  68. package/dist/src/lib/azure/services/authorisation/main.d.ts +84 -0
  69. package/dist/src/lib/azure/services/authorisation/main.js +120 -0
  70. package/dist/src/lib/azure/services/authorisation/types.d.ts +3 -0
  71. package/dist/src/lib/azure/services/authorisation/types.js +1 -0
  72. package/dist/src/lib/azure/services/cosmosdb/constants.d.ts +8 -0
  73. package/dist/src/lib/azure/services/cosmosdb/constants.js +10 -0
  74. package/dist/src/lib/azure/services/cosmosdb/index.d.ts +1 -0
  75. package/dist/src/lib/azure/services/cosmosdb/index.js +1 -0
  76. package/dist/src/lib/azure/services/cosmosdb/main.d.ts +47 -5
  77. package/dist/src/lib/azure/services/cosmosdb/main.js +77 -8
  78. package/dist/src/lib/azure/services/cosmosdb/types.d.ts +3 -1
  79. package/dist/src/lib/azure/services/dns/main.d.ts +9 -4
  80. package/dist/src/lib/azure/services/dns/main.js +12 -8
  81. package/dist/src/lib/azure/services/eventgrid/main.d.ts +12 -7
  82. package/dist/src/lib/azure/services/eventgrid/main.js +18 -19
  83. package/dist/src/lib/azure/services/function/main.d.ts +16 -3
  84. package/dist/src/lib/azure/services/function/main.js +122 -8
  85. package/dist/src/lib/azure/services/function/types.d.ts +3 -4
  86. package/dist/src/lib/azure/services/index.d.ts +3 -0
  87. package/dist/src/lib/azure/services/index.js +3 -0
  88. package/dist/src/lib/azure/services/key-vault/main.d.ts +22 -2
  89. package/dist/src/lib/azure/services/key-vault/main.js +28 -3
  90. package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
  91. package/dist/src/lib/azure/services/monitor/main.d.ts +3 -1
  92. package/dist/src/lib/azure/services/monitor/main.js +3 -2
  93. package/dist/src/lib/azure/services/operational-insights/main.d.ts +13 -2
  94. package/dist/src/lib/azure/services/operational-insights/main.js +17 -3
  95. package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -1
  96. package/dist/src/lib/azure/services/portal/error.d.ts +5 -0
  97. package/dist/src/lib/azure/services/portal/error.js +10 -0
  98. package/dist/src/lib/azure/services/portal/index.d.ts +4 -0
  99. package/dist/src/lib/azure/services/portal/index.js +4 -0
  100. package/dist/src/lib/azure/services/portal/main.d.ts +33 -0
  101. package/dist/src/lib/azure/services/portal/main.js +51 -0
  102. package/dist/src/lib/azure/services/portal/renderer.d.ts +11 -0
  103. package/dist/src/lib/azure/services/portal/renderer.js +156 -0
  104. package/dist/src/lib/azure/services/portal/types.d.ts +40 -0
  105. package/dist/src/lib/azure/services/portal/types.js +1 -0
  106. package/dist/src/lib/azure/services/redis/main.d.ts +4 -2
  107. package/dist/src/lib/azure/services/redis/main.js +3 -2
  108. package/dist/src/lib/azure/services/redis/types.d.ts +1 -1
  109. package/dist/src/lib/azure/services/resource-group/main.d.ts +10 -1
  110. package/dist/src/lib/azure/services/resource-group/main.js +17 -3
  111. package/dist/src/lib/azure/services/security-center/index.d.ts +2 -0
  112. package/dist/src/lib/azure/services/security-center/index.js +2 -0
  113. package/dist/src/lib/azure/services/security-center/main.d.ts +31 -0
  114. package/dist/src/lib/azure/services/security-center/main.js +33 -0
  115. package/dist/src/lib/azure/services/security-center/types.d.ts +3 -0
  116. package/dist/src/lib/azure/services/security-center/types.js +1 -0
  117. package/dist/src/lib/azure/services/servicebus/main.d.ts +28 -22
  118. package/dist/src/lib/azure/services/servicebus/main.js +31 -26
  119. package/dist/src/lib/azure/services/servicebus/types.d.ts +4 -4
  120. package/dist/src/lib/azure/services/storage/main.d.ts +26 -5
  121. package/dist/src/lib/azure/services/storage/main.js +51 -9
  122. package/dist/src/lib/azure/services/storage/types.d.ts +7 -2
  123. package/dist/src/lib/cloudflare/common/construct.js +1 -1
  124. package/dist/src/lib/cloudflare/common/stack.d.ts +2 -2
  125. package/dist/src/lib/cloudflare/common/stack.js +25 -25
  126. package/dist/src/lib/cloudflare/services/worker/main.js +8 -1
  127. package/dist/src/lib/cloudflare/services/worker/types.d.ts +1 -0
  128. package/package.json +26 -23
  129. package/src/lib/azure/common/constants.ts +83 -0
  130. package/src/lib/azure/common/construct.ts +50 -7
  131. package/src/lib/azure/common/stack.ts +26 -43
  132. package/src/lib/azure/common/types.ts +14 -2
  133. package/src/lib/azure/construct/event-handler/index.ts +2 -0
  134. package/src/lib/azure/construct/event-handler/main.ts +183 -0
  135. package/src/lib/azure/construct/event-handler/types.ts +49 -0
  136. package/src/lib/azure/construct/function-app/index.ts +2 -0
  137. package/src/lib/azure/construct/function-app/main.ts +410 -0
  138. package/src/lib/azure/construct/function-app/types.ts +45 -0
  139. package/src/lib/azure/construct/index.ts +6 -0
  140. package/src/lib/azure/construct/rest-api/index.ts +2 -0
  141. package/src/lib/azure/construct/rest-api/main.ts +205 -0
  142. package/src/lib/azure/construct/rest-api/types.ts +33 -0
  143. package/src/lib/azure/construct/rest-api-function/index.ts +2 -0
  144. package/src/lib/azure/construct/rest-api-function/main.ts +297 -0
  145. package/src/lib/azure/construct/rest-api-function/types.ts +39 -0
  146. package/src/lib/azure/construct/rest-api-with-cache/index.ts +2 -0
  147. package/src/lib/azure/construct/rest-api-with-cache/main.ts +75 -0
  148. package/src/lib/azure/construct/rest-api-with-cache/types.ts +15 -0
  149. package/src/lib/azure/construct/site-with-webapp/index.ts +2 -0
  150. package/src/lib/azure/construct/site-with-webapp/main.ts +160 -0
  151. package/src/lib/azure/construct/site-with-webapp/types.ts +33 -0
  152. package/src/lib/azure/index.ts +1 -0
  153. package/src/lib/azure/services/api-management/main.ts +168 -152
  154. package/src/lib/azure/services/api-management/types.ts +30 -1
  155. package/src/lib/azure/services/app-configuration/main.ts +29 -2
  156. package/src/lib/azure/services/app-service/main.ts +23 -4
  157. package/src/lib/azure/services/application-insights/main.ts +46 -7
  158. package/src/lib/azure/services/application-insights/types.ts +6 -2
  159. package/src/lib/azure/services/authorisation/constants.ts +13 -0
  160. package/src/lib/azure/services/authorisation/index.ts +3 -0
  161. package/src/lib/azure/services/authorisation/main.ts +202 -0
  162. package/src/lib/azure/services/authorisation/types.ts +3 -0
  163. package/src/lib/azure/services/cosmosdb/constants.ts +9 -0
  164. package/src/lib/azure/services/cosmosdb/index.ts +1 -0
  165. package/src/lib/azure/services/cosmosdb/main.ts +158 -8
  166. package/src/lib/azure/services/cosmosdb/types.ts +3 -0
  167. package/src/lib/azure/services/dns/main.ts +33 -8
  168. package/src/lib/azure/services/eventgrid/main.ts +41 -23
  169. package/src/lib/azure/services/function/main.ts +155 -9
  170. package/src/lib/azure/services/function/types.ts +3 -4
  171. package/src/lib/azure/services/index.ts +3 -0
  172. package/src/lib/azure/services/key-vault/main.ts +47 -4
  173. package/src/lib/azure/services/key-vault/types.ts +4 -4
  174. package/src/lib/azure/services/monitor/main.ts +5 -2
  175. package/src/lib/azure/services/operational-insights/main.ts +30 -4
  176. package/src/lib/azure/services/operational-insights/types.ts +3 -1
  177. package/src/lib/azure/services/portal/error.ts +12 -0
  178. package/src/lib/azure/services/portal/index.ts +4 -0
  179. package/src/lib/azure/services/portal/main.ts +81 -0
  180. package/src/lib/azure/services/portal/renderer.ts +182 -0
  181. package/src/lib/azure/services/portal/types.ts +45 -0
  182. package/src/lib/azure/services/redis/main.ts +10 -3
  183. package/src/lib/azure/services/redis/types.ts +1 -1
  184. package/src/lib/azure/services/resource-group/main.ts +34 -3
  185. package/src/lib/azure/services/security-center/index.ts +2 -0
  186. package/src/lib/azure/services/security-center/main.ts +42 -0
  187. package/src/lib/azure/services/security-center/types.ts +3 -0
  188. package/src/lib/azure/services/servicebus/main.ts +61 -30
  189. package/src/lib/azure/services/servicebus/types.ts +4 -4
  190. package/src/lib/azure/services/storage/main.ts +91 -9
  191. package/src/lib/azure/services/storage/types.ts +11 -2
  192. package/src/lib/cloudflare/common/construct.ts +1 -1
  193. package/src/lib/cloudflare/common/stack.ts +25 -25
  194. package/src/lib/cloudflare/services/worker/main.ts +10 -1
  195. package/src/lib/cloudflare/services/worker/types.ts +8 -1
  196. package/dist/lib/lambda.d.ts +0 -17
  197. package/dist/lib/lambda.d.ts.map +0 -1
  198. package/dist/lib/lambda.js +0 -28
  199. package/dist/lib/lambda.js.map +0 -1
  200. package/dist/tsconfig.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "10.6.0",
3
+ "version": "10.8.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,7 +14,7 @@
14
14
  "node": ">=22 <=24",
15
15
  "pnpm": "=10"
16
16
  },
17
- "packageManager": "pnpm@10.32.1",
17
+ "packageManager": "pnpm@10.33.0",
18
18
  "repository": {
19
19
  "type": "git",
20
20
  "url": "git+https://github.com/gradientedge/cdk-utils.git"
@@ -55,20 +55,22 @@
55
55
  "prepare": "husky"
56
56
  },
57
57
  "dependencies": {
58
- "@aws-sdk/client-secrets-manager": "^3.1010.0",
59
- "@aws-sdk/credential-providers": "^3.1010.0",
58
+ "@aws-sdk/client-secrets-manager": "^3.1021.0",
59
+ "@aws-sdk/credential-providers": "^3.1021.0",
60
60
  "@aws-sdk/types": "^3.973.6",
61
- "@pulumi/aws": "^7.23.0",
62
- "@pulumi/azure-native": "^3.15.0",
63
- "@pulumi/cloudflare": "^6.13.0",
61
+ "@pulumi/archive": "^0.3.7",
62
+ "@pulumi/aws": "^7.24.0",
63
+ "@pulumi/azure-native": "^3.16.0",
64
+ "@pulumi/cloudflare": "^6.13.1",
64
65
  "@pulumi/command": "^1.2.1",
65
- "@pulumi/pulumi": "^3.226.0",
66
+ "@pulumi/pulumi": "^3.228.0",
66
67
  "@pulumi/std": "^2.3.2",
67
68
  "@types/lodash": "^4.17.24",
68
69
  "@types/node": "^25.5.0",
69
70
  "app-root-path": "^3.1.0",
70
- "aws-cdk-lib": "^2.243.0",
71
- "constructs": "^10.5.1",
71
+ "aws-cdk-lib": "^2.246.0",
72
+ "constructs": "^10.6.0",
73
+ "json5": "^2.2.3",
72
74
  "lodash": "^4.17.23",
73
75
  "moment": "^2.30.1",
74
76
  "nconf": "^0.13.0",
@@ -81,20 +83,23 @@
81
83
  "@babel/eslint-parser": "^7.28.6",
82
84
  "@eslint/config-array": "^0.23.3",
83
85
  "@eslint/object-schema": "^3.0.3",
86
+ "@semantic-release/changelog": "^6.0.3",
87
+ "@semantic-release/github": "^12.0.6",
88
+ "@semantic-release/npm": "^13.1.5",
84
89
  "@types/node": "^25.5.0",
85
- "@typescript-eslint/eslint-plugin": "^8.57.1",
86
- "@typescript-eslint/parser": "^8.57.1",
87
- "@vitest/coverage-v8": "^4.1.0",
88
- "aws-cdk": "^2.1111.0",
90
+ "@typescript-eslint/eslint-plugin": "^8.58.0",
91
+ "@typescript-eslint/parser": "^8.58.0",
92
+ "@vitest/coverage-v8": "^4.1.2",
93
+ "aws-cdk": "^2.1115.1",
89
94
  "better-docs": "^2.7.3",
90
95
  "commitizen": "^4.3.1",
91
96
  "docdash": "^2.0.2",
92
97
  "dotenv": "^17.3.1",
93
98
  "esbuild": "^0.27.4",
94
- "eslint": "^10.0.3",
99
+ "eslint": "^10.1.0",
95
100
  "eslint-config-prettier": "^10.1.8",
96
101
  "eslint-plugin-import": "^2.32.0",
97
- "eslint-plugin-jsdoc": "^62.8.0",
102
+ "eslint-plugin-jsdoc": "^62.8.1",
98
103
  "husky": "^9.1.7",
99
104
  "jsdoc": "^4.0.5",
100
105
  "jsdoc-babel": "^0.5.0",
@@ -104,16 +109,14 @@
104
109
  "prettier": "^3.8.1",
105
110
  "prettier-plugin-organize-imports": "^4.3.0",
106
111
  "rimraf": "^6.1.3",
107
- "rollup": "^4.59.0",
112
+ "rollup": "^4.60.1",
108
113
  "semantic-release": "^25.0.3",
109
- "@semantic-release/changelog": "^6.0.3",
110
- "@semantic-release/github": "^12.0.6",
111
- "@semantic-release/npm": "^13.1.5",
112
114
  "taffydb": "^2.7.3",
115
+ "ts-md5": "^2.0.1",
113
116
  "ts-node": "^10.9.2",
114
- "typescript": "5.9.3",
115
- "vitest": "^4.1.0",
116
- "yaml": "^2.8.2"
117
+ "typescript": "6.0.2",
118
+ "vitest": "^4.1.2",
119
+ "yaml": "^2.8.3"
117
120
  },
118
121
  "optionalDependencies": {
119
122
  "prop-types": "^15.8.1",
@@ -8,3 +8,86 @@ export enum AzureRemoteBackend {
8
8
  * List of Azure resources that excludes tags
9
9
  */
10
10
  export const RESOURCES_TO_EXCLUDE_TAGS = new Set(['ApiManagementNamedValue', 'Application', 'ServicePrincipal'])
11
+
12
+ /**
13
+ * @see https://learn.microsoft.com/en-us/azure/reliability/regions-list?tabs=all
14
+ */
15
+ export const AzureLocation = {
16
+ // Americas
17
+ BrazilSouth: 'brazilsouth',
18
+ BrazilSoutheast: 'brazilsoutheast',
19
+ CanadaCentral: 'canadacentral',
20
+ CanadaEast: 'canadaeast',
21
+ CentralUS: 'centralus',
22
+ EastUS: 'eastus',
23
+ EastUS2: 'eastus2',
24
+ MexicoCentral: 'mexicocentral',
25
+ NorthCentralUS: 'northcentralus',
26
+ SouthCentralUS: 'southcentralus',
27
+ USGovArizona: 'usgovarizona',
28
+ USGovTexas: 'usgovtexas',
29
+ USGovVirginia: 'usgovvirginia',
30
+ WestCentralUS: 'westcentralus',
31
+ WestUS: 'westus',
32
+ WestUS2: 'westus2',
33
+ WestUS3: 'westus3',
34
+
35
+ // Europe
36
+ AustriaCentral: 'austriacentral',
37
+ BelgiumCentral: 'belgiumcentral',
38
+ DenmarkEast: 'denmarkeast',
39
+ FinlandCentral: 'finlandcentral',
40
+ FranceCentral: 'francecentral',
41
+ FranceSouth: 'francesouth',
42
+ GermanyNorth: 'germanynorth',
43
+ GermanyWestCentral: 'germanywestcentral',
44
+ GreeceHydra: 'greecehydra',
45
+ ItalyNorth: 'italynorth',
46
+ NorthEurope: 'northeurope',
47
+ NorwayEast: 'norwayeast',
48
+ NorwayWest: 'norwaywest',
49
+ PolandCentral: 'polandcentral',
50
+ SpainCentral: 'spaincentral',
51
+ SwedenCentral: 'swedencentral',
52
+ SwedenSouth: 'swedensouth',
53
+ SwitzerlandNorth: 'switzerlandnorth',
54
+ SwitzerlandWest: 'switzerlandwest',
55
+ UKSouth: 'uksouth',
56
+ UKWest: 'ukwest',
57
+ WestEurope: 'westeurope',
58
+
59
+ // Middle East & Africa
60
+ IsraelCentral: 'israelcentral',
61
+ QatarCentral: 'qatarcentral',
62
+ SouthAfricaNorth: 'southafricanorth',
63
+ SouthAfricaWest: 'southafricawest',
64
+ UAECentral: 'uaecentral',
65
+ UAENorth: 'uaenorth',
66
+
67
+ // Asia Pacific
68
+ AustraliaCentral: 'australiacentral',
69
+ AustraliaCentral2: 'australiacentral2',
70
+ AustraliaEast: 'australiaeast',
71
+ AustraliaSoutheast: 'australiasoutheast',
72
+ CentralIndia: 'centralindia',
73
+ ChinaEast: 'chinaeast',
74
+ ChinaEast2: 'chinaeast2',
75
+ ChinaNorth: 'chinanorth',
76
+ ChinaNorth2: 'chinanorth2',
77
+ ChinaNorth3: 'chinanorth3',
78
+ EastAsia: 'eastasia',
79
+ JapanEast: 'japaneast',
80
+ JapanWest: 'japanwest',
81
+ KoreaCentral: 'koreacentral',
82
+ KoreaSouth: 'koreasouth',
83
+ MalaysiaSouth: 'malaysiasouth',
84
+ MalaysiaWest: 'malaysiawest',
85
+ NewZealandNorth: 'newzealandnorth',
86
+ SoutheastAsia: 'southeastasia',
87
+ SouthIndia: 'southindia',
88
+ TaiwanNorth: 'taiwannorth',
89
+ TaiwanNorthwest: 'taiwannorthwest',
90
+ WestIndia: 'westindia',
91
+ } as const
92
+
93
+ export type AzureLocation = (typeof AzureLocation)[keyof typeof AzureLocation]
@@ -1,20 +1,26 @@
1
- import { ComponentResource, ComponentResourceOptions } from '@pulumi/pulumi'
1
+ import { getWorkspaceOutput, GetWorkspaceResult, Workspace } from '@pulumi/azure-native/operationalinsights/index.js'
2
+ import { ResourceGroup } from '@pulumi/azure-native/resources/index.js'
3
+ import * as pulumi from '@pulumi/pulumi'
4
+ import { ComponentResource, ComponentResourceOptions, Output } from '@pulumi/pulumi'
2
5
  import { isDevStage, isPrdStage, isTestStage, isUatStage } from '../../common/index.js'
6
+ import { AzureAuthorisationManager } from '../services/authorisation/main.js'
3
7
  import {
4
8
  AzureApiManagementManager,
5
9
  AzureAppConfigurationManager,
6
- AzureAppServiceManager,
7
10
  AzureApplicationInsightsManager,
11
+ AzureAppServiceManager,
8
12
  AzureCosmosDbManager,
9
13
  AzureDnsManager,
10
14
  AzureEventgridManager,
11
15
  AzureFunctionManager,
12
16
  AzureKeyVaultManager,
13
- AzureOperationalInsightsManager,
14
17
  AzureMonitorManager,
18
+ AzureOperationalInsightsManager,
19
+ AzurePortalManager,
15
20
  AzureRedisManager,
16
21
  AzureResourceGroupManager,
17
- AzureServicebusManager,
22
+ AzureSecurityCentermanager,
23
+ AzureServiceBusManager,
18
24
  AzureStorageManager,
19
25
  } from '../services/index.js'
20
26
  import { AzureResourceNameFormatter } from './resource-name-formatter.js'
@@ -41,7 +47,9 @@ export class CommonAzureConstruct extends ComponentResource {
41
47
  declare props: CommonAzureStackProps
42
48
  declare options?: ComponentResourceOptions
43
49
  id: string
50
+ resourceGroup: ResourceGroup
44
51
  fullyQualifiedDomainName: string
52
+ authorisationManager: AzureAuthorisationManager
45
53
  apiManagementManager: AzureApiManagementManager
46
54
  appConfigurationManager: AzureAppConfigurationManager
47
55
  appServiceManager: AzureAppServiceManager
@@ -52,19 +60,23 @@ export class CommonAzureConstruct extends ComponentResource {
52
60
  functionManager: AzureFunctionManager
53
61
  keyVaultManager: AzureKeyVaultManager
54
62
  operationalInsightsManager: AzureOperationalInsightsManager
63
+ portalManager: AzurePortalManager
55
64
  monitorManager: AzureMonitorManager
56
65
  redisManager: AzureRedisManager
57
66
  resourceGroupManager: AzureResourceGroupManager
58
67
  resourceNameFormatter: AzureResourceNameFormatter
59
- servicebusManager: AzureServicebusManager
68
+ securityCentermanager: AzureSecurityCentermanager
69
+ serviceBusManager: AzureServiceBusManager
60
70
  storageManager: AzureStorageManager
71
+ commonLogAnalyticsWorkspace: Workspace | Output<GetWorkspaceResult>
61
72
 
62
73
  constructor(name: string, props: CommonAzureStackProps, options?: ComponentResourceOptions) {
63
- super(`custom:azure:Construct:${name}`, name, props, options)
74
+ super(`azure:${name}`, name, props, options)
64
75
  this.props = props
65
76
  this.options = options
66
77
  this.id = name
67
78
 
79
+ this.authorisationManager = new AzureAuthorisationManager()
68
80
  this.apiManagementManager = new AzureApiManagementManager()
69
81
  this.appConfigurationManager = new AzureAppConfigurationManager()
70
82
  this.appServiceManager = new AzureAppServiceManager()
@@ -75,16 +87,47 @@ export class CommonAzureConstruct extends ComponentResource {
75
87
  this.functionManager = new AzureFunctionManager()
76
88
  this.keyVaultManager = new AzureKeyVaultManager()
77
89
  this.operationalInsightsManager = new AzureOperationalInsightsManager()
90
+ this.portalManager = new AzurePortalManager()
78
91
  this.monitorManager = new AzureMonitorManager()
79
92
  this.redisManager = new AzureRedisManager()
80
93
  this.resourceGroupManager = new AzureResourceGroupManager()
81
94
  this.resourceNameFormatter = new AzureResourceNameFormatter(props)
82
- this.servicebusManager = new AzureServicebusManager()
95
+ this.securityCentermanager = new AzureSecurityCentermanager()
96
+ this.serviceBusManager = new AzureServiceBusManager()
83
97
  this.storageManager = new AzureStorageManager()
84
98
 
85
99
  this.determineFullyQualifiedDomain()
86
100
  }
87
101
 
102
+ protected resolveStack(stackName: string) {
103
+ if (!stackName) throw 'Stack name undefined'
104
+ return new pulumi.StackReference(stackName)
105
+ }
106
+
107
+ protected createResourceGroup() {
108
+ if (this.resourceGroup) return
109
+
110
+ this.resourceGroup = this.resourceGroupManager.createResourceGroup(`${this.id}`, this, {
111
+ resourceGroupName: this.props.stackName,
112
+ location: this.props.location,
113
+ })
114
+
115
+ this.registerOutputs({
116
+ resourceGroupId: this.resourceGroup.id,
117
+ resourceGroupName: this.resourceGroup.name,
118
+ })
119
+ }
120
+
121
+ protected resolveCommonLogAnalyticsWorkspace() {
122
+ if (!this.props.commonLogAnalyticsWorkspace || !this.props.commonLogAnalyticsWorkspace.workspaceName)
123
+ throw 'Props undefined for commonLogAnalyticsWorkspace'
124
+
125
+ this.commonLogAnalyticsWorkspace = getWorkspaceOutput({
126
+ workspaceName: this.props.commonLogAnalyticsWorkspace.workspaceName,
127
+ resourceGroupName: this.props.commonLogAnalyticsWorkspace.resourceGroupName,
128
+ })
129
+ }
130
+
88
131
  /**
89
132
  * @summary Determine the fully qualified domain name based on domainName & subDomain
90
133
  */
@@ -23,6 +23,8 @@ import { CommonAzureStackProps } from './types.js'
23
23
  * ```
24
24
  */
25
25
  export class CommonAzureStack extends ComponentResource {
26
+ public static NODEJS_RUNTIME = '22'
27
+
26
28
  construct: CommonAzureConstruct
27
29
  props: CommonAzureStackProps
28
30
  config: Config
@@ -46,37 +48,13 @@ export class CommonAzureStack extends ComponentResource {
46
48
  * @returns The stack properties
47
49
  */
48
50
  protected determineConstructProps(props: CommonAzureStackProps) {
49
- let projectProps: CommonAzureStackProps = props
50
- if (!projectProps) {
51
- const projectPropsPath = path.join(appRoot.path, 'pulumi.json')
52
- if (!fs.existsSync(projectPropsPath)) throw `Context properties unavailable in path:${projectPropsPath}`
53
-
54
- const projectPropsBuffer = fs.readFileSync(projectPropsPath)
55
- projectProps = JSON.parse(projectPropsBuffer.toString('utf-8'))
56
- }
57
-
58
51
  return {
59
- domainName: projectProps.domainName,
60
- extraContexts: projectProps.extraContexts,
61
- location: projectProps.location,
62
- name: projectProps.resourceGroupName ?? projectProps.name,
63
- resourceGroupName: projectProps.resourceGroupName,
64
- globalPrefix: projectProps.globalPrefix,
65
- globalSuffix: projectProps.globalSuffix,
66
- resourceNameOptions: projectProps.resourceNameOptions,
67
- resourcePrefix: projectProps.resourcePrefix,
68
- resourceSuffix: projectProps.resourceSuffix,
69
- skipStageForARecords: projectProps.skipStageForARecords,
70
- stage: projectProps.stage,
71
- stageContextPath: projectProps.stageContextPath,
72
- subDomain: projectProps.subDomain,
73
- subscriptionId: projectProps.subscriptionId,
74
- tenantId: projectProps.tenantId,
75
- clientId: projectProps.clientId,
76
- clientSecret: projectProps.clientSecret,
77
- defaultTags: projectProps.defaultTags,
78
- ...this.determineExtraContexts(props),
79
- ...this.determineStageContexts(props),
52
+ ...props,
53
+ extraContexts: this.config.getObject('extraContexts'),
54
+ stage: this.config.require('stage'),
55
+ stageContextPath: this.config.require('stageContextPath'),
56
+ ...this.determineExtraContexts(),
57
+ ...this.determineStageContexts(),
80
58
  }
81
59
  }
82
60
 
@@ -85,14 +63,16 @@ export class CommonAzureStack extends ComponentResource {
85
63
  * - Sets the properties from the extra contexts
86
64
  * - Primary use is to have layered config in separate files to enable easier maintenance and readability
87
65
  */
88
- protected determineExtraContexts(props: CommonAzureStackProps) {
89
- if (!props.extraContexts) {
90
- if (props.debug) console.debug(`No additional contexts provided. Using default context properties`)
66
+ protected determineExtraContexts() {
67
+ const extraContexts = this.config.getObject('extraContexts')
68
+ const debug = this.config.getBoolean('debug')
69
+ if (!extraContexts) {
70
+ if (debug) console.debug(`No additional contexts provided. Using default context properties`)
91
71
  return {}
92
72
  }
93
73
 
94
74
  let extraContextProps: Record<string, any> = {}
95
- _.forEach(props.extraContexts, (context: string) => {
75
+ _.forEach(extraContexts, (context: string) => {
96
76
  const extraContextPath = path.join(appRoot.path, context)
97
77
 
98
78
  /* scenario where extra context is configured but absent in file system */
@@ -100,7 +80,7 @@ export class CommonAzureStack extends ComponentResource {
100
80
 
101
81
  /* read the extra properties */
102
82
  const extraContextPropsBuffer = fs.readFileSync(extraContextPath)
103
- if (props.debug) console.debug(`Adding additional contexts provided in ${extraContextPath}`)
83
+ if (debug) console.debug(`Adding additional contexts provided in ${extraContextPath}`)
104
84
 
105
85
  /* parse as JSON properties */
106
86
  extraContextProps = {
@@ -116,23 +96,26 @@ export class CommonAzureStack extends ComponentResource {
116
96
  * - Sets the properties from the extra stage contexts
117
97
  * - Primary use is to have layered config for each environment which is injected into the context
118
98
  */
119
- protected determineStageContexts(props: CommonAzureStackProps) {
120
- const stageContextFilePath = path.join(appRoot.path, props.stageContextPath ?? 'env', `${props.stage}.json`)
121
-
122
- if (isDevStage(props.stage)) {
123
- if (props.debug) console.debug(`Development stage. Using default stage context properties`)
99
+ protected determineStageContexts() {
100
+ const debug = this.config.getBoolean('debug')
101
+ const stage = this.config.require('stage')
102
+ const stageContextPath = this.config.get('stageContextPath')
103
+ const stageContextFilePath = path.join(appRoot.path, stageContextPath ?? 'env', `${stage}.json`)
104
+
105
+ if (isDevStage(stage)) {
106
+ if (debug) console.debug(`Development stage. Using default stage context properties`)
124
107
  }
125
108
 
126
109
  /* alert default context usage when extra stage config is missing */
127
110
  if (!fs.existsSync(stageContextFilePath)) {
128
- if (props.debug) console.debug(`Stage specific context properties unavailable in path:${stageContextFilePath}`)
129
- if (props.debug) console.debug(`Using default stage context properties for ${props.stage} stage`)
111
+ if (debug) console.debug(`Stage specific context properties unavailable in path:${stageContextFilePath}`)
112
+ if (debug) console.debug(`Using default stage context properties for ${stage} stage`)
130
113
  return {}
131
114
  }
132
115
 
133
116
  /* read the extra properties */
134
117
  const stageContextPropsBuffer = fs.readFileSync(stageContextFilePath)
135
- if (props.debug) console.debug(`Adding additional stage contexts provided in ${stageContextFilePath}`)
118
+ if (debug) console.debug(`Adding additional stage contexts provided in ${stageContextFilePath}`)
136
119
 
137
120
  /* parse as JSON properties */
138
121
  return JSON.parse(stageContextPropsBuffer.toString('utf-8'))
@@ -1,11 +1,19 @@
1
+ import { GetComponentOutputArgs } from '@pulumi/azure-native/applicationinsights/index.js'
2
+ import { GetWorkspaceOutputArgs } from '@pulumi/azure-native/operationalinsights/index.js'
1
3
  import { BaseProps } from '../../common/index.js'
2
- import { AzureRemoteBackend } from './constants.js'
4
+ import { AzureLocation, AzureRemoteBackend } from './constants.js'
5
+
6
+ export interface AzureLocationConfig {
7
+ id: string
8
+ name: string
9
+ }
3
10
 
4
11
  /**
5
12
  * @interface CommonAzureStackProps
6
13
  * @description Common properties for Azure stack configuration using Pulumi
7
14
  */
8
15
  export interface CommonAzureStackProps extends BaseProps {
16
+ stackName?: string
9
17
  resourceGroupName?: string
10
18
  remoteBackend?: AzureRemoteBackendProps
11
19
  globalPrefix?: string
@@ -13,8 +21,12 @@ export interface CommonAzureStackProps extends BaseProps {
13
21
  resourcePrefix?: string
14
22
  resourceSuffix?: string
15
23
  resourceNameOptions?: { [key: string]: AzureResourceNameFormatterProps }
16
- location?: string
24
+ location: AzureLocation
25
+ locationConfig?: Record<AzureLocation, AzureLocationConfig>
26
+ locales?: string[]
17
27
  defaultTags?: { [key: string]: string }
28
+ commonLogAnalyticsWorkspace?: GetWorkspaceOutputArgs
29
+ commonApplicationInsights?: GetComponentOutputArgs
18
30
 
19
31
  // Azure Provider properties for Pulumi
20
32
  subscriptionId?: string
@@ -0,0 +1,2 @@
1
+ export * from './main.js'
2
+ export * from './types.js'
@@ -0,0 +1,183 @@
1
+ import { Provider } from '@pulumi/azure-native'
2
+ import { getTopicOutput, GetTopicResult, Topic } from '@pulumi/azure-native/eventgrid/index.js'
3
+ import { Resource } from '@pulumi/azure-native/resources/index.js'
4
+ import { Output } from '@pulumi/pulumi'
5
+ import { AzureFunctionApp } from '../function-app/index.js'
6
+ import { AzureEventHandlerProps, EventHandlerEventGridSubscription, EventHandlerServiceBus } from './types.js'
7
+
8
+ export class AzureEventHandler extends AzureFunctionApp {
9
+ props: AzureEventHandlerProps
10
+ eventGridEventSubscription: EventHandlerEventGridSubscription
11
+ eventGridTopic: Topic | Output<GetTopicResult>
12
+ serviceBus: EventHandlerServiceBus
13
+
14
+ constructor(id: string, props: AzureEventHandlerProps) {
15
+ super(id, props)
16
+ this.props = props
17
+ this.id = id
18
+ }
19
+
20
+ public initResources() {
21
+ this.createResourceGroup()
22
+ this.resolveCommonLogAnalyticsWorkspace()
23
+ this.resolveApplicationInsights()
24
+ this.createEventGridSubscriptionDlqStorageAccount()
25
+ this.createEventGridSubscriptionDlqStorageContainer()
26
+ this.createServiceBusNamespace()
27
+ this.createServiceBusQueue()
28
+ this.createEventGrid()
29
+ this.createEventGridEventSubscription()
30
+ this.createServiceBusDiagnosticLog()
31
+ this.enableMalwareScanningOnDataStorageAccount()
32
+ super.initResources()
33
+ }
34
+
35
+ protected createEventGridSubscriptionDlqStorageAccount() {
36
+ this.eventGridEventSubscription.dlqStorageAccount = this.storageManager.createStorageAccount(
37
+ `${this.id}-eventgrid-subscription-dlq-storage-account`,
38
+ this,
39
+ {
40
+ ...this.props.eventGridSubscription.dlqStorageAccount,
41
+ resourceGroupName: this.resourceGroup.name,
42
+ location: this.resourceGroup.location,
43
+ }
44
+ )
45
+ }
46
+
47
+ protected createEventGridSubscriptionDlqStorageContainer() {
48
+ this.eventGridEventSubscription.dlqStorageContainer = this.storageManager.createStorageContainer(
49
+ `${this.id}-eventgrid-subscription-dlq-container`,
50
+ this,
51
+ {
52
+ ...this.props.eventGridSubscription.dlqStorageContainer,
53
+ accountName: this.eventGridEventSubscription.dlqStorageAccount.name,
54
+ containerName: 'eventgrid-subscription-dlq-container',
55
+ resourceGroupName: this.resourceGroup.name,
56
+ }
57
+ )
58
+ }
59
+
60
+ protected createServiceBusNamespace() {
61
+ this.serviceBus.namespace = this.serviceBusManager.createServiceBusNamespace(
62
+ this.id,
63
+ this,
64
+ {
65
+ ...this.props.serviceBus.namespace,
66
+ namespaceName: this.props.serviceBus.namespace.namespaceName ?? this.id,
67
+ resourceGroupName: this.resourceGroup.name,
68
+ },
69
+ { ignoreChanges: ['location'] }
70
+ )
71
+
72
+ this.registerOutputs({
73
+ serviceBusNamespaceId: this.serviceBus.namespace.id,
74
+ })
75
+ }
76
+
77
+ protected createServiceBusQueue() {
78
+ this.serviceBus.queue = this.serviceBusManager.createServiceBusQueue(this.id, this, {
79
+ ...this.props.serviceBus.queue,
80
+ queueName: this.props.serviceBus.queue.queueName ?? this.id,
81
+ namespaceName: this.serviceBus.namespace.name,
82
+ })
83
+
84
+ this.registerOutputs({
85
+ serviceBusQueueId: this.serviceBus.queue.id,
86
+ serviceBusQueueName: this.serviceBus.queue.name,
87
+ })
88
+ }
89
+
90
+ protected createEventGrid() {
91
+ if (!this.props.eventGridTopic.useExistingTopic) {
92
+ this.eventGridTopic = this.eventgridManager.createEventgridTopic(
93
+ this.id,
94
+ this,
95
+ {
96
+ ...this.props.eventGridTopic,
97
+ topicName: this.props.eventGridTopic.topicName ?? this.id,
98
+ location: this.resourceGroup.location,
99
+ resourceGroupName: this.resourceGroup.name,
100
+ },
101
+ { protect: true, ignoreChanges: ['location'] }
102
+ )
103
+ return
104
+ }
105
+
106
+ const existingSubscriptionId = this.props.eventGridTopic.existingSubscriptionId
107
+ const existingTopicName = this.props.eventGridTopic.existingTopicName
108
+ const existingResourceGroupName = this.props.eventGridTopic.existingResourceGroupName
109
+
110
+ let provider: Provider | undefined
111
+ if (existingSubscriptionId) {
112
+ provider = new Provider(`${this.id}-${existingSubscriptionId}`, {
113
+ subscriptionId: existingSubscriptionId,
114
+ })
115
+ }
116
+ if (existingResourceGroupName && existingTopicName) {
117
+ this.eventGridTopic = getTopicOutput(
118
+ {
119
+ topicName: existingTopicName,
120
+ resourceGroupName: existingResourceGroupName,
121
+ },
122
+ { provider }
123
+ )
124
+ }
125
+ }
126
+
127
+ protected createEventGridEventSubscription() {
128
+ this.eventGridEventSubscription.eventSubscription = this.eventgridManager.createEventgridSubscription(
129
+ this.id,
130
+ this,
131
+ {
132
+ ...this.props.eventGridEventSubscription,
133
+ eventSubscriptionName: this.props.eventGridEventSubscription.eventSubscriptionName ?? this.id,
134
+ scope: this.eventGridTopic.id,
135
+ destination: {
136
+ endpointType: 'ServiceBusQueue',
137
+ resourceId: this.serviceBus.queue.id,
138
+ },
139
+ deadLetterDestination: {
140
+ blobContainerName: this.eventGridEventSubscription.dlqStorageContainer.name,
141
+ endpointType: 'StorageBlob',
142
+ resourceId: this.eventGridEventSubscription.dlqStorageAccount.id,
143
+ },
144
+ },
145
+ { dependsOn: [this.eventGridTopic as unknown as Resource] }
146
+ )
147
+ }
148
+
149
+ protected createServiceBusDiagnosticLog() {
150
+ this.monitorManager.createMonitorDiagnosticSettings(this.id, this, {
151
+ name: `${this.props.stackName}-servicebus`,
152
+ resourceUri: this.serviceBus.namespace.id,
153
+ workspaceId: this.commonLogAnalyticsWorkspace.id,
154
+ logAnalyticsDestinationType: 'Dedicated',
155
+ logs: [
156
+ {
157
+ categoryGroup: 'allLogs',
158
+ enabled: true,
159
+ },
160
+ ],
161
+ metrics: [
162
+ {
163
+ category: 'AllMetrics',
164
+ enabled: true,
165
+ },
166
+ ],
167
+ })
168
+ }
169
+
170
+ protected enableMalwareScanningOnDataStorageAccount() {
171
+ if (!this.props.defender) return
172
+
173
+ this.securityCentermanager.createDefenderForStorage(`${this.id}-data-storage-defender`, this, {
174
+ ...this.props.defender,
175
+ resourceId: this.dataStorageAccount.id,
176
+ properties: {
177
+ malwareScanning: {
178
+ scanResultsEventGridTopicResourceId: this.eventGridTopic.id,
179
+ },
180
+ },
181
+ })
182
+ }
183
+ }