@gradientedge/cdk-utils 9.43.2 → 9.44.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/lib/azure/common/constants.d.ts +4 -0
- package/dist/src/lib/azure/common/constants.js +5 -1
- package/dist/src/lib/azure/common/index.d.ts +1 -0
- package/dist/src/lib/azure/common/index.js +1 -0
- package/dist/src/lib/azure/common/resource-name-formatter.js +3 -1
- package/dist/src/lib/azure/common/stack.js +2 -0
- package/dist/src/lib/azure/common/tagging.d.ts +7 -0
- package/dist/src/lib/azure/common/tagging.js +28 -0
- package/dist/src/lib/azure/common/types.d.ts +3 -0
- package/dist/src/lib/azure/services/api-management/main.d.ts +10 -1
- package/dist/src/lib/azure/services/api-management/main.js +17 -1
- package/dist/src/lib/azure/services/api-management/types.d.ts +3 -0
- package/dist/src/lib/azure/services/cosmosdb/main.js +4 -0
- package/dist/src/lib/azure/services/dns/main.js +0 -2
- package/dist/src/lib/azure/services/key-vault/main.js +3 -1
- 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/constants.ts +5 -0
- package/src/lib/azure/common/index.ts +1 -0
- package/src/lib/azure/common/resource-name-formatter.ts +3 -1
- package/src/lib/azure/common/stack.ts +4 -2
- package/src/lib/azure/common/tagging.ts +33 -0
- package/src/lib/azure/common/types.ts +1 -0
- package/src/lib/azure/services/api-management/main.ts +35 -3
- package/src/lib/azure/services/api-management/types.ts +3 -0
- package/src/lib/azure/services/cosmosdb/main.ts +4 -0
- package/src/lib/azure/services/dns/main.ts +0 -2
- package/src/lib/azure/services/key-vault/main.ts +3 -1
- 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
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AzureRemoteBackend = void 0;
|
|
3
|
+
exports.RESOURCES_TO_EXCLUDE_TAGS = exports.AzureRemoteBackend = void 0;
|
|
4
4
|
var AzureRemoteBackend;
|
|
5
5
|
(function (AzureRemoteBackend) {
|
|
6
6
|
AzureRemoteBackend["local"] = "local";
|
|
7
7
|
AzureRemoteBackend["azurerm"] = "azurerm";
|
|
8
8
|
})(AzureRemoteBackend || (exports.AzureRemoteBackend = AzureRemoteBackend = {}));
|
|
9
|
+
/**
|
|
10
|
+
* List of Azure resources that excludes tags
|
|
11
|
+
*/
|
|
12
|
+
exports.RESOURCES_TO_EXCLUDE_TAGS = new Set(['ApiManagementNamedValue']);
|
|
@@ -18,4 +18,5 @@ __exportStar(require("./constants"), exports);
|
|
|
18
18
|
__exportStar(require("./construct"), exports);
|
|
19
19
|
__exportStar(require("./resource-name-formatter"), exports);
|
|
20
20
|
__exportStar(require("./stack"), exports);
|
|
21
|
+
__exportStar(require("./tagging"), exports);
|
|
21
22
|
__exportStar(require("./types"), exports);
|
|
@@ -26,7 +26,9 @@ class AzureResourceNameFormatter extends constructs_1.Construct {
|
|
|
26
26
|
azureResourceNameElements.push(options?.globalSuffix ? this.props.globalSuffix : undefined);
|
|
27
27
|
}
|
|
28
28
|
azureResourceNameElements.push(this.props.stage);
|
|
29
|
-
return azureResourceNameElements
|
|
29
|
+
return azureResourceNameElements
|
|
30
|
+
.filter(azureResourceNameElements => azureResourceNameElements != undefined)
|
|
31
|
+
.join('-');
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
exports.AzureResourceNameFormatter = AzureResourceNameFormatter;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.CommonAzureStack = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const tagging_1 = require("./tagging");
|
|
8
9
|
const app_root_path_1 = __importDefault(require("app-root-path"));
|
|
9
10
|
const cdktf_1 = require("cdktf");
|
|
10
11
|
const lodash_1 = __importDefault(require("lodash"));
|
|
@@ -32,6 +33,7 @@ class CommonAzureStack extends cdktf_1.TerraformStack {
|
|
|
32
33
|
/* determine extra cdk stage contexts */
|
|
33
34
|
this.determineStageContexts();
|
|
34
35
|
this.props = this.determineConstructProps(props);
|
|
36
|
+
cdktf_1.Aspects.of(this).add(new tagging_1.TagsAddingAspect(this.props.defaultTags || {}));
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* @summary Method to determine the core CDK construct properties injected via context cdktf.json
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TagsAddingAspect = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
function isTaggableConstruct(node) {
|
|
6
|
+
return 'tags' in node && 'tagsInput' in node;
|
|
7
|
+
}
|
|
8
|
+
class TagsAddingAspect {
|
|
9
|
+
tagsToAdd;
|
|
10
|
+
constructor(tagsToAdd) {
|
|
11
|
+
this.tagsToAdd = tagsToAdd;
|
|
12
|
+
}
|
|
13
|
+
// This method is called on every Construct within the specified scope (resources, data sources, etc.).
|
|
14
|
+
visit(node) {
|
|
15
|
+
// We need to take the input value to not create a circular reference
|
|
16
|
+
if (!isTaggableConstruct(node)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
// Determine if the resource excludes `tags`
|
|
20
|
+
if (constants_1.RESOURCES_TO_EXCLUDE_TAGS.has(node.constructor.name)) {
|
|
21
|
+
node.tags = undefined; // Completely remove tags for this resource
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const currentTags = node.tagsInput || {};
|
|
25
|
+
node.tags = { ...this.tagsToAdd, ...currentTags };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.TagsAddingAspect = TagsAddingAspect;
|
|
@@ -15,6 +15,9 @@ export interface CommonAzureStackProps extends BaseProps, AzurermProviderConfig
|
|
|
15
15
|
[key: string]: AzureResourceNameFormatterProps;
|
|
16
16
|
};
|
|
17
17
|
location?: string;
|
|
18
|
+
defaultTags?: {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
};
|
|
18
21
|
}
|
|
19
22
|
export interface AzureRemoteBackendProps extends AzurermBackendConfig {
|
|
20
23
|
type: AzureRemoteBackend;
|
|
@@ -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");
|
|
@@ -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',
|
|
@@ -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'];
|
|
@@ -49,6 +49,10 @@ class AzureCosmosDbManager {
|
|
|
49
49
|
tags: props.tags ?? {
|
|
50
50
|
environment: scope.props.stage,
|
|
51
51
|
},
|
|
52
|
+
defaultIdentityType: props.defaultIdentityType || 'SystemAssignedIdentity',
|
|
53
|
+
identity: props.identity || {
|
|
54
|
+
type: 'SystemAssigned',
|
|
55
|
+
},
|
|
52
56
|
});
|
|
53
57
|
(0, utils_1.createAzureTfOutput)(`${id}-cosmosdbAccountName`, scope, cosmosdbAccount.name);
|
|
54
58
|
(0, utils_1.createAzureTfOutput)(`${id}-cosmosdbAccountFriendlyUniqueId`, scope, cosmosdbAccount.friendlyUniqueId);
|
|
@@ -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, scope.props.resourceNameOptions?.dnsARecord),
|
|
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, scope.props.resourceNameOptions?.dnsCnameRecord),
|
|
94
92
|
ttl: props.ttl || 300,
|
|
95
93
|
tags: props.tags ?? {
|
|
96
94
|
environment: scope.props.stage,
|
|
@@ -44,7 +44,9 @@ class AzureKeyVaultManager {
|
|
|
44
44
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.keyVault),
|
|
45
45
|
location: resourceGroup.location,
|
|
46
46
|
resourceGroupName: resourceGroup.name,
|
|
47
|
-
skuName: props.skuName
|
|
47
|
+
skuName: props.skuName || 'standard',
|
|
48
|
+
enableRbacAuthorization: props.enableRbacAuthorization || true,
|
|
49
|
+
softDeleteRetentionDays: props.softDeleteRetentionDays || 90,
|
|
48
50
|
tags: props.tags ?? {
|
|
49
51
|
environment: scope.props.stage,
|
|
50
52
|
},
|
|
@@ -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
|
@@ -33,6 +33,8 @@ export class AzureResourceNameFormatter extends Construct {
|
|
|
33
33
|
|
|
34
34
|
azureResourceNameElements.push(this.props.stage)
|
|
35
35
|
|
|
36
|
-
return azureResourceNameElements
|
|
36
|
+
return azureResourceNameElements
|
|
37
|
+
.filter(azureResourceNameElements => azureResourceNameElements != undefined)
|
|
38
|
+
.join('-')
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fs from 'fs'
|
|
2
2
|
import { CommonAzureConstruct } from './construct'
|
|
3
3
|
import { CommonAzureStackProps } from './types'
|
|
4
|
-
|
|
4
|
+
import { TagsAddingAspect } from './tagging'
|
|
5
5
|
import appRoot from 'app-root-path'
|
|
6
|
-
import { TerraformStack } from 'cdktf'
|
|
6
|
+
import { Aspects, TerraformStack } from 'cdktf'
|
|
7
7
|
import { Construct } from 'constructs'
|
|
8
8
|
import _ from 'lodash'
|
|
9
9
|
import { isDevStage } from '../../common'
|
|
@@ -35,6 +35,8 @@ export class CommonAzureStack extends TerraformStack {
|
|
|
35
35
|
this.determineStageContexts()
|
|
36
36
|
|
|
37
37
|
this.props = this.determineConstructProps(props)
|
|
38
|
+
|
|
39
|
+
Aspects.of(this).add(new TagsAddingAspect(this.props.defaultTags || {}))
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
/**
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IAspect } from 'cdktf'
|
|
2
|
+
import { IConstruct } from 'constructs'
|
|
3
|
+
import { RESOURCES_TO_EXCLUDE_TAGS } from './constants'
|
|
4
|
+
|
|
5
|
+
type TaggableConstruct = IConstruct & {
|
|
6
|
+
tags?: { [key: string]: string } | string[]
|
|
7
|
+
tagsInput?: { [key: string]: string } | string[]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function isTaggableConstruct(node: IConstruct): node is TaggableConstruct {
|
|
11
|
+
return 'tags' in node && 'tagsInput' in node
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class TagsAddingAspect implements IAspect {
|
|
15
|
+
constructor(private tagsToAdd: Record<string, string>) {}
|
|
16
|
+
|
|
17
|
+
// This method is called on every Construct within the specified scope (resources, data sources, etc.).
|
|
18
|
+
visit(node: IConstruct) {
|
|
19
|
+
// We need to take the input value to not create a circular reference
|
|
20
|
+
if (!isTaggableConstruct(node)) {
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Determine if the resource excludes `tags`
|
|
25
|
+
if (RESOURCES_TO_EXCLUDE_TAGS.has(node.constructor.name)) {
|
|
26
|
+
node.tags = undefined // Completely remove tags for this resource
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const currentTags = node.tagsInput || {}
|
|
31
|
+
node.tags = { ...this.tagsToAdd, ...currentTags }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -14,6 +14,7 @@ export interface CommonAzureStackProps extends BaseProps, AzurermProviderConfig
|
|
|
14
14
|
resourceSuffix?: string
|
|
15
15
|
resourceNameOptions?: { [key: string]: AzureResourceNameFormatterProps }
|
|
16
16
|
location?: string
|
|
17
|
+
defaultTags?: { [key: string]: string }
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export interface AzureRemoteBackendProps extends AzurermBackendConfig {
|
|
@@ -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
|
/**
|
|
@@ -159,7 +165,7 @@ export class AzureApiManagementManager {
|
|
|
159
165
|
},
|
|
160
166
|
},
|
|
161
167
|
|
|
162
|
-
responseExportValues: ['
|
|
168
|
+
responseExportValues: ['*'],
|
|
163
169
|
|
|
164
170
|
identity: [
|
|
165
171
|
{
|
|
@@ -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']
|
|
@@ -50,6 +50,10 @@ export class AzureCosmosDbManager {
|
|
|
50
50
|
tags: props.tags ?? {
|
|
51
51
|
environment: scope.props.stage,
|
|
52
52
|
},
|
|
53
|
+
defaultIdentityType: props.defaultIdentityType || 'SystemAssignedIdentity',
|
|
54
|
+
identity: props.identity || {
|
|
55
|
+
type: 'SystemAssigned',
|
|
56
|
+
},
|
|
53
57
|
})
|
|
54
58
|
|
|
55
59
|
createAzureTfOutput(`${id}-cosmosdbAccountName`, scope, cosmosdbAccount.name)
|
|
@@ -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, scope.props.resourceNameOptions?.dnsARecord),
|
|
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, scope.props.resourceNameOptions?.dnsCnameRecord),
|
|
101
99
|
ttl: props.ttl || 300,
|
|
102
100
|
tags: props.tags ?? {
|
|
103
101
|
environment: scope.props.stage,
|
|
@@ -45,7 +45,9 @@ export class AzureKeyVaultManager {
|
|
|
45
45
|
name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.keyVault),
|
|
46
46
|
location: resourceGroup.location,
|
|
47
47
|
resourceGroupName: resourceGroup.name,
|
|
48
|
-
skuName: props.skuName
|
|
48
|
+
skuName: props.skuName || 'standard',
|
|
49
|
+
enableRbacAuthorization: props.enableRbacAuthorization || true,
|
|
50
|
+
softDeleteRetentionDays: props.softDeleteRetentionDays || 90,
|
|
49
51
|
tags: props.tags ?? {
|
|
50
52
|
environment: scope.props.stage,
|
|
51
53
|
},
|
|
@@ -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
|