@gradientedge/cdk-utils 9.43.1 → 9.43.3
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/lib/azure/common/stack.d.ts +5 -0
- package/dist/src/lib/azure/common/stack.js +5 -0
- package/dist/src/lib/azure/services/api-management/main.d.ts +10 -1
- package/dist/src/lib/azure/services/api-management/main.js +24 -8
- package/dist/src/lib/azure/services/api-management/types.d.ts +3 -0
- package/dist/src/lib/azure/services/app-configuration/main.js +1 -1
- package/dist/src/lib/azure/services/app-service/main.js +1 -1
- package/dist/src/lib/azure/services/application-insights/main.js +1 -1
- package/dist/src/lib/azure/services/cosmosdb/main.js +3 -3
- package/dist/src/lib/azure/services/dns/main.js +1 -3
- package/dist/src/lib/azure/services/eventgrid/main.js +3 -3
- package/dist/src/lib/azure/services/function/main.js +3 -3
- package/dist/src/lib/azure/services/key-vault/main.js +1 -1
- package/dist/src/lib/azure/services/log-analytics-workspace/main.js +1 -1
- package/dist/src/lib/azure/services/resource-group/main.js +1 -1
- package/dist/src/lib/azure/services/servicebus/main.js +4 -4
- package/dist/src/lib/azure/services/storage/main.js +6 -3
- package/dist/src/lib/cloudflare/common/constants.d.ts +2 -1
- package/dist/src/lib/cloudflare/common/constants.js +1 -0
- package/dist/src/lib/cloudflare/common/construct.js +9 -0
- package/dist/src/lib/cloudflare/common/types.d.ts +4 -0
- package/package.json +1 -1
- package/src/lib/azure/common/stack.ts +5 -0
- package/src/lib/azure/services/api-management/main.ts +42 -10
- package/src/lib/azure/services/api-management/types.ts +3 -0
- package/src/lib/azure/services/app-configuration/main.ts +1 -1
- package/src/lib/azure/services/app-service/main.ts +1 -1
- package/src/lib/azure/services/application-insights/main.ts +1 -1
- package/src/lib/azure/services/cosmosdb/main.ts +3 -3
- package/src/lib/azure/services/dns/main.ts +1 -3
- package/src/lib/azure/services/eventgrid/main.ts +3 -3
- package/src/lib/azure/services/function/main.ts +3 -3
- package/src/lib/azure/services/key-vault/main.ts +1 -1
- package/src/lib/azure/services/log-analytics-workspace/main.ts +1 -1
- package/src/lib/azure/services/resource-group/main.ts +1 -1
- package/src/lib/azure/services/servicebus/main.ts +4 -4
- package/src/lib/azure/services/storage/main.ts +6 -3
- package/src/lib/cloudflare/common/constants.ts +1 -0
- package/src/lib/cloudflare/common/construct.ts +10 -1
- package/src/lib/cloudflare/common/types.ts +4 -0
|
@@ -30,6 +30,11 @@ export declare class CommonAzureStack extends TerraformStack {
|
|
|
30
30
|
location: any;
|
|
31
31
|
name: any;
|
|
32
32
|
resourceGroupName: any;
|
|
33
|
+
globalPrefix: any;
|
|
34
|
+
globalSuffix: any;
|
|
35
|
+
resourceNameOptions: any;
|
|
36
|
+
resourcePrefix: any;
|
|
37
|
+
resourceSuffix: any;
|
|
33
38
|
skipStageForARecords: any;
|
|
34
39
|
stage: any;
|
|
35
40
|
subDomain: any;
|
|
@@ -46,6 +46,11 @@ class CommonAzureStack extends cdktf_1.TerraformStack {
|
|
|
46
46
|
location: this.node.tryGetContext('location'),
|
|
47
47
|
name: this.node.tryGetContext('resourceGroupName'),
|
|
48
48
|
resourceGroupName: this.node.tryGetContext('resourceGroupName'),
|
|
49
|
+
globalPrefix: this.node.tryGetContext('globalPrefix'),
|
|
50
|
+
globalSuffix: this.node.tryGetContext('globalSuffix'),
|
|
51
|
+
resourceNameOptions: this.node.tryGetContext('resourceNameOptions'),
|
|
52
|
+
resourcePrefix: this.node.tryGetContext('resourcePrefix'),
|
|
53
|
+
resourceSuffix: this.node.tryGetContext('resourceSuffix'),
|
|
49
54
|
skipStageForARecords: this.node.tryGetContext('skipStageForARecords'),
|
|
50
55
|
stage: this.node.tryGetContext('stage'),
|
|
51
56
|
subDomain: this.node.tryGetContext('subDomain'),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { DataAzurermApiManagement, DataAzurermApiManagementConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-api-management';
|
|
2
|
+
import { ApiManagementCustomDomain } from '@cdktf/provider-azurerm/lib/api-management-custom-domain';
|
|
2
3
|
import { ApiManagementBackend } from '@cdktf/provider-azurerm/lib/api-management-backend';
|
|
3
4
|
import { ApiManagement } from '@cdktf/provider-azurerm/lib/api-management';
|
|
4
5
|
import { ApiManagementApi } from '@cdktf/provider-azurerm/lib/api-management-api';
|
|
5
6
|
import { ApiManagementLoggerApplicationInsights } from '@cdktf/provider-azurerm/lib/api-management-logger';
|
|
6
7
|
import { Resource } from '../../.gen/providers/azapi/resource';
|
|
7
8
|
import { CommonAzureConstruct } from '../../common';
|
|
8
|
-
import { ApiManagementProps, ApiManagementBackendProps, ApiManagementApiProps, ApiManagementV2Props } from './types';
|
|
9
|
+
import { ApiManagementProps, ApiManagementBackendProps, ApiManagementApiProps, ApiManagementV2Props, ApiManagementCustomDomainProps } from './types';
|
|
9
10
|
/**
|
|
10
11
|
* @classdesc Provides operations on Azure Api Management
|
|
11
12
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
@@ -64,4 +65,12 @@ export declare class AzureApiManagementManager {
|
|
|
64
65
|
* @see [CDKTF Api management Api Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/ApiManagementApi.typescript.md}
|
|
65
66
|
*/
|
|
66
67
|
createApiManagementApi(id: string, scope: CommonAzureConstruct, props: ApiManagementApiProps): ApiManagementApi;
|
|
68
|
+
/**
|
|
69
|
+
* @summary Method to create a new api management custom domain
|
|
70
|
+
* @param id scoped id of the resource
|
|
71
|
+
* @param scope scope in which this resource is defined
|
|
72
|
+
* @param props api management custom domain properties
|
|
73
|
+
* @see [CDKTF Api management Custom Domain Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/createApiManagementCustomDomain.typescript.md}
|
|
74
|
+
*/
|
|
75
|
+
createApiManagementCustomDomain(id: string, scope: CommonAzureConstruct, props: ApiManagementCustomDomainProps): ApiManagementCustomDomain;
|
|
67
76
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.AzureApiManagementManager = void 0;
|
|
7
7
|
const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-resource-group");
|
|
8
8
|
const data_azurerm_api_management_1 = require("@cdktf/provider-azurerm/lib/data-azurerm-api-management");
|
|
9
|
+
const api_management_custom_domain_1 = require("@cdktf/provider-azurerm/lib/api-management-custom-domain");
|
|
9
10
|
const api_management_backend_1 = require("@cdktf/provider-azurerm/lib/api-management-backend");
|
|
10
11
|
const api_management_1 = require("@cdktf/provider-azurerm/lib/api-management");
|
|
11
12
|
const api_management_api_1 = require("@cdktf/provider-azurerm/lib/api-management-api");
|
|
@@ -52,7 +53,7 @@ class AzureApiManagementManager {
|
|
|
52
53
|
throw `Resource group undefined for ${id}`;
|
|
53
54
|
const apiManagement = new api_management_1.ApiManagement(scope, `${id}-am`, {
|
|
54
55
|
...props,
|
|
55
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
56
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagement),
|
|
56
57
|
resourceGroupName: resourceGroup.name,
|
|
57
58
|
tags: props.tags ?? {
|
|
58
59
|
environment: scope.props.stage,
|
|
@@ -60,7 +61,7 @@ class AzureApiManagementManager {
|
|
|
60
61
|
});
|
|
61
62
|
if (applicationInsightsKey) {
|
|
62
63
|
new api_management_logger_1.ApiManagementLogger(scope, `${id}-am-logger`, {
|
|
63
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
64
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementLogger),
|
|
64
65
|
resourceGroupName: resourceGroup.name,
|
|
65
66
|
apiManagementName: apiManagement.name,
|
|
66
67
|
applicationInsights: {
|
|
@@ -92,7 +93,7 @@ class AzureApiManagementManager {
|
|
|
92
93
|
throw `Resource group undefined for ${id}`;
|
|
93
94
|
const apiManagement = new data_azurerm_api_management_1.DataAzurermApiManagement(scope, `${id}-am`, {
|
|
94
95
|
...props,
|
|
95
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
96
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.dataAzurermApiManagement),
|
|
96
97
|
resourceGroupName: scope.props.resourceGroupName
|
|
97
98
|
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
98
99
|
: `${props.resourceGroupName}`,
|
|
@@ -118,7 +119,7 @@ class AzureApiManagementManager {
|
|
|
118
119
|
throw `Resource group undefined for ${id}`;
|
|
119
120
|
const apiManagement = new resource_1.Resource(scope, `${id}-am`, {
|
|
120
121
|
type: 'Microsoft.ApiManagement/service@2024-05-01',
|
|
121
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
122
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagement),
|
|
122
123
|
location: resourceGroup.location,
|
|
123
124
|
parentId: resourceGroup.id,
|
|
124
125
|
body: {
|
|
@@ -134,7 +135,7 @@ class AzureApiManagementManager {
|
|
|
134
135
|
name: props.skuName,
|
|
135
136
|
},
|
|
136
137
|
},
|
|
137
|
-
responseExportValues: ['
|
|
138
|
+
responseExportValues: ['*'],
|
|
138
139
|
identity: [
|
|
139
140
|
{
|
|
140
141
|
type: 'SystemAssigned',
|
|
@@ -146,7 +147,7 @@ class AzureApiManagementManager {
|
|
|
146
147
|
});
|
|
147
148
|
if (applicationInsightsKey) {
|
|
148
149
|
new api_management_logger_1.ApiManagementLogger(scope, `${id}-am-logger`, {
|
|
149
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
150
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementLogger),
|
|
150
151
|
resourceGroupName: resourceGroup.name,
|
|
151
152
|
apiManagementName: apiManagement.name,
|
|
152
153
|
applicationInsights: {
|
|
@@ -171,7 +172,7 @@ class AzureApiManagementManager {
|
|
|
171
172
|
throw `Props undefined for ${id}`;
|
|
172
173
|
const apiManagementBackend = new api_management_backend_1.ApiManagementBackend(scope, `${id}-am-be`, {
|
|
173
174
|
...props,
|
|
174
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
175
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
|
|
175
176
|
description: props.description || `Backend for ${props.name}-${scope.props.stage}`,
|
|
176
177
|
protocol: props.protocol || 'http',
|
|
177
178
|
});
|
|
@@ -192,7 +193,7 @@ class AzureApiManagementManager {
|
|
|
192
193
|
throw `Props undefined for ${id}`;
|
|
193
194
|
const apiManagementApi = new api_management_api_1.ApiManagementApi(scope, `${id}-am-api`, {
|
|
194
195
|
...props,
|
|
195
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
196
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementApi),
|
|
196
197
|
displayName: props.displayName || props.name,
|
|
197
198
|
revision: props.revision || '1',
|
|
198
199
|
protocols: props.protocols || ['https'],
|
|
@@ -228,5 +229,20 @@ class AzureApiManagementManager {
|
|
|
228
229
|
});
|
|
229
230
|
return apiManagementApi;
|
|
230
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* @summary Method to create a new api management custom domain
|
|
234
|
+
* @param id scoped id of the resource
|
|
235
|
+
* @param scope scope in which this resource is defined
|
|
236
|
+
* @param props api management custom domain properties
|
|
237
|
+
* @see [CDKTF Api management Custom Domain Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/createApiManagementCustomDomain.typescript.md}
|
|
238
|
+
*/
|
|
239
|
+
createApiManagementCustomDomain(id, scope, props) {
|
|
240
|
+
if (!props)
|
|
241
|
+
throw `Props undefined for ${id}`;
|
|
242
|
+
const apiManagementCustomDomain = new api_management_custom_domain_1.ApiManagementCustomDomain(scope, `${id}-am-cd`, props);
|
|
243
|
+
(0, utils_1.createAzureTfOutput)(`${id}-apiManagementCustomDomainFriendlyUniqueId`, scope, apiManagementCustomDomain.friendlyUniqueId);
|
|
244
|
+
(0, utils_1.createAzureTfOutput)(`${id}-apiManagementCustomDomainId`, scope, apiManagementCustomDomain.id);
|
|
245
|
+
return apiManagementCustomDomain;
|
|
246
|
+
}
|
|
231
247
|
}
|
|
232
248
|
exports.AzureApiManagementManager = AzureApiManagementManager;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiManagementConfig } from '@cdktf/provider-azurerm/lib/api-management';
|
|
2
2
|
import { ApiManagementBackendConfig } from '@cdktf/provider-azurerm/lib/api-management-backend';
|
|
3
|
+
import { ApiManagementCustomDomainConfig } from '@cdktf/provider-azurerm/lib/api-management-custom-domain';
|
|
3
4
|
import { ApiManagementApiConfig } from '@cdktf/provider-azurerm/lib/api-management-api';
|
|
4
5
|
import { ApiManagementApiOperationConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation';
|
|
5
6
|
import { ApiManagementApiOperationPolicyConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation-policy';
|
|
@@ -8,6 +9,8 @@ export interface ApiManagementProps extends ApiManagementConfig {
|
|
|
8
9
|
export interface ApiManagementBackendProps extends ApiManagementBackendConfig {
|
|
9
10
|
backendUrlPath?: string;
|
|
10
11
|
}
|
|
12
|
+
export interface ApiManagementCustomDomainProps extends ApiManagementCustomDomainConfig {
|
|
13
|
+
}
|
|
11
14
|
export interface ApiManagementApiProps extends ApiManagementApiConfig {
|
|
12
15
|
operations: ApiManagementApiOperationConfig[];
|
|
13
16
|
policyXmlContent?: ApiManagementApiOperationPolicyConfig['xmlContent'];
|
|
@@ -41,7 +41,7 @@ class AzureAppConfigurationManager {
|
|
|
41
41
|
throw `Resource group undefined for ${id}`;
|
|
42
42
|
const appConfiguration = new app_configuration_1.AppConfiguration(scope, `${id}-ac`, {
|
|
43
43
|
...props,
|
|
44
|
-
name:
|
|
44
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.appConfiguration),
|
|
45
45
|
resourceGroupName: resourceGroup.name,
|
|
46
46
|
tags: props.tags ?? {
|
|
47
47
|
environment: scope.props.stage,
|
|
@@ -41,7 +41,7 @@ class AzureAppServiceManager {
|
|
|
41
41
|
throw `Resource group undefined for ${id}`;
|
|
42
42
|
const appServicePlan = new service_plan_1.ServicePlan(scope, `${id}-as`, {
|
|
43
43
|
...props,
|
|
44
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
44
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.appServicePlan),
|
|
45
45
|
resourceGroupName: resourceGroup.name,
|
|
46
46
|
tags: props.tags ?? {
|
|
47
47
|
environment: scope.props.stage,
|
|
@@ -41,7 +41,7 @@ class AzureApplicationInsightsManager {
|
|
|
41
41
|
throw `Resource group undefined for ${id}`;
|
|
42
42
|
const applicationInsights = new application_insights_1.ApplicationInsights(scope, `${id}-ai`, {
|
|
43
43
|
...props,
|
|
44
|
-
name:
|
|
44
|
+
name: scope.resourceNameFormatter.format(props.name ?? '', scope.props.resourceNameOptions?.applicationInsights),
|
|
45
45
|
resourceGroupName: resourceGroup.name,
|
|
46
46
|
applicationType: props.applicationType || 'web',
|
|
47
47
|
tags: props.tags ?? {
|
|
@@ -43,7 +43,7 @@ class AzureCosmosDbManager {
|
|
|
43
43
|
throw `Resource group undefined for ${id}`;
|
|
44
44
|
const cosmosdbAccount = new cosmosdb_account_1.CosmosdbAccount(scope, `${id}-ca`, {
|
|
45
45
|
...props,
|
|
46
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
46
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.cosmosDbAccount),
|
|
47
47
|
location: resourceGroup.location,
|
|
48
48
|
resourceGroupName: resourceGroup.name,
|
|
49
49
|
tags: props.tags ?? {
|
|
@@ -74,7 +74,7 @@ class AzureCosmosDbManager {
|
|
|
74
74
|
throw `Resource group undefined for ${id}`;
|
|
75
75
|
const cosmosdbDatatbase = new cosmosdb_sql_database_1.CosmosdbSqlDatabase(scope, `${id}-cd`, {
|
|
76
76
|
...props,
|
|
77
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
77
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.cosmosDbSqlDatabase),
|
|
78
78
|
resourceGroupName: resourceGroup.name,
|
|
79
79
|
});
|
|
80
80
|
(0, utils_1.createAzureTfOutput)(`${id}-cosmosdbDatatbasetName`, scope, cosmosdbDatatbase.name);
|
|
@@ -101,7 +101,7 @@ class AzureCosmosDbManager {
|
|
|
101
101
|
throw `Resource group undefined for ${id}`;
|
|
102
102
|
const cosmosdbContainer = new cosmosdb_sql_container_1.CosmosdbSqlContainer(scope, `${id}-cc`, {
|
|
103
103
|
...props,
|
|
104
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
104
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.cosmosDbSqlContainer),
|
|
105
105
|
resourceGroupName: resourceGroup.name,
|
|
106
106
|
});
|
|
107
107
|
(0, utils_1.createAzureTfOutput)(`${id}-cosmosdbContainertName`, scope, cosmosdbContainer.name);
|
|
@@ -44,7 +44,7 @@ class AzureDnsManager {
|
|
|
44
44
|
throw `Resource group undefined for ${id}`;
|
|
45
45
|
const dnsZone = new dns_zone_1.DnsZone(scope, `${id}-dz`, {
|
|
46
46
|
...props,
|
|
47
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
47
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.dnsZone),
|
|
48
48
|
resourceGroupName: resourceGroup.name,
|
|
49
49
|
tags: props.tags ?? {
|
|
50
50
|
environment: scope.props.stage,
|
|
@@ -67,7 +67,6 @@ class AzureDnsManager {
|
|
|
67
67
|
throw `Props undefined for ${id}`;
|
|
68
68
|
const dnsARecord = new dns_a_record_1.DnsARecord(scope, `${id}-da`, {
|
|
69
69
|
...props,
|
|
70
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
71
70
|
ttl: props.ttl || 300,
|
|
72
71
|
tags: props.tags ?? {
|
|
73
72
|
environment: scope.props.stage,
|
|
@@ -90,7 +89,6 @@ class AzureDnsManager {
|
|
|
90
89
|
throw `Props undefined for ${id}`;
|
|
91
90
|
const dnsCnameRecord = new dns_cname_record_1.DnsCnameRecord(scope, `${id}-dc`, {
|
|
92
91
|
...props,
|
|
93
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
94
92
|
ttl: props.ttl || 300,
|
|
95
93
|
tags: props.tags ?? {
|
|
96
94
|
environment: scope.props.stage,
|
|
@@ -43,7 +43,7 @@ class AzureEventgridManager {
|
|
|
43
43
|
throw `Resource group undefined for ${id}`;
|
|
44
44
|
const eventgridTopic = new eventgrid_topic_1.EventgridTopic(scope, `${id}-et`, {
|
|
45
45
|
...props,
|
|
46
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
46
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridTopic),
|
|
47
47
|
location: resourceGroup.location,
|
|
48
48
|
resourceGroupName: resourceGroup.name,
|
|
49
49
|
tags: props.tags ?? {
|
|
@@ -75,7 +75,7 @@ class AzureEventgridManager {
|
|
|
75
75
|
throw `Resource group undefined for ${id}`;
|
|
76
76
|
const eventgridTopic = new data_azurerm_eventgrid_topic_1.DataAzurermEventgridTopic(scope, `${id}-et`, {
|
|
77
77
|
...props,
|
|
78
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
78
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridTopic),
|
|
79
79
|
resourceGroupName: resourceGroup.name,
|
|
80
80
|
});
|
|
81
81
|
(0, utils_1.createAzureTfOutput)(`${id}-eventgridTopicName`, scope, eventgridTopic.name);
|
|
@@ -96,7 +96,7 @@ class AzureEventgridManager {
|
|
|
96
96
|
throw `Props undefined for ${id}`;
|
|
97
97
|
const eventgridSubscription = new eventgrid_event_subscription_1.EventgridEventSubscription(scope, `${id}-es`, {
|
|
98
98
|
...props,
|
|
99
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
99
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridEventSubscription),
|
|
100
100
|
eventDeliverySchema: props.eventDeliverySchema || 'CloudEventSchemaV1_0',
|
|
101
101
|
advancedFilteringOnArraysEnabled: props.advancedFilteringOnArraysEnabled || true,
|
|
102
102
|
});
|
|
@@ -44,7 +44,7 @@ class AzureFunctionManager {
|
|
|
44
44
|
throw `Resource group undefined for ${id}`;
|
|
45
45
|
const functionApp = new linux_function_app_1.LinuxFunctionApp(scope, `${id}-fa`, {
|
|
46
46
|
...props,
|
|
47
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
47
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxFunctionApp),
|
|
48
48
|
resourceGroupName: resourceGroup.name,
|
|
49
49
|
tags: props.tags ?? {
|
|
50
50
|
environment: scope.props.stage,
|
|
@@ -67,7 +67,7 @@ class AzureFunctionManager {
|
|
|
67
67
|
throw `Props undefined for ${id}`;
|
|
68
68
|
const functionAppFunction = new function_app_function_1.FunctionAppFunction(scope, `${id}-fc`, {
|
|
69
69
|
...props,
|
|
70
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
70
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionAppFunction),
|
|
71
71
|
configJson: JSON.stringify(props.configJson || {}),
|
|
72
72
|
});
|
|
73
73
|
(0, utils_1.createAzureTfOutput)(`${id}-functionName`, scope, functionAppFunction.name);
|
|
@@ -93,7 +93,7 @@ class AzureFunctionManager {
|
|
|
93
93
|
throw `Resource group undefined for ${id}`;
|
|
94
94
|
const functionApp = new resource_1.Resource(scope, `${id}-fa`, {
|
|
95
95
|
type: 'Microsoft.Web/sites@2024-04-01',
|
|
96
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
96
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
|
|
97
97
|
location: resourceGroup.location,
|
|
98
98
|
parentId: resourceGroup.id,
|
|
99
99
|
body: {
|
|
@@ -41,7 +41,7 @@ class AzureKeyVaultManager {
|
|
|
41
41
|
throw `Resource group undefined for ${id}`;
|
|
42
42
|
const keyVault = new key_vault_1.KeyVault(scope, `${id}-kv`, {
|
|
43
43
|
...props,
|
|
44
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
44
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.keyVault),
|
|
45
45
|
location: resourceGroup.location,
|
|
46
46
|
resourceGroupName: resourceGroup.name,
|
|
47
47
|
skuName: props.skuName ?? 'standard',
|
|
@@ -41,7 +41,7 @@ class AzureLogAnalyticsWorkspaceManager {
|
|
|
41
41
|
throw `Resource group undefined for ${id}`;
|
|
42
42
|
const logAnalyticsWorkspace = new log_analytics_workspace_1.LogAnalyticsWorkspace(scope, `${id}-lw`, {
|
|
43
43
|
...props,
|
|
44
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
44
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.logAnalyticsWorkspace),
|
|
45
45
|
location: resourceGroup.location,
|
|
46
46
|
resourceGroupName: resourceGroup.name,
|
|
47
47
|
tags: props.tags ?? {
|
|
@@ -33,7 +33,7 @@ class AzureResourceGroupManager {
|
|
|
33
33
|
throw `Props undefined for ${id}`;
|
|
34
34
|
const resourceGroup = new resource_group_1.ResourceGroup(scope, `${id}-rg`, {
|
|
35
35
|
...props,
|
|
36
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
36
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.resourceGroup),
|
|
37
37
|
location: props.location,
|
|
38
38
|
tags: props.tags ?? {
|
|
39
39
|
environment: scope.props.stage,
|
|
@@ -44,7 +44,7 @@ class AzureServicebusManager {
|
|
|
44
44
|
throw `Resource group undefined for ${id}`;
|
|
45
45
|
const servicebusNamespace = new servicebus_namespace_1.ServicebusNamespace(scope, `${id}-sn`, {
|
|
46
46
|
...props,
|
|
47
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
47
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusNamespace),
|
|
48
48
|
resourceGroupName: resourceGroup.name,
|
|
49
49
|
location: resourceGroup.location,
|
|
50
50
|
identity: {
|
|
@@ -72,7 +72,7 @@ class AzureServicebusManager {
|
|
|
72
72
|
throw `Props undefined for ${id}`;
|
|
73
73
|
const servicebusTopic = new servicebus_topic_1.ServicebusTopic(scope, `${id}-st`, {
|
|
74
74
|
...props,
|
|
75
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
75
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusTopic),
|
|
76
76
|
namespaceId: props.namespaceId,
|
|
77
77
|
});
|
|
78
78
|
(0, utils_1.createAzureTfOutput)(`${id}-servicebusTopicName`, scope, servicebusTopic.name);
|
|
@@ -92,7 +92,7 @@ class AzureServicebusManager {
|
|
|
92
92
|
throw `Props undefined for ${id}`;
|
|
93
93
|
const servicebusQueue = new servicebus_queue_1.ServicebusQueue(scope, `${id}-sq`, {
|
|
94
94
|
...props,
|
|
95
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
95
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusQueue),
|
|
96
96
|
namespaceId: props.namespaceId,
|
|
97
97
|
});
|
|
98
98
|
(0, utils_1.createAzureTfOutput)(`${id}-servicebusQueueName`, scope, servicebusQueue.name);
|
|
@@ -112,7 +112,7 @@ class AzureServicebusManager {
|
|
|
112
112
|
throw `Props undefined for ${id}`;
|
|
113
113
|
const servicebusSubscription = new servicebus_subscription_1.ServicebusSubscription(scope, `${id}-ss`, {
|
|
114
114
|
...props,
|
|
115
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
115
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusSubscription),
|
|
116
116
|
maxDeliveryCount: props.maxDeliveryCount || 1,
|
|
117
117
|
});
|
|
118
118
|
(0, utils_1.createAzureTfOutput)(`${id}-servicebusSubscriptionName`, scope, servicebusSubscription.name);
|
|
@@ -47,7 +47,10 @@ class AzureStorageManager {
|
|
|
47
47
|
...props,
|
|
48
48
|
accountTier: props.accountTier ?? 'Standard',
|
|
49
49
|
location: props.location ?? resourceGroup.location,
|
|
50
|
-
name:
|
|
50
|
+
name: scope.resourceNameFormatter
|
|
51
|
+
.format(props.name, scope.props.resourceNameOptions?.storageAccount)
|
|
52
|
+
.replace(/\W/g, '')
|
|
53
|
+
.toLowerCase(),
|
|
51
54
|
resourceGroupName: resourceGroup.name,
|
|
52
55
|
tags: props.tags ?? {
|
|
53
56
|
environment: scope.props.stage,
|
|
@@ -70,7 +73,7 @@ class AzureStorageManager {
|
|
|
70
73
|
throw `Props undefined for ${id}`;
|
|
71
74
|
const storageContainer = new storage_container_1.StorageContainer(scope, `${id}-sc`, {
|
|
72
75
|
...props,
|
|
73
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
76
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageContainer),
|
|
74
77
|
});
|
|
75
78
|
(0, utils_1.createAzureTfOutput)(`${id}-storageContainerName`, scope, storageContainer.name);
|
|
76
79
|
(0, utils_1.createAzureTfOutput)(`${id}-storageContainerFriendlyUniqueId`, scope, storageContainer.friendlyUniqueId);
|
|
@@ -105,7 +108,7 @@ class AzureStorageManager {
|
|
|
105
108
|
});
|
|
106
109
|
const storageBlob = new storage_blob_1.StorageBlob(scope, `${id}-sb`, {
|
|
107
110
|
...props,
|
|
108
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
111
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageBlob),
|
|
109
112
|
storageAccountName: storageAccount.name,
|
|
110
113
|
storageContainerName: storageContainer.name,
|
|
111
114
|
});
|
|
@@ -78,6 +78,15 @@ class CommonCloudflareConstruct extends cdktf_1.TerraformStack {
|
|
|
78
78
|
region: this.props.remoteBackend.region,
|
|
79
79
|
});
|
|
80
80
|
break;
|
|
81
|
+
case constants_1.RemoteBackend.azurerm:
|
|
82
|
+
new cdktf_1.AzurermBackend(this, {
|
|
83
|
+
storageAccountName: this.props.remoteBackend.storageAccountName,
|
|
84
|
+
containerName: this.props.remoteBackend.containerName,
|
|
85
|
+
key: `${this.id}`,
|
|
86
|
+
subscriptionId: this.props.remoteBackend.subscriptionId,
|
|
87
|
+
resourceGroupName: this.props.remoteBackend.resourceGroupName,
|
|
88
|
+
});
|
|
89
|
+
break;
|
|
81
90
|
case constants_1.RemoteBackend.local:
|
|
82
91
|
if (debug)
|
|
83
92
|
console.debug(`Using local backend for ${this.id}`);
|
package/package.json
CHANGED
|
@@ -50,6 +50,11 @@ export class CommonAzureStack extends TerraformStack {
|
|
|
50
50
|
location: this.node.tryGetContext('location'),
|
|
51
51
|
name: this.node.tryGetContext('resourceGroupName'),
|
|
52
52
|
resourceGroupName: this.node.tryGetContext('resourceGroupName'),
|
|
53
|
+
globalPrefix: this.node.tryGetContext('globalPrefix'),
|
|
54
|
+
globalSuffix: this.node.tryGetContext('globalSuffix'),
|
|
55
|
+
resourceNameOptions: this.node.tryGetContext('resourceNameOptions'),
|
|
56
|
+
resourcePrefix: this.node.tryGetContext('resourcePrefix'),
|
|
57
|
+
resourceSuffix: this.node.tryGetContext('resourceSuffix'),
|
|
53
58
|
skipStageForARecords: this.node.tryGetContext('skipStageForARecords'),
|
|
54
59
|
stage: this.node.tryGetContext('stage'),
|
|
55
60
|
subDomain: this.node.tryGetContext('subDomain'),
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DataAzurermApiManagement,
|
|
4
4
|
DataAzurermApiManagementConfig,
|
|
5
5
|
} from '@cdktf/provider-azurerm/lib/data-azurerm-api-management'
|
|
6
|
-
|
|
6
|
+
import { ApiManagementCustomDomain } from '@cdktf/provider-azurerm/lib/api-management-custom-domain'
|
|
7
7
|
import { ApiManagementBackend } from '@cdktf/provider-azurerm/lib/api-management-backend'
|
|
8
8
|
import { ApiManagement } from '@cdktf/provider-azurerm/lib/api-management'
|
|
9
9
|
import { ApiManagementApi } from '@cdktf/provider-azurerm/lib/api-management-api'
|
|
@@ -16,7 +16,13 @@ import {
|
|
|
16
16
|
import { Resource } from '../../.gen/providers/azapi/resource'
|
|
17
17
|
import { CommonAzureConstruct } from '../../common'
|
|
18
18
|
import { createAzureTfOutput } from '../../utils'
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
ApiManagementProps,
|
|
21
|
+
ApiManagementBackendProps,
|
|
22
|
+
ApiManagementApiProps,
|
|
23
|
+
ApiManagementV2Props,
|
|
24
|
+
ApiManagementCustomDomainProps,
|
|
25
|
+
} from './types'
|
|
20
26
|
import _ from 'lodash'
|
|
21
27
|
|
|
22
28
|
/**
|
|
@@ -62,7 +68,7 @@ export class AzureApiManagementManager {
|
|
|
62
68
|
|
|
63
69
|
const apiManagement = new ApiManagement(scope, `${id}-am`, {
|
|
64
70
|
...props,
|
|
65
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
71
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagement),
|
|
66
72
|
resourceGroupName: resourceGroup.name,
|
|
67
73
|
tags: props.tags ?? {
|
|
68
74
|
environment: scope.props.stage,
|
|
@@ -71,7 +77,7 @@ export class AzureApiManagementManager {
|
|
|
71
77
|
|
|
72
78
|
if (applicationInsightsKey) {
|
|
73
79
|
new ApiManagementLogger(scope, `${id}-am-logger`, {
|
|
74
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
80
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementLogger),
|
|
75
81
|
resourceGroupName: resourceGroup.name,
|
|
76
82
|
apiManagementName: apiManagement.name,
|
|
77
83
|
applicationInsights: {
|
|
@@ -107,7 +113,7 @@ export class AzureApiManagementManager {
|
|
|
107
113
|
|
|
108
114
|
const apiManagement = new DataAzurermApiManagement(scope, `${id}-am`, {
|
|
109
115
|
...props,
|
|
110
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
116
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.dataAzurermApiManagement),
|
|
111
117
|
resourceGroupName: scope.props.resourceGroupName
|
|
112
118
|
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
113
119
|
: `${props.resourceGroupName}`,
|
|
@@ -141,7 +147,7 @@ export class AzureApiManagementManager {
|
|
|
141
147
|
|
|
142
148
|
const apiManagement = new Resource(scope, `${id}-am`, {
|
|
143
149
|
type: 'Microsoft.ApiManagement/service@2024-05-01',
|
|
144
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
150
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagement),
|
|
145
151
|
location: resourceGroup.location,
|
|
146
152
|
parentId: resourceGroup.id,
|
|
147
153
|
|
|
@@ -159,7 +165,7 @@ export class AzureApiManagementManager {
|
|
|
159
165
|
},
|
|
160
166
|
},
|
|
161
167
|
|
|
162
|
-
responseExportValues: ['
|
|
168
|
+
responseExportValues: ['*'],
|
|
163
169
|
|
|
164
170
|
identity: [
|
|
165
171
|
{
|
|
@@ -174,7 +180,7 @@ export class AzureApiManagementManager {
|
|
|
174
180
|
|
|
175
181
|
if (applicationInsightsKey) {
|
|
176
182
|
new ApiManagementLogger(scope, `${id}-am-logger`, {
|
|
177
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
183
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementLogger),
|
|
178
184
|
resourceGroupName: resourceGroup.name,
|
|
179
185
|
apiManagementName: apiManagement.name,
|
|
180
186
|
applicationInsights: {
|
|
@@ -202,7 +208,7 @@ export class AzureApiManagementManager {
|
|
|
202
208
|
|
|
203
209
|
const apiManagementBackend = new ApiManagementBackend(scope, `${id}-am-be`, {
|
|
204
210
|
...props,
|
|
205
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
211
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementBackend),
|
|
206
212
|
description: props.description || `Backend for ${props.name}-${scope.props.stage}`,
|
|
207
213
|
protocol: props.protocol || 'http',
|
|
208
214
|
})
|
|
@@ -226,7 +232,7 @@ export class AzureApiManagementManager {
|
|
|
226
232
|
|
|
227
233
|
const apiManagementApi = new ApiManagementApi(scope, `${id}-am-api`, {
|
|
228
234
|
...props,
|
|
229
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
235
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.apiManagementApi),
|
|
230
236
|
displayName: props.displayName || props.name,
|
|
231
237
|
revision: props.revision || '1',
|
|
232
238
|
protocols: props.protocols || ['https'],
|
|
@@ -292,4 +298,30 @@ export class AzureApiManagementManager {
|
|
|
292
298
|
|
|
293
299
|
return apiManagementApi
|
|
294
300
|
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @summary Method to create a new api management custom domain
|
|
304
|
+
* @param id scoped id of the resource
|
|
305
|
+
* @param scope scope in which this resource is defined
|
|
306
|
+
* @param props api management custom domain properties
|
|
307
|
+
* @see [CDKTF Api management Custom Domain Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/createApiManagementCustomDomain.typescript.md}
|
|
308
|
+
*/
|
|
309
|
+
public createApiManagementCustomDomain(
|
|
310
|
+
id: string,
|
|
311
|
+
scope: CommonAzureConstruct,
|
|
312
|
+
props: ApiManagementCustomDomainProps
|
|
313
|
+
) {
|
|
314
|
+
if (!props) throw `Props undefined for ${id}`
|
|
315
|
+
|
|
316
|
+
const apiManagementCustomDomain = new ApiManagementCustomDomain(scope, `${id}-am-cd`, props)
|
|
317
|
+
|
|
318
|
+
createAzureTfOutput(
|
|
319
|
+
`${id}-apiManagementCustomDomainFriendlyUniqueId`,
|
|
320
|
+
scope,
|
|
321
|
+
apiManagementCustomDomain.friendlyUniqueId
|
|
322
|
+
)
|
|
323
|
+
createAzureTfOutput(`${id}-apiManagementCustomDomainId`, scope, apiManagementCustomDomain.id)
|
|
324
|
+
|
|
325
|
+
return apiManagementCustomDomain
|
|
326
|
+
}
|
|
295
327
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiManagementConfig } from '@cdktf/provider-azurerm/lib/api-management'
|
|
2
2
|
import { ApiManagementBackendConfig } from '@cdktf/provider-azurerm/lib/api-management-backend'
|
|
3
|
+
import { ApiManagementCustomDomainConfig } from '@cdktf/provider-azurerm/lib/api-management-custom-domain'
|
|
3
4
|
import { ApiManagementApiConfig } from '@cdktf/provider-azurerm/lib/api-management-api'
|
|
4
5
|
import { ApiManagementApiOperationConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation'
|
|
5
6
|
import { ApiManagementApiOperationPolicyConfig } from '@cdktf/provider-azurerm/lib/api-management-api-operation-policy'
|
|
@@ -10,6 +11,8 @@ export interface ApiManagementBackendProps extends ApiManagementBackendConfig {
|
|
|
10
11
|
backendUrlPath?: string
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
export interface ApiManagementCustomDomainProps extends ApiManagementCustomDomainConfig {}
|
|
15
|
+
|
|
13
16
|
export interface ApiManagementApiProps extends ApiManagementApiConfig {
|
|
14
17
|
operations: ApiManagementApiOperationConfig[]
|
|
15
18
|
policyXmlContent?: ApiManagementApiOperationPolicyConfig['xmlContent']
|
|
@@ -42,7 +42,7 @@ export class AzureAppConfigurationManager {
|
|
|
42
42
|
|
|
43
43
|
const appConfiguration = new AppConfiguration(scope, `${id}-ac`, {
|
|
44
44
|
...props,
|
|
45
|
-
name:
|
|
45
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.appConfiguration),
|
|
46
46
|
resourceGroupName: resourceGroup.name,
|
|
47
47
|
tags: props.tags ?? {
|
|
48
48
|
environment: scope.props.stage,
|
|
@@ -42,7 +42,7 @@ export class AzureAppServiceManager {
|
|
|
42
42
|
|
|
43
43
|
const appServicePlan = new ServicePlan(scope, `${id}-as`, {
|
|
44
44
|
...props,
|
|
45
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
45
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.appServicePlan),
|
|
46
46
|
resourceGroupName: resourceGroup.name,
|
|
47
47
|
tags: props.tags ?? {
|
|
48
48
|
environment: scope.props.stage,
|
|
@@ -42,7 +42,7 @@ export class AzureApplicationInsightsManager {
|
|
|
42
42
|
|
|
43
43
|
const applicationInsights = new ApplicationInsights(scope, `${id}-ai`, {
|
|
44
44
|
...props,
|
|
45
|
-
name:
|
|
45
|
+
name: scope.resourceNameFormatter.format(props.name ?? '', scope.props.resourceNameOptions?.applicationInsights),
|
|
46
46
|
resourceGroupName: resourceGroup.name,
|
|
47
47
|
applicationType: props.applicationType || 'web',
|
|
48
48
|
tags: props.tags ?? {
|
|
@@ -44,7 +44,7 @@ export class AzureCosmosDbManager {
|
|
|
44
44
|
|
|
45
45
|
const cosmosdbAccount = new CosmosdbAccount(scope, `${id}-ca`, {
|
|
46
46
|
...props,
|
|
47
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
47
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.cosmosDbAccount),
|
|
48
48
|
location: resourceGroup.location,
|
|
49
49
|
resourceGroupName: resourceGroup.name,
|
|
50
50
|
tags: props.tags ?? {
|
|
@@ -79,7 +79,7 @@ export class AzureCosmosDbManager {
|
|
|
79
79
|
|
|
80
80
|
const cosmosdbDatatbase = new CosmosdbSqlDatabase(scope, `${id}-cd`, {
|
|
81
81
|
...props,
|
|
82
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
82
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.cosmosDbSqlDatabase),
|
|
83
83
|
resourceGroupName: resourceGroup.name,
|
|
84
84
|
})
|
|
85
85
|
|
|
@@ -110,7 +110,7 @@ export class AzureCosmosDbManager {
|
|
|
110
110
|
|
|
111
111
|
const cosmosdbContainer = new CosmosdbSqlContainer(scope, `${id}-cc`, {
|
|
112
112
|
...props,
|
|
113
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
113
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.cosmosDbSqlContainer),
|
|
114
114
|
resourceGroupName: resourceGroup.name,
|
|
115
115
|
})
|
|
116
116
|
|
|
@@ -45,7 +45,7 @@ export class AzureDnsManager {
|
|
|
45
45
|
|
|
46
46
|
const dnsZone = new DnsZone(scope, `${id}-dz`, {
|
|
47
47
|
...props,
|
|
48
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
48
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.dnsZone),
|
|
49
49
|
resourceGroupName: resourceGroup.name,
|
|
50
50
|
tags: props.tags ?? {
|
|
51
51
|
environment: scope.props.stage,
|
|
@@ -71,7 +71,6 @@ export class AzureDnsManager {
|
|
|
71
71
|
|
|
72
72
|
const dnsARecord = new DnsARecord(scope, `${id}-da`, {
|
|
73
73
|
...props,
|
|
74
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
75
74
|
ttl: props.ttl || 300,
|
|
76
75
|
tags: props.tags ?? {
|
|
77
76
|
environment: scope.props.stage,
|
|
@@ -97,7 +96,6 @@ export class AzureDnsManager {
|
|
|
97
96
|
|
|
98
97
|
const dnsCnameRecord = new DnsCnameRecord(scope, `${id}-dc`, {
|
|
99
98
|
...props,
|
|
100
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
101
99
|
ttl: props.ttl || 300,
|
|
102
100
|
tags: props.tags ?? {
|
|
103
101
|
environment: scope.props.stage,
|
|
@@ -47,7 +47,7 @@ export class AzureEventgridManager {
|
|
|
47
47
|
|
|
48
48
|
const eventgridTopic = new EventgridTopic(scope, `${id}-et`, {
|
|
49
49
|
...props,
|
|
50
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
50
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridTopic),
|
|
51
51
|
location: resourceGroup.location,
|
|
52
52
|
resourceGroupName: resourceGroup.name,
|
|
53
53
|
tags: props.tags ?? {
|
|
@@ -83,7 +83,7 @@ export class AzureEventgridManager {
|
|
|
83
83
|
|
|
84
84
|
const eventgridTopic = new DataAzurermEventgridTopic(scope, `${id}-et`, {
|
|
85
85
|
...props,
|
|
86
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
86
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridTopic),
|
|
87
87
|
resourceGroupName: resourceGroup.name,
|
|
88
88
|
})
|
|
89
89
|
|
|
@@ -107,7 +107,7 @@ export class AzureEventgridManager {
|
|
|
107
107
|
|
|
108
108
|
const eventgridSubscription = new EventgridEventSubscription(scope, `${id}-es`, {
|
|
109
109
|
...props,
|
|
110
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
110
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.eventGridEventSubscription),
|
|
111
111
|
eventDeliverySchema: props.eventDeliverySchema || 'CloudEventSchemaV1_0',
|
|
112
112
|
advancedFilteringOnArraysEnabled: props.advancedFilteringOnArraysEnabled || true,
|
|
113
113
|
})
|
|
@@ -45,7 +45,7 @@ export class AzureFunctionManager {
|
|
|
45
45
|
|
|
46
46
|
const functionApp = new LinuxFunctionApp(scope, `${id}-fa`, {
|
|
47
47
|
...props,
|
|
48
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
48
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.linuxFunctionApp),
|
|
49
49
|
resourceGroupName: resourceGroup.name,
|
|
50
50
|
tags: props.tags ?? {
|
|
51
51
|
environment: scope.props.stage,
|
|
@@ -71,7 +71,7 @@ export class AzureFunctionManager {
|
|
|
71
71
|
|
|
72
72
|
const functionAppFunction = new FunctionAppFunction(scope, `${id}-fc`, {
|
|
73
73
|
...props,
|
|
74
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
74
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionAppFunction),
|
|
75
75
|
configJson: JSON.stringify(props.configJson || {}),
|
|
76
76
|
})
|
|
77
77
|
|
|
@@ -105,7 +105,7 @@ export class AzureFunctionManager {
|
|
|
105
105
|
|
|
106
106
|
const functionApp = new Resource(scope, `${id}-fa`, {
|
|
107
107
|
type: 'Microsoft.Web/sites@2024-04-01',
|
|
108
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
108
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.functionApp),
|
|
109
109
|
location: resourceGroup.location,
|
|
110
110
|
parentId: resourceGroup.id,
|
|
111
111
|
|
|
@@ -42,7 +42,7 @@ export class AzureKeyVaultManager {
|
|
|
42
42
|
|
|
43
43
|
const keyVault = new KeyVault(scope, `${id}-kv`, {
|
|
44
44
|
...props,
|
|
45
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
45
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.keyVault),
|
|
46
46
|
location: resourceGroup.location,
|
|
47
47
|
resourceGroupName: resourceGroup.name,
|
|
48
48
|
skuName: props.skuName ?? 'standard',
|
|
@@ -42,7 +42,7 @@ export class AzureLogAnalyticsWorkspaceManager {
|
|
|
42
42
|
|
|
43
43
|
const logAnalyticsWorkspace = new LogAnalyticsWorkspace(scope, `${id}-lw`, {
|
|
44
44
|
...props,
|
|
45
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
45
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.logAnalyticsWorkspace),
|
|
46
46
|
location: resourceGroup.location,
|
|
47
47
|
resourceGroupName: resourceGroup.name,
|
|
48
48
|
tags: props.tags ?? {
|
|
@@ -33,7 +33,7 @@ export class AzureResourceGroupManager {
|
|
|
33
33
|
|
|
34
34
|
const resourceGroup = new ResourceGroup(scope, `${id}-rg`, {
|
|
35
35
|
...props,
|
|
36
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
36
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.resourceGroup),
|
|
37
37
|
location: props.location,
|
|
38
38
|
tags: props.tags ?? {
|
|
39
39
|
environment: scope.props.stage,
|
|
@@ -50,7 +50,7 @@ export class AzureServicebusManager {
|
|
|
50
50
|
|
|
51
51
|
const servicebusNamespace = new ServicebusNamespace(scope, `${id}-sn`, {
|
|
52
52
|
...props,
|
|
53
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
53
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusNamespace),
|
|
54
54
|
resourceGroupName: resourceGroup.name,
|
|
55
55
|
location: resourceGroup.location,
|
|
56
56
|
identity: {
|
|
@@ -81,7 +81,7 @@ export class AzureServicebusManager {
|
|
|
81
81
|
|
|
82
82
|
const servicebusTopic = new ServicebusTopic(scope, `${id}-st`, {
|
|
83
83
|
...props,
|
|
84
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
84
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusTopic),
|
|
85
85
|
namespaceId: props.namespaceId,
|
|
86
86
|
})
|
|
87
87
|
|
|
@@ -104,7 +104,7 @@ export class AzureServicebusManager {
|
|
|
104
104
|
|
|
105
105
|
const servicebusQueue = new ServicebusQueue(scope, `${id}-sq`, {
|
|
106
106
|
...props,
|
|
107
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
107
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusQueue),
|
|
108
108
|
namespaceId: props.namespaceId,
|
|
109
109
|
})
|
|
110
110
|
|
|
@@ -127,7 +127,7 @@ export class AzureServicebusManager {
|
|
|
127
127
|
|
|
128
128
|
const servicebusSubscription = new ServicebusSubscription(scope, `${id}-ss`, {
|
|
129
129
|
...props,
|
|
130
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
130
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.serviceBusSubscription),
|
|
131
131
|
maxDeliveryCount: props.maxDeliveryCount || 1,
|
|
132
132
|
})
|
|
133
133
|
|
|
@@ -48,7 +48,10 @@ export class AzureStorageManager {
|
|
|
48
48
|
...props,
|
|
49
49
|
accountTier: props.accountTier ?? 'Standard',
|
|
50
50
|
location: props.location ?? resourceGroup.location,
|
|
51
|
-
name:
|
|
51
|
+
name: scope.resourceNameFormatter
|
|
52
|
+
.format(props.name, scope.props.resourceNameOptions?.storageAccount)
|
|
53
|
+
.replace(/\W/g, '')
|
|
54
|
+
.toLowerCase(),
|
|
52
55
|
resourceGroupName: resourceGroup.name,
|
|
53
56
|
tags: props.tags ?? {
|
|
54
57
|
environment: scope.props.stage,
|
|
@@ -74,7 +77,7 @@ export class AzureStorageManager {
|
|
|
74
77
|
|
|
75
78
|
const storageContainer = new StorageContainer(scope, `${id}-sc`, {
|
|
76
79
|
...props,
|
|
77
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
80
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageContainer),
|
|
78
81
|
})
|
|
79
82
|
|
|
80
83
|
createAzureTfOutput(`${id}-storageContainerName`, scope, storageContainer.name)
|
|
@@ -115,7 +118,7 @@ export class AzureStorageManager {
|
|
|
115
118
|
|
|
116
119
|
const storageBlob = new StorageBlob(scope, `${id}-sb`, {
|
|
117
120
|
...props,
|
|
118
|
-
name: scope.resourceNameFormatter.format(props.name),
|
|
121
|
+
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageBlob),
|
|
119
122
|
storageAccountName: storageAccount.name,
|
|
120
123
|
storageContainerName: storageContainer.name,
|
|
121
124
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AwsProvider } from '@cdktf/provider-aws/lib/provider'
|
|
2
2
|
import { CloudflareProvider } from '@cdktf/provider-cloudflare/lib/provider'
|
|
3
|
-
import { S3Backend, TerraformStack, TerraformVariable } from 'cdktf'
|
|
3
|
+
import { AzurermBackend, S3Backend, TerraformStack, TerraformVariable } from 'cdktf'
|
|
4
4
|
import { Construct } from 'constructs'
|
|
5
5
|
import { isDevStage, isPrdStage, isTestStage, isUatStage } from '../../common'
|
|
6
6
|
import {
|
|
@@ -97,6 +97,15 @@ export class CommonCloudflareConstruct extends TerraformStack {
|
|
|
97
97
|
region: this.props.remoteBackend.region,
|
|
98
98
|
})
|
|
99
99
|
break
|
|
100
|
+
case RemoteBackend.azurerm:
|
|
101
|
+
new AzurermBackend(this, {
|
|
102
|
+
storageAccountName: this.props.remoteBackend.storageAccountName,
|
|
103
|
+
containerName: this.props.remoteBackend.containerName,
|
|
104
|
+
key: `${this.id}`,
|
|
105
|
+
subscriptionId: this.props.remoteBackend.subscriptionId,
|
|
106
|
+
resourceGroupName: this.props.remoteBackend.resourceGroupName,
|
|
107
|
+
})
|
|
108
|
+
break
|
|
100
109
|
case RemoteBackend.local:
|
|
101
110
|
if (debug) console.debug(`Using local backend for ${this.id}`)
|
|
102
111
|
break
|