@slamb2k/mad-skills 2.0.13 → 2.0.15

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.
@@ -0,0 +1,359 @@
1
+ # Bicep Templates
2
+
3
+ Azure-native IaC templates. Bicep compiles to ARM and deploys via Azure Resource
4
+ Manager — no external state management needed. Azure handles idempotency natively.
5
+
6
+ ---
7
+
8
+ ## Project Root
9
+
10
+ ### main.bicep
11
+
12
+ ```bicep
13
+ targetScope = 'subscription'
14
+
15
+ @description('Deployment environment')
16
+ @allowed(['dev', 'staging', 'prod'])
17
+ param environment string
18
+
19
+ @description('Azure region')
20
+ param location string = 'eastus'
21
+
22
+ @description('Project name')
23
+ param project string = '{PROJECT}'
24
+
25
+ var namePrefix = '${project}-${environment}'
26
+ var tags = {
27
+ project: project
28
+ environment: environment
29
+ managedBy: 'bicep'
30
+ }
31
+
32
+ // Resource Group
33
+ resource rg 'Microsoft.Resources/resourceGroups@2024-03-01' = {
34
+ name: 'rg-${namePrefix}'
35
+ location: location
36
+ tags: tags
37
+ }
38
+
39
+ // Container Registry (shared across environments or per-env)
40
+ module registry 'modules/registry.bicep' = {
41
+ scope: rg
42
+ name: 'registry'
43
+ params: {
44
+ name: 'acr${replace(namePrefix, '-', '')}'
45
+ location: location
46
+ sku: environment == 'prod' ? 'Premium' : 'Basic'
47
+ tags: tags
48
+ }
49
+ }
50
+
51
+ // Add module deployments for each selected component
52
+
53
+ // Outputs for /dock integration
54
+ output registryUrl string = registry.outputs.loginServer
55
+ output registryName string = registry.outputs.name
56
+ output resourceGroupName string = rg.name
57
+ ```
58
+
59
+ ### main.bicepparam (template)
60
+
61
+ ```bicep
62
+ using 'main.bicep'
63
+
64
+ param environment = '{ENV}'
65
+ param location = '{REGION}'
66
+ param project = '{PROJECT}'
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Module: Container Registry
72
+
73
+ ### modules/registry.bicep
74
+
75
+ ```bicep
76
+ @description('Registry name (must be globally unique, alphanumeric)')
77
+ param name string
78
+
79
+ @description('Azure region')
80
+ param location string
81
+
82
+ @description('SKU tier')
83
+ @allowed(['Basic', 'Standard', 'Premium'])
84
+ param sku string = 'Basic'
85
+
86
+ param tags object = {}
87
+
88
+ resource acr 'Microsoft.ContainerRegistry/registries@2023-11-01-preview' = {
89
+ name: name
90
+ location: location
91
+ sku: {
92
+ name: sku
93
+ }
94
+ properties: {
95
+ adminUserEnabled: false
96
+ publicNetworkAccess: 'Enabled'
97
+ }
98
+ tags: tags
99
+ }
100
+
101
+ output loginServer string = acr.properties.loginServer
102
+ output name string = acr.name
103
+ output id string = acr.id
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Module: Container Apps
109
+
110
+ ### modules/container-apps.bicep
111
+
112
+ ```bicep
113
+ @description('Environment name prefix')
114
+ param namePrefix string
115
+
116
+ @description('Azure region')
117
+ param location string
118
+
119
+ param tags object = {}
120
+
121
+ @description('Minimum replicas (0 for dev, 2 for prod)')
122
+ param minReplicas int = 0
123
+
124
+ @description('Maximum replicas')
125
+ param maxReplicas int = 10
126
+
127
+ resource containerAppEnv 'Microsoft.App/managedEnvironments@2024-03-01' = {
128
+ name: 'cae-${namePrefix}'
129
+ location: location
130
+ properties: {
131
+ zoneRedundant: minReplicas >= 2
132
+ }
133
+ tags: tags
134
+ }
135
+
136
+ output environmentId string = containerAppEnv.id
137
+ output defaultDomain string = containerAppEnv.properties.defaultDomain
138
+ output name string = containerAppEnv.name
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Module: PostgreSQL
144
+
145
+ ### modules/database.bicep
146
+
147
+ ```bicep
148
+ @description('Server name prefix')
149
+ param namePrefix string
150
+
151
+ @description('Azure region')
152
+ param location string
153
+
154
+ @description('Administrator login')
155
+ @secure()
156
+ param adminUsername string
157
+
158
+ @description('Administrator password')
159
+ @secure()
160
+ param adminPassword string
161
+
162
+ @description('Database name')
163
+ param databaseName string = 'app'
164
+
165
+ @description('Environment tier for sizing')
166
+ @allowed(['dev', 'staging', 'prod'])
167
+ param environment string
168
+
169
+ param tags object = {}
170
+
171
+ var skuMap = {
172
+ dev: {
173
+ name: 'B_Standard_B1ms'
174
+ tier: 'Burstable'
175
+ storageSizeGB: 32
176
+ }
177
+ staging: {
178
+ name: 'GP_Standard_D2s_v3'
179
+ tier: 'GeneralPurpose'
180
+ storageSizeGB: 64
181
+ }
182
+ prod: {
183
+ name: 'GP_Standard_D4s_v3'
184
+ tier: 'GeneralPurpose'
185
+ storageSizeGB: 128
186
+ }
187
+ }
188
+
189
+ resource server 'Microsoft.DBforPostgreSQL/flexibleServers@2023-12-01-preview' = {
190
+ name: 'psql-${namePrefix}'
191
+ location: location
192
+ sku: {
193
+ name: skuMap[environment].name
194
+ tier: skuMap[environment].tier
195
+ }
196
+ properties: {
197
+ version: '16'
198
+ administratorLogin: adminUsername
199
+ administratorLoginPassword: adminPassword
200
+ storage: {
201
+ storageSizeGB: skuMap[environment].storageSizeGB
202
+ }
203
+ highAvailability: {
204
+ mode: environment == 'prod' ? 'ZoneRedundant' : 'Disabled'
205
+ }
206
+ backup: {
207
+ backupRetentionDays: environment == 'prod' ? 35 : 7
208
+ geoRedundantBackup: environment == 'prod' ? 'Enabled' : 'Disabled'
209
+ }
210
+ }
211
+ tags: tags
212
+ }
213
+
214
+ resource database 'Microsoft.DBforPostgreSQL/flexibleServers/databases@2023-12-01-preview' = {
215
+ parent: server
216
+ name: databaseName
217
+ properties: {
218
+ charset: 'UTF8'
219
+ collation: 'en_US.utf8'
220
+ }
221
+ }
222
+
223
+ resource firewallAllowAzure 'Microsoft.DBforPostgreSQL/flexibleServers/firewallRules@2023-12-01-preview' = {
224
+ parent: server
225
+ name: 'AllowAzureServices'
226
+ properties: {
227
+ startIpAddress: '0.0.0.0'
228
+ endIpAddress: '0.0.0.0'
229
+ }
230
+ }
231
+
232
+ output fqdn string = server.properties.fullyQualifiedDomainName
233
+ output serverName string = server.name
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Module: Key Vault
239
+
240
+ ### modules/keyvault.bicep
241
+
242
+ ```bicep
243
+ param namePrefix string
244
+ param location string
245
+ param tags object = {}
246
+
247
+ @allowed(['dev', 'staging', 'prod'])
248
+ param environment string
249
+
250
+ resource kv 'Microsoft.KeyVault/vaults@2023-07-01' = {
251
+ name: 'kv-${namePrefix}'
252
+ location: location
253
+ properties: {
254
+ tenantId: subscription().tenantId
255
+ sku: {
256
+ family: 'A'
257
+ name: 'standard'
258
+ }
259
+ enableRbacAuthorization: true
260
+ enablePurgeProtection: environment == 'prod'
261
+ enableSoftDelete: true
262
+ softDeleteRetentionInDays: 90
263
+ }
264
+ tags: tags
265
+ }
266
+
267
+ output vaultUri string = kv.properties.vaultUri
268
+ output vaultId string = kv.id
269
+ output name string = kv.name
270
+ ```
271
+
272
+ ---
273
+
274
+ ## Module: Networking
275
+
276
+ ### modules/networking.bicep
277
+
278
+ ```bicep
279
+ param namePrefix string
280
+ param location string
281
+ param addressSpace string = '10.0.0.0/16'
282
+ param tags object = {}
283
+
284
+ resource vnet 'Microsoft.Network/virtualNetworks@2024-01-01' = {
285
+ name: 'vnet-${namePrefix}'
286
+ location: location
287
+ properties: {
288
+ addressSpace: {
289
+ addressPrefixes: [addressSpace]
290
+ }
291
+ subnets: [
292
+ {
293
+ name: 'snet-app'
294
+ properties: {
295
+ addressPrefix: cidrSubnet(addressSpace, 24, 1)
296
+ }
297
+ }
298
+ {
299
+ name: 'snet-db'
300
+ properties: {
301
+ addressPrefix: cidrSubnet(addressSpace, 24, 2)
302
+ delegations: [
303
+ {
304
+ name: 'postgresql'
305
+ properties: {
306
+ serviceName: 'Microsoft.DBforPostgreSQL/flexibleServers'
307
+ }
308
+ }
309
+ ]
310
+ }
311
+ }
312
+ ]
313
+ }
314
+ tags: tags
315
+ }
316
+
317
+ output vnetId string = vnet.id
318
+ output appSubnetId string = vnet.properties.subnets[0].id
319
+ output dbSubnetId string = vnet.properties.subnets[1].id
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Module: Monitoring
325
+
326
+ ### modules/monitoring.bicep
327
+
328
+ ```bicep
329
+ param namePrefix string
330
+ param location string
331
+ param tags object = {}
332
+
333
+ resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
334
+ name: 'log-${namePrefix}'
335
+ location: location
336
+ properties: {
337
+ sku: {
338
+ name: 'PerGB2018'
339
+ }
340
+ retentionInDays: 30
341
+ }
342
+ tags: tags
343
+ }
344
+
345
+ resource appInsights 'Microsoft.Insights/components@2020-02-02' = {
346
+ name: 'appi-${namePrefix}'
347
+ location: location
348
+ kind: 'web'
349
+ properties: {
350
+ Application_Type: 'web'
351
+ WorkspaceResourceId: logAnalytics.id
352
+ }
353
+ tags: tags
354
+ }
355
+
356
+ output logAnalyticsId string = logAnalytics.id
357
+ output appInsightsKey string = appInsights.properties.InstrumentationKey
358
+ output appInsightsConnectionString string = appInsights.properties.ConnectionString
359
+ ```