@gradientedge/cdk-utils-azure 2.15.0 → 2.16.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.
@@ -85,7 +85,6 @@ export class CommonAzureConstruct extends ComponentResource {
85
85
  resourceGroupName: this.props.resourceGroupName ?? this.id,
86
86
  location: this.props.location,
87
87
  });
88
- this.props.resourceGroupName = this.resourceNameFormatter.format(this.props.resourceGroupName ?? this.id);
89
88
  this.registerOutputs({
90
89
  resourceGroupId: this.resourceGroup.id,
91
90
  resourceGroupName: this.resourceGroup.name,
@@ -34,27 +34,25 @@ export class AzureApiManagementManager {
34
34
  if (!props)
35
35
  throw new Error(`Props undefined for ${id}`);
36
36
  // Get resource group name
37
- const resourceGroupName = scope.props.resourceGroupName
38
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
39
- : props.resourceGroupName;
40
- if (!resourceGroupName)
41
- throw new Error(`Resource group name undefined for ${id}`);
37
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
42
38
  const apiManagementService = new ApiManagementService(`${id}-am`, {
43
39
  ...props,
44
40
  serviceName: scope.resourceNameFormatter.format(props.serviceName?.toString(), scope.props.resourceNameOptions?.apiManagement),
45
- resourceGroupName: resourceGroupName,
41
+ resourceGroupName,
46
42
  location: props.location ?? scope.props.location,
47
43
  publisherEmail: props.publisherEmail ?? 'noreply@example.com',
48
44
  publisherName: props.publisherName ?? 'Default Publisher',
49
- tags: props.tags ?? {
45
+ tags: {
50
46
  environment: scope.props.stage,
47
+ ...scope.props.defaultTags,
48
+ ...props.tags,
51
49
  },
52
50
  }, { parent: scope, ...resourceOptions });
53
51
  // Create logger if Application Insights key is provided
54
52
  if (applicationInsightsKey) {
55
53
  new Logger(`${id}-am-logger`, {
56
54
  loggerId: scope.resourceNameFormatter.format(props.serviceName?.toString(), scope.props.resourceNameOptions?.apiManagementLogger),
57
- resourceGroupName: resourceGroupName,
55
+ resourceGroupName,
58
56
  serviceName: apiManagementService.name,
59
57
  loggerType: LoggerType.ApplicationInsights,
60
58
  credentials: {
@@ -75,7 +73,7 @@ export class AzureApiManagementManager {
75
73
  new Cache(`${id}-am-redis-cache`, {
76
74
  cacheId: scope.resourceNameFormatter.format(props.serviceName?.toString(), scope.props.resourceNameOptions?.apiManagementRedisCache),
77
75
  serviceName: apiManagementService.name,
78
- resourceGroupName: resourceGroupName,
76
+ resourceGroupName,
79
77
  connectionString: connectionString,
80
78
  useFromLocation: cluster.location,
81
79
  resourceId: cluster.id,
@@ -95,7 +93,7 @@ export class AzureApiManagementManager {
95
93
  if (!props)
96
94
  throw new Error(`Props undefined for ${id}`);
97
95
  return getApiManagementServiceOutput({
98
- serviceName: scope.resourceNameFormatter.format(props.serviceName?.toString(), scope.props.resourceNameOptions?.dataAzurermApiManagement),
96
+ serviceName: scope.resourceNameFormatter.format(props.serviceName?.toString()),
99
97
  resourceGroupName: scope.props.resourceGroupName
100
98
  ? `${scope.props.resourceGroupName}-${scope.props.stage}`
101
99
  : props.resourceGroupName,
@@ -30,15 +30,11 @@ export class AzureAppConfigurationManager {
30
30
  if (!props)
31
31
  throw new Error(`Props undefined for ${id}`);
32
32
  // Get resource group name
33
- const resourceGroupName = scope.props.resourceGroupName
34
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
- : props.resourceGroupName;
36
- if (!resourceGroupName)
37
- throw new Error(`Resource group name undefined for ${id}`);
33
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
38
34
  return new ConfigurationStore(`${id}-ac`, {
39
35
  ...props,
40
36
  configStoreName: scope.resourceNameFormatter.format(props.configStoreName?.toString(), scope.props.resourceNameOptions?.appConfiguration),
41
- resourceGroupName: resourceGroupName,
37
+ resourceGroupName,
42
38
  location: props.location ?? scope.props.location,
43
39
  identity: props.identity ?? {
44
40
  type: IdentityType.SystemAssigned,
@@ -46,8 +42,10 @@ export class AzureAppConfigurationManager {
46
42
  sku: props.sku ?? {
47
43
  name: 'standard',
48
44
  },
49
- tags: props.tags ?? {
45
+ tags: {
50
46
  environment: scope.props.stage,
47
+ ...scope.props.defaultTags,
48
+ ...props.tags,
51
49
  },
52
50
  }, { parent: scope, ...resourceOptions });
53
51
  }
@@ -30,15 +30,11 @@ export class AzureAppServiceManager {
30
30
  if (!props)
31
31
  throw new Error(`Props undefined for ${id}`);
32
32
  // Get resource group name
33
- const resourceGroupName = scope.props.resourceGroupName
34
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
- : props.resourceGroupName;
36
- if (!resourceGroupName)
37
- throw new Error(`Resource group name undefined for ${id}`);
33
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
38
34
  return new AppServicePlan(`${id}-as`, {
39
35
  ...props,
40
36
  name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.appServicePlan),
41
- resourceGroupName: resourceGroupName,
37
+ resourceGroupName,
42
38
  location: props.location ?? scope.props.location,
43
39
  sku: props.sku ?? {
44
40
  name: 'FC1',
@@ -46,8 +42,10 @@ export class AzureAppServiceManager {
46
42
  },
47
43
  reserved: props.reserved ?? true,
48
44
  zoneRedundant: props.zoneRedundant ?? true,
49
- tags: props.tags ?? {
45
+ tags: {
50
46
  environment: scope.props.stage,
47
+ ...scope.props.defaultTags,
48
+ ...props.tags,
51
49
  },
52
50
  }, { parent: scope, ...resourceOptions });
53
51
  }
@@ -63,15 +61,11 @@ export class AzureAppServiceManager {
63
61
  if (!props)
64
62
  throw new Error(`Props undefined for ${id}`);
65
63
  // Get resource group name
66
- const resourceGroupName = scope.props.resourceGroupName
67
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
68
- : props.resourceGroupName;
69
- if (!resourceGroupName)
70
- throw new Error(`Resource group name undefined for ${id}`);
64
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
71
65
  return new WebApp(`${id}-lwa`, {
72
66
  ...props,
73
67
  name: scope.resourceNameFormatter.format(props.name?.toString(), scope.props.resourceNameOptions?.linuxWebApp),
74
- resourceGroupName: resourceGroupName,
68
+ resourceGroupName,
75
69
  location: props.location ?? scope.props.location,
76
70
  httpsOnly: props.httpsOnly ?? true,
77
71
  kind: props.kind ?? 'app,linux',
@@ -83,8 +77,10 @@ export class AzureAppServiceManager {
83
77
  linuxFxVersion: 'NODE|22-lts',
84
78
  minTlsVersion: SupportedTlsVersions.SupportedTlsVersions_1_3,
85
79
  },
86
- tags: props.tags ?? {
80
+ tags: {
87
81
  environment: scope.props.stage,
82
+ ...scope.props.defaultTags,
83
+ ...props.tags,
88
84
  },
89
85
  }, { parent: scope, ...resourceOptions });
90
86
  }
@@ -30,7 +30,7 @@ export class AzureApplicationInsightsManager {
30
30
  if (!props)
31
31
  throw new Error(`Props undefined for ${id}`);
32
32
  // Get resource group name
33
- const resourceGroupName = scope.props.resourceGroupName
33
+ const resourceGroupName = (props.resourceGroupName ?? scope.props.resourceGroupName)
34
34
  ? `${scope.props.resourceGroupName}-${scope.props.stage}`
35
35
  : props.resourceGroupName;
36
36
  if (!resourceGroupName)
@@ -38,11 +38,13 @@ export class AzureApplicationInsightsManager {
38
38
  const component = new Component(`${id}-ai`, {
39
39
  ...props,
40
40
  resourceName: scope.resourceNameFormatter.format(props.resourceName?.toString(), scope.props.resourceNameOptions?.applicationInsights),
41
- resourceGroupName: resourceGroupName,
41
+ resourceGroupName,
42
42
  applicationType: props.applicationType ?? ApplicationType.Web,
43
43
  kind: props.kind ?? 'web',
44
- tags: props.tags ?? {
44
+ tags: {
45
45
  environment: scope.props.stage,
46
+ ...scope.props.defaultTags,
47
+ ...props.tags,
46
48
  },
47
49
  }, { parent: scope, ...resourceOptions });
48
50
  if (props.billingFeatures) {
@@ -31,18 +31,16 @@ export class AzureCosmosDbManager {
31
31
  if (!props)
32
32
  throw new Error(`Props undefined for ${id}`);
33
33
  // Get resource group name
34
- const resourceGroupName = scope.props.resourceGroupName
35
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
36
- : props.resourceGroupName;
37
- if (!resourceGroupName)
38
- throw new Error(`Resource group name undefined for ${id}`);
34
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
39
35
  return new DatabaseAccount(`${id}-ca`, {
40
36
  ...props,
41
37
  accountName: scope.resourceNameFormatter.format(props.accountName?.toString(), scope.props.resourceNameOptions?.cosmosDbAccount),
42
38
  location: props.location ?? scope.props.location,
43
- resourceGroupName: resourceGroupName,
44
- tags: props.tags ?? {
39
+ resourceGroupName,
40
+ tags: {
45
41
  environment: scope.props.stage,
42
+ ...scope.props.defaultTags,
43
+ ...props.tags,
46
44
  },
47
45
  identity: props.identity ?? {
48
46
  type: ResourceIdentityType.SystemAssigned,
@@ -61,15 +59,11 @@ export class AzureCosmosDbManager {
61
59
  if (!props)
62
60
  throw new Error(`Props undefined for ${id}`);
63
61
  // Get resource group name
64
- const resourceGroupName = scope.props.resourceGroupName
65
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
66
- : props.resourceGroupName;
67
- if (!resourceGroupName)
68
- throw new Error(`Resource group name undefined for ${id}`);
62
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
69
63
  return new SqlResourceSqlDatabase(`${id}-cd`, {
70
64
  ...props,
71
65
  databaseName: scope.resourceNameFormatter.format(props.databaseName?.toString(), scope.props.resourceNameOptions?.cosmosDbSqlDatabase),
72
- resourceGroupName: resourceGroupName,
66
+ resourceGroupName,
73
67
  }, { parent: scope, ...resourceOptions });
74
68
  }
75
69
  /**
@@ -84,7 +78,7 @@ export class AzureCosmosDbManager {
84
78
  if (!props)
85
79
  throw new Error(`Props undefined for ${id}`);
86
80
  // Get resource group name
87
- const resourceGroupName = scope.props.resourceGroupName
81
+ const resourceGroupName = (props.resourceGroupName ?? scope.props.resourceGroupName)
88
82
  ? `${scope.props.resourceGroupName}-${scope.props.stage}`
89
83
  : props.resourceGroupName;
90
84
  if (!resourceGroupName)
@@ -92,7 +86,7 @@ export class AzureCosmosDbManager {
92
86
  return new SqlResourceSqlContainer(`${id}-cc`, {
93
87
  ...props,
94
88
  containerName: scope.resourceNameFormatter.format(props.containerName?.toString(), scope.props.resourceNameOptions?.cosmosDbSqlContainer),
95
- resourceGroupName: resourceGroupName,
89
+ resourceGroupName,
96
90
  }, { parent: scope, ...resourceOptions });
97
91
  }
98
92
  /**
@@ -143,7 +137,7 @@ export class AzureCosmosDbManager {
143
137
  const cosmosdbSqlRoleDefinitionContributor = this.resolveSqlRoleDefinition(scope, cosmosDbAccount.name, resourceGroupName, CosmosRoleDefinitionId.CONTRIBUTOR, resourceOptions);
144
138
  this.createSqlResourceSqlRoleAssignment(`${id}-cdb-ra-contributor`, scope, {
145
139
  accountName: cosmosDbAccount.name,
146
- resourceGroupName: resourceGroupName,
140
+ resourceGroupName,
147
141
  roleDefinitionId: cosmosdbSqlRoleDefinitionContributor.id,
148
142
  principalId,
149
143
  scope: cosmosDbAccount.id,
@@ -153,7 +147,7 @@ export class AzureCosmosDbManager {
153
147
  const cosmosdbSqlRoleDefinitionReader = this.resolveSqlRoleDefinition(scope, cosmosDbAccount.name, resourceGroupName, CosmosRoleDefinitionId.READER, resourceOptions);
154
148
  this.createSqlResourceSqlRoleAssignment(`${id}-cdb-ra-reader`, scope, {
155
149
  accountName: cosmosDbAccount.name,
156
- resourceGroupName: resourceGroupName,
150
+ resourceGroupName,
157
151
  roleDefinitionId: cosmosdbSqlRoleDefinitionReader.id,
158
152
  principalId,
159
153
  scope: cosmosDbAccount.id,
@@ -30,18 +30,16 @@ export class AzureDnsManager {
30
30
  if (!props)
31
31
  throw new Error(`Props undefined for ${id}`);
32
32
  // Get resource group name
33
- const resourceGroupName = scope.props.resourceGroupName
34
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
- : props.resourceGroupName;
36
- if (!resourceGroupName)
37
- throw new Error(`Resource group name undefined for ${id}`);
33
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
38
34
  return new Zone(`${id}-dz`, {
39
35
  ...props,
40
36
  zoneName: scope.resourceNameFormatter.format(props.zoneName?.toString(), scope.props.resourceNameOptions?.dnsZone),
41
- resourceGroupName: resourceGroupName,
37
+ resourceGroupName,
42
38
  location: 'global', // DNS zones are always global
43
- tags: props.tags ?? {
39
+ tags: {
44
40
  environment: scope.props.stage,
41
+ ...scope.props.defaultTags,
42
+ ...props.tags,
45
43
  },
46
44
  }, { parent: scope, ...resourceOptions });
47
45
  }
@@ -30,18 +30,16 @@ export class AzureEventgridManager {
30
30
  if (!props)
31
31
  throw new Error(`Props undefined for ${id}`);
32
32
  // Get resource group name
33
- const resourceGroupName = scope.props.resourceGroupName
34
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
- : props.resourceGroupName;
36
- if (!resourceGroupName)
37
- throw new Error(`Resource group name undefined for ${id}`);
33
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
38
34
  return new Topic(`${id}-et`, {
39
35
  ...props,
40
36
  topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.eventGridTopic),
41
37
  location: props.location ?? scope.props.location,
42
- resourceGroupName: resourceGroupName,
43
- tags: props.tags ?? {
38
+ resourceGroupName,
39
+ tags: {
44
40
  environment: scope.props.stage,
41
+ ...scope.props.defaultTags,
42
+ ...props.tags,
45
43
  },
46
44
  }, { parent: scope, ...resourceOptions });
47
45
  }
@@ -58,7 +56,7 @@ export class AzureEventgridManager {
58
56
  throw new Error(`Props undefined for ${id}`);
59
57
  return getTopicOutput({
60
58
  topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.eventGridTopic),
61
- resourceGroupName: scope.props.resourceGroupName
59
+ resourceGroupName: (props.resourceGroupName ?? scope.props.resourceGroupName)
62
60
  ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
63
61
  : props.resourceGroupName,
64
62
  }, { parent: scope, ...resourceOptions });
@@ -95,18 +93,16 @@ export class AzureEventgridManager {
95
93
  createEventgridSystemTopic(id, scope, props, resourceOptions) {
96
94
  if (!props)
97
95
  throw new Error(`Props undefined for ${id}`);
98
- const resourceGroupName = scope.props.resourceGroupName
99
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
100
- : props.resourceGroupName;
101
- if (!resourceGroupName)
102
- throw new Error(`Resource group name undefined for ${id}`);
96
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
103
97
  return new SystemTopic(`${id}-est`, {
104
98
  ...props,
105
99
  systemTopicName: scope.resourceNameFormatter.format(props.systemTopicName?.toString(), scope.props.resourceNameOptions?.eventGridSystemTopic),
106
100
  location: props.location ?? scope.props.location,
107
- resourceGroupName: resourceGroupName,
108
- tags: props.tags ?? {
101
+ resourceGroupName,
102
+ tags: {
109
103
  environment: scope.props.stage,
104
+ ...scope.props.defaultTags,
105
+ ...props.tags,
110
106
  },
111
107
  }, { parent: scope, ...resourceOptions });
112
108
  }
@@ -122,16 +118,12 @@ export class AzureEventgridManager {
122
118
  createEventgridSystemTopicEventSubscription(id, scope, props, systemTopic, resourceOptions) {
123
119
  if (!props)
124
120
  throw new Error(`Props undefined for ${id}`);
125
- const resourceGroupName = scope.props.resourceGroupName
126
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
127
- : props.resourceGroupName;
128
- if (!resourceGroupName)
129
- throw new Error(`Resource group name undefined for ${id}`);
121
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
130
122
  return new SystemTopicEventSubscription(`${id}-ests`, {
131
123
  ...props,
132
124
  eventSubscriptionName: scope.resourceNameFormatter.format(props.eventSubscriptionName?.toString(), scope.props.resourceNameOptions?.eventGridSystemTopicEventSubscription),
133
125
  systemTopicName: systemTopic.name,
134
- resourceGroupName: props.resourceGroupName ?? resourceGroupName,
126
+ resourceGroupName,
135
127
  }, { parent: scope, ...resourceOptions });
136
128
  }
137
129
  }
@@ -32,22 +32,20 @@ export class AzureFunctionManager {
32
32
  if (!props)
33
33
  throw new Error(`Props undefined for ${id}`);
34
34
  // Get resource group name
35
- const resourceGroupName = scope.props.resourceGroupName
36
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
37
- : props.resourceGroupName;
38
- if (!resourceGroupName)
39
- throw new Error(`Resource group name undefined for ${id}`);
35
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
40
36
  return new WebApp(`${id}-fa`, {
41
37
  ...props,
42
38
  name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxFunctionApp),
43
- resourceGroupName: resourceGroupName,
39
+ resourceGroupName,
44
40
  location: props.location ?? scope.props.location,
45
41
  kind: props.kind ?? 'functionapp,linux',
46
42
  identity: props.identity ?? {
47
43
  type: ManagedServiceIdentityType.SystemAssigned,
48
44
  },
49
- tags: props.tags ?? {
45
+ tags: {
50
46
  environment: scope.props.stage,
47
+ ...scope.props.defaultTags,
48
+ ...props.tags,
51
49
  },
52
50
  }, { parent: scope, ...resourceOptions });
53
51
  }
@@ -65,12 +63,10 @@ export class AzureFunctionManager {
65
63
  if (!props)
66
64
  throw new Error(`Props undefined for ${id}`);
67
65
  // Get resource group name
68
- const resourceGroupName = scope.props.resourceGroupName
69
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
70
- : '';
66
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
71
67
  return new WebAppFunction(`${id}-fc`, {
72
68
  name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionAppFunction),
73
- resourceGroupName: resourceGroupName,
69
+ resourceGroupName,
74
70
  functionAppId: props.functionAppId,
75
71
  config: props.configJson,
76
72
  isDisabled: props.enabled !== undefined ? !props.enabled : false,
@@ -89,16 +85,12 @@ export class AzureFunctionManager {
89
85
  if (!props)
90
86
  throw new Error(`Props undefined for ${id}`);
91
87
  // Get resource group name
92
- const resourceGroupName = scope.props.resourceGroupName
93
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
94
- : props.resourceGroupName;
95
- if (!resourceGroupName)
96
- throw new Error(`Resource group name undefined for ${id}`);
88
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
97
89
  const functionApp = new WebApp(`${id}-fc`, {
98
90
  ...props,
99
91
  name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
100
92
  location: props.location ?? scope.props.location,
101
- resourceGroupName: resourceGroupName,
93
+ resourceGroupName,
102
94
  kind: props.kind ?? 'functionapp,linux',
103
95
  httpsOnly: props.httpsOnly ?? true,
104
96
  identity: props.identity ?? {
@@ -120,13 +112,15 @@ export class AzureFunctionManager {
120
112
  http20Enabled: true,
121
113
  linuxFxVersion: `${props.runtime?.name ?? 'node'}|${props.runtime?.version ?? CommonAzureStack.NODEJS_RUNTIME}`,
122
114
  },
123
- tags: props.tags ?? {
115
+ tags: {
124
116
  environment: scope.props.stage,
117
+ ...scope.props.defaultTags,
118
+ ...props.tags,
125
119
  },
126
120
  }, { parent: scope, ...resourceOptions });
127
121
  const functionAppConfig = props.functionAppConfig;
128
122
  new Deployment(`${id}-deployment`, {
129
- resourceGroupName: resourceGroupName,
123
+ resourceGroupName,
130
124
  properties: {
131
125
  mode: DeploymentMode.Incremental,
132
126
  template: {
@@ -181,11 +175,7 @@ export class AzureFunctionManager {
181
175
  if (!props)
182
176
  throw new Error(`Props undefined for ${id}`);
183
177
  // Get resource group name
184
- const resourceGroupName = scope.props.resourceGroupName
185
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
186
- : props.resourceGroupName;
187
- if (!resourceGroupName)
188
- throw new Error(`Resource group name undefined for ${id}`);
178
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
189
179
  return new Resource(`${id}-fc`, {
190
180
  apiVersion: '2024-04-01',
191
181
  identity: {
@@ -215,7 +205,7 @@ export class AzureFunctionManager {
215
205
  },
216
206
  },
217
207
  },
218
- resourceGroupName: resourceGroupName,
208
+ resourceGroupName,
219
209
  resourceName: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
220
210
  resourceProviderNamespace: 'Microsoft.Web',
221
211
  resourceType: 'sites',
@@ -1,11 +1,11 @@
1
1
  import { input } from '@pulumi/azure-native/types/index.js';
2
- import { WebAppArgs } from '@pulumi/azure-native/web/index.js';
2
+ import { WebAppArgs, WebAppFunctionArgs } from '@pulumi/azure-native/web/index.js';
3
3
  /** @category Interface */
4
4
  export interface FunctionAppProps extends WebAppArgs {
5
5
  name?: string;
6
6
  }
7
7
  /** @category Interface */
8
- export interface FunctionProps {
8
+ export interface FunctionProps extends WebAppFunctionArgs {
9
9
  name: string;
10
10
  functionAppId: string;
11
11
  language?: string;
@@ -30,16 +30,12 @@ export class AzureKeyVaultManager {
30
30
  if (!props)
31
31
  throw new Error(`Props undefined for ${id}`);
32
32
  // Get resource group name
33
- const resourceGroupName = scope.props.resourceGroupName
34
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
- : props.resourceGroupName;
36
- if (!resourceGroupName)
37
- throw new Error(`Resource group name undefined for ${id}`);
33
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
38
34
  return new Vault(`${id}-kv`, {
39
35
  ...props,
40
36
  vaultName: scope.resourceNameFormatter.format(props.vaultName?.toString(), scope.props.resourceNameOptions?.keyVault),
41
37
  location: props.location ?? scope.props.location,
42
- resourceGroupName: resourceGroupName,
38
+ resourceGroupName,
43
39
  properties: {
44
40
  ...props.properties,
45
41
  sku: props.properties?.sku ?? {
@@ -52,8 +48,10 @@ export class AzureKeyVaultManager {
52
48
  softDeleteRetentionInDays: props.properties?.softDeleteRetentionInDays ?? 90,
53
49
  enablePurgeProtection: props.properties?.enablePurgeProtection ?? true,
54
50
  },
55
- tags: props.tags ?? {
51
+ tags: {
56
52
  environment: scope.props.stage,
53
+ ...scope.props.defaultTags,
54
+ ...props.tags,
57
55
  },
58
56
  }, { parent: scope, ...resourceOptions });
59
57
  }
@@ -30,22 +30,20 @@ export class AzureOperationalInsightsManager {
30
30
  if (!props)
31
31
  throw new Error(`Props undefined for ${id}`);
32
32
  // Get resource group name
33
- const resourceGroupName = scope.props.resourceGroupName
34
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
- : props.resourceGroupName;
36
- if (!resourceGroupName)
37
- throw new Error(`Resource group name undefined for ${id}`);
33
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
38
34
  return new Workspace(`${id}-lw`, {
39
35
  ...props,
40
36
  workspaceName: scope.resourceNameFormatter.format(props.workspaceName?.toString(), scope.props.resourceNameOptions?.logAnalyticsWorkspace),
41
37
  location: props.location ?? scope.props.location,
42
- resourceGroupName: resourceGroupName,
38
+ resourceGroupName,
43
39
  sku: props.sku ?? {
44
40
  name: WorkspaceSkuNameEnum.PerGB2018,
45
41
  },
46
42
  retentionInDays: props.retentionInDays ?? 30,
47
- tags: props.tags ?? {
43
+ tags: {
48
44
  environment: scope.props.stage,
45
+ ...scope.props.defaultTags,
46
+ ...props.tags,
49
47
  },
50
48
  }, { parent: scope, ...resourceOptions });
51
49
  }
@@ -31,16 +31,12 @@ export class AzureRedisManager {
31
31
  if (!clusterProps)
32
32
  throw new Error(`Props undefined for ${id}`);
33
33
  // Get resource group name
34
- const resourceGroupName = scope.props.resourceGroupName
35
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
36
- : clusterProps.resourceGroupName;
37
- if (!resourceGroupName)
38
- throw new Error(`Resource group name undefined for ${id}`);
34
+ const resourceGroupName = clusterProps.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
39
35
  const cluster = new RedisEnterprise(`${id}-rc`, {
40
36
  ...clusterProps,
41
37
  clusterName: scope.resourceNameFormatter.format(clusterProps.clusterName?.toString(), scope.props.resourceNameOptions?.managedRedis),
42
38
  location: clusterProps.location ?? scope.props.location,
43
- resourceGroupName: resourceGroupName,
39
+ resourceGroupName,
44
40
  sku: clusterProps.sku ?? {
45
41
  name: SkuName.Balanced_B0,
46
42
  },
@@ -51,7 +47,7 @@ export class AzureRedisManager {
51
47
  const database = new Database(`${id}-db`, {
52
48
  ...databaseProps,
53
49
  clusterName: cluster.name,
54
- resourceGroupName: resourceGroupName,
50
+ resourceGroupName,
55
51
  databaseName: databaseProps?.databaseName ?? 'default',
56
52
  }, { parent: scope, dependsOn: [cluster], ...resourceOptions });
57
53
  return { cluster, database };
@@ -33,8 +33,10 @@ export class AzureResourceGroupManager {
33
33
  ...props,
34
34
  resourceGroupName: scope.resourceNameFormatter.format(props.resourceGroupName?.toString(), scope.props.resourceNameOptions?.resourceGroup),
35
35
  location: props.location,
36
- tags: props.tags ?? {
36
+ tags: {
37
37
  environment: scope.props.stage,
38
+ ...scope.props.defaultTags,
39
+ ...props.tags,
38
40
  },
39
41
  }, { parent: scope, ...resourceOptions });
40
42
  }
@@ -30,15 +30,11 @@ export class AzureServiceBusManager {
30
30
  if (!props)
31
31
  throw new Error(`Props undefined for ${id}`);
32
32
  // Get resource group name
33
- const resourceGroupName = scope.props.resourceGroupName
34
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
- : props.resourceGroupName;
36
- if (!resourceGroupName)
37
- throw new Error(`Resource group name undefined for ${id}`);
33
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
38
34
  return new Namespace(`${id}-sn`, {
39
35
  ...props,
40
36
  namespaceName: scope.resourceNameFormatter.format(props.namespaceName?.toString(), scope.props.resourceNameOptions?.serviceBusNamespace),
41
- resourceGroupName: resourceGroupName,
37
+ resourceGroupName,
42
38
  location: props.location ?? scope.props.location,
43
39
  identity: props.identity ?? {
44
40
  type: ManagedServiceIdentityType.SystemAssigned,
@@ -46,8 +42,10 @@ export class AzureServiceBusManager {
46
42
  sku: props.sku ?? {
47
43
  name: SkuName.Standard,
48
44
  },
49
- tags: props.tags ?? {
45
+ tags: {
50
46
  environment: scope.props.stage,
47
+ ...scope.props.defaultTags,
48
+ ...props.tags,
51
49
  },
52
50
  }, { parent: scope, ...resourceOptions });
53
51
  }
@@ -65,8 +63,6 @@ export class AzureServiceBusManager {
65
63
  return new Topic(`${id}-st`, {
66
64
  ...props,
67
65
  topicName: scope.resourceNameFormatter.format(props.topicName?.toString(), scope.props.resourceNameOptions?.serviceBusTopic),
68
- namespaceName: props.namespaceName,
69
- resourceGroupName: props.resourceGroupName,
70
66
  }, { parent: scope, ...resourceOptions });
71
67
  }
72
68
  /**
@@ -83,8 +79,6 @@ export class AzureServiceBusManager {
83
79
  return new Queue(`${id}-sq`, {
84
80
  ...props,
85
81
  queueName: scope.resourceNameFormatter.format(props.queueName?.toString(), scope.props.resourceNameOptions?.serviceBusQueue),
86
- namespaceName: props.namespaceName,
87
- resourceGroupName: props.resourceGroupName,
88
82
  duplicateDetectionHistoryTimeWindow: props.duplicateDetectionHistoryTimeWindow ?? 'PT1M',
89
83
  requiresDuplicateDetection: props.requiresDuplicateDetection ?? true,
90
84
  deadLetteringOnMessageExpiration: props.deadLetteringOnMessageExpiration ?? true,
@@ -30,9 +30,7 @@ export class AzureStorageManager {
30
30
  createStorageAccount(id, scope, props, resourceOptions) {
31
31
  if (!props)
32
32
  throw new Error(`Props undefined for ${id}`);
33
- const resourceGroupName = scope.props.resourceGroupName
34
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
35
- : `${props.resourceGroupName}`;
33
+ const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
36
34
  const storageAccount = new StorageAccount(`${id}-sa`, {
37
35
  ...props,
38
36
  accountName: scope.resourceNameFormatter
@@ -46,8 +44,10 @@ export class AzureStorageManager {
46
44
  },
47
45
  kind: props.kind ?? Kind.StorageV2,
48
46
  location: props.location ?? scope.props.location,
49
- tags: props.tags ?? {
47
+ tags: {
50
48
  environment: scope.props.stage,
49
+ ...scope.props.defaultTags,
50
+ ...props.tags,
51
51
  },
52
52
  }, { parent: scope, ...resourceOptions });
53
53
  new BlobServiceProperties(`${id}-blob-props`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils-azure",
3
- "version": "2.15.0",
3
+ "version": "2.16.0",
4
4
  "description": "Azure Pulumi utilities for @gradientedge/cdk-utils",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",