@gradientedge/cdk-utils-azure 2.15.0 → 2.17.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.
- package/dist/src/common/construct.js +4 -3
- package/dist/src/common/stack.d.ts +3 -0
- package/dist/src/common/stack.js +27 -3
- package/dist/src/common/tagging.js +7 -0
- package/dist/src/services/api-management/main.js +8 -10
- package/dist/src/services/app-configuration/main.js +5 -7
- package/dist/src/services/app-service/main.js +10 -14
- package/dist/src/services/application-insights/main.js +5 -3
- package/dist/src/services/cosmosdb/main.js +11 -17
- package/dist/src/services/dns/main.js +5 -7
- package/dist/src/services/eventgrid/main.js +13 -21
- package/dist/src/services/function/main.js +15 -25
- package/dist/src/services/function/types.d.ts +2 -2
- package/dist/src/services/key-vault/main.js +5 -7
- package/dist/src/services/operational-insights/main.js +5 -7
- package/dist/src/services/redis/main.js +3 -7
- package/dist/src/services/resource-group/main.js +3 -1
- package/dist/src/services/servicebus/main.js +5 -11
- package/dist/src/services/storage/main.js +7 -13
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { isDevStage, isPrdStage, isTestStage, isUatStage } from '@gradientedge/cdk-utils-common';
|
|
1
2
|
import { getWorkspaceOutput } from '@pulumi/azure-native/operationalinsights/index.js';
|
|
2
3
|
import * as pulumi from '@pulumi/pulumi';
|
|
3
4
|
import { ComponentResource } from '@pulumi/pulumi';
|
|
4
|
-
import { isDevStage, isPrdStage, isTestStage, isUatStage } from '@gradientedge/cdk-utils-common';
|
|
5
5
|
import { AzureAuthorisationManager } from '../services/authorisation/main.js';
|
|
6
6
|
import { AzureApiManagementManager, AzureAppConfigurationManager, AzureApplicationInsightsManager, AzureAppServiceManager, AzureCosmosDbManager, AzureDnsManager, AzureEventgridManager, AzureFunctionManager, AzureKeyVaultManager, AzureMonitorManager, AzureOperationalInsightsManager, AzurePortalManager, AzureRedisManager, AzureResourceGroupManager, AzureSecurityCentermanager, AzureServiceBusManager, AzureStorageManager, } from '../services/index.js';
|
|
7
7
|
import { AzureResourceNameFormatter } from './resource-name-formatter.js';
|
|
@@ -76,7 +76,9 @@ export class CommonAzureConstruct extends ComponentResource {
|
|
|
76
76
|
resolveStack(stackName) {
|
|
77
77
|
if (!stackName)
|
|
78
78
|
throw new Error('Stack name undefined');
|
|
79
|
-
return new pulumi.StackReference(stackName
|
|
79
|
+
return new pulumi.StackReference(stackName, {
|
|
80
|
+
name: stackName,
|
|
81
|
+
});
|
|
80
82
|
}
|
|
81
83
|
createResourceGroup() {
|
|
82
84
|
if (this.resourceGroup)
|
|
@@ -85,7 +87,6 @@ export class CommonAzureConstruct extends ComponentResource {
|
|
|
85
87
|
resourceGroupName: this.props.resourceGroupName ?? this.id,
|
|
86
88
|
location: this.props.location,
|
|
87
89
|
});
|
|
88
|
-
this.props.resourceGroupName = this.resourceNameFormatter.format(this.props.resourceGroupName ?? this.id);
|
|
89
90
|
this.registerOutputs({
|
|
90
91
|
resourceGroupId: this.resourceGroup.id,
|
|
91
92
|
resourceGroupName: this.resourceGroup.name,
|
|
@@ -21,6 +21,7 @@ export declare class CommonAzureStack extends ComponentResource {
|
|
|
21
21
|
construct: CommonAzureConstruct;
|
|
22
22
|
props: CommonAzureStackProps;
|
|
23
23
|
config: Config;
|
|
24
|
+
outputs?: Record<string, unknown>;
|
|
24
25
|
constructor(name: string, props: CommonAzureStackProps, options?: ComponentResourceOptions);
|
|
25
26
|
/**
|
|
26
27
|
* @summary Method to determine the core construct properties injected via context
|
|
@@ -44,4 +45,6 @@ export declare class CommonAzureStack extends ComponentResource {
|
|
|
44
45
|
* @summary Determine the fully qualified domain name based on domainName & subDomain
|
|
45
46
|
*/
|
|
46
47
|
protected fullyQualifiedDomain(): string;
|
|
48
|
+
protected static determineEnvironmentProperty(): string;
|
|
49
|
+
protected static getEnvironmentProperty(property: string): any;
|
|
47
50
|
}
|
package/dist/src/common/stack.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
1
|
+
import fs, { readFileSync, statSync } from 'fs';
|
|
2
|
+
import path, { dirname, join } from 'path';
|
|
3
|
+
import { isDevStage } from '@gradientedge/cdk-utils-common';
|
|
3
4
|
import { ComponentResource, Config } from '@pulumi/pulumi';
|
|
4
5
|
import appRoot from 'app-root-path';
|
|
5
6
|
import _ from 'lodash';
|
|
6
|
-
import { isDevStage } from '@gradientedge/cdk-utils-common';
|
|
7
7
|
import { registerTagTransformation } from './tagging.js';
|
|
8
8
|
/**
|
|
9
9
|
* Common stack to use as a base for all higher level constructs using Pulumi
|
|
@@ -25,6 +25,7 @@ export class CommonAzureStack extends ComponentResource {
|
|
|
25
25
|
construct;
|
|
26
26
|
props;
|
|
27
27
|
config;
|
|
28
|
+
outputs;
|
|
28
29
|
constructor(name, props, options) {
|
|
29
30
|
super(`stack:${name}`, name, props, options);
|
|
30
31
|
/* initialise config */
|
|
@@ -118,4 +119,27 @@ export class CommonAzureStack extends ComponentResource {
|
|
|
118
119
|
const subDomain = this.props.subDomain;
|
|
119
120
|
return subDomain ? `${subDomain}.${domainName}` : domainName;
|
|
120
121
|
}
|
|
122
|
+
static determineEnvironmentProperty() {
|
|
123
|
+
const config = new Config();
|
|
124
|
+
const stageContextPath = config.get('stageContextPath');
|
|
125
|
+
let dir = process.cwd();
|
|
126
|
+
for (let i = 0; i < 6; i++) {
|
|
127
|
+
try {
|
|
128
|
+
if (statSync(join(dir, `${stageContextPath}`)).isDirectory())
|
|
129
|
+
return dir;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
/* keep walking */
|
|
133
|
+
}
|
|
134
|
+
dir = dirname(dir);
|
|
135
|
+
}
|
|
136
|
+
throw new Error('Could not locate infrastructure root (pulumi-env/ not found)');
|
|
137
|
+
}
|
|
138
|
+
static getEnvironmentProperty(property) {
|
|
139
|
+
const config = new Config();
|
|
140
|
+
const stage = config.get('stage');
|
|
141
|
+
const stageContextPath = config.get('stageContextPath');
|
|
142
|
+
const envConfig = JSON.parse(readFileSync(join(this.determineEnvironmentProperty(), `${stageContextPath}`, `${stage}.json`), 'utf8'));
|
|
143
|
+
return envConfig[property];
|
|
144
|
+
}
|
|
121
145
|
}
|
|
@@ -7,6 +7,13 @@ import { RESOURCES_TO_EXCLUDE_TAGS } from './constants.js';
|
|
|
7
7
|
*/
|
|
8
8
|
/** @category Constant */
|
|
9
9
|
export function isTaggableResource(resourceType) {
|
|
10
|
+
// Entire providers that don't support tags
|
|
11
|
+
if (resourceType.startsWith('azuread:'))
|
|
12
|
+
return false;
|
|
13
|
+
if (resourceType.startsWith('random:'))
|
|
14
|
+
return false;
|
|
15
|
+
if (resourceType.startsWith('pulumi:'))
|
|
16
|
+
return false;
|
|
10
17
|
// Extract the resource name from the type (e.g., 'ResourceGroup' from 'azure-native:resources:ResourceGroup')
|
|
11
18
|
const resourceName = resourceType.split(':').pop() || '';
|
|
12
19
|
// Check if this resource is in the exclusion list
|
|
@@ -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
|
|
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:
|
|
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
|
|
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
|
|
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()
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
41
|
+
resourceGroupName,
|
|
42
42
|
applicationType: props.applicationType ?? ApplicationType.Web,
|
|
43
43
|
kind: props.kind ?? 'web',
|
|
44
|
-
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
|
|
44
|
-
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
37
|
+
resourceGroupName,
|
|
42
38
|
location: 'global', // DNS zones are always global
|
|
43
|
-
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
|
|
43
|
-
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
|
|
108
|
-
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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
38
|
+
resourceGroupName,
|
|
43
39
|
sku: props.sku ?? {
|
|
44
40
|
name: WorkspaceSkuNameEnum.PerGB2018,
|
|
45
41
|
},
|
|
46
42
|
retentionInDays: props.retentionInDays ?? 30,
|
|
47
|
-
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
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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:
|
|
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`, {
|
|
@@ -75,9 +75,7 @@ export class AzureStorageManager {
|
|
|
75
75
|
createStorageContainer(id, scope, props, resourceOptions) {
|
|
76
76
|
if (!props)
|
|
77
77
|
throw new Error(`Props undefined for ${id}`);
|
|
78
|
-
const resourceGroupName = scope.props.resourceGroupName
|
|
79
|
-
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
80
|
-
: `${props.resourceGroupName}`;
|
|
78
|
+
const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
|
|
81
79
|
return new BlobContainer(`${id}-sc`, {
|
|
82
80
|
...props,
|
|
83
81
|
containerName: scope.resourceNameFormatter.format(props.containerName?.toString(), scope.props.resourceNameOptions?.storageContainer),
|
|
@@ -97,9 +95,7 @@ export class AzureStorageManager {
|
|
|
97
95
|
createStorageBlob(id, scope, props, resourceOptions) {
|
|
98
96
|
if (!props)
|
|
99
97
|
throw new Error(`Props undefined for ${id}`);
|
|
100
|
-
const resourceGroupName = scope.props.resourceGroupName
|
|
101
|
-
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
102
|
-
: `${props.resourceGroupName}`;
|
|
98
|
+
const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
|
|
103
99
|
return new Blob(`${id}-sb`, {
|
|
104
100
|
...props,
|
|
105
101
|
blobName: scope.resourceNameFormatter.format(props.blobName?.toString(), scope.props.resourceNameOptions?.storageBlob),
|
|
@@ -126,9 +122,7 @@ export class AzureStorageManager {
|
|
|
126
122
|
* @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
|
|
127
123
|
*/
|
|
128
124
|
generateContainerSasToken(id, scope, props, storageAccount) {
|
|
129
|
-
const resourceGroupName = scope.props.resourceGroupName
|
|
130
|
-
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
131
|
-
: `${props.resourceGroupName}`;
|
|
125
|
+
const resourceGroupName = props.resourceGroupName ?? scope.resourceNameFormatter.format(scope.props.resourceGroupName);
|
|
132
126
|
return pulumi
|
|
133
127
|
.all([storageAccount.name])
|
|
134
128
|
.apply(([accountName]) => {
|