@gradientedge/cdk-utils 9.89.0 → 10.1.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/cloudflare/common/construct.d.ts +7 -19
- package/dist/src/lib/cloudflare/common/construct.js +12 -66
- package/dist/src/lib/cloudflare/common/index.d.ts +0 -1
- package/dist/src/lib/cloudflare/common/index.js +0 -1
- package/dist/src/lib/cloudflare/common/stack.d.ts +11 -21
- package/dist/src/lib/cloudflare/common/stack.js +55 -62
- package/dist/src/lib/cloudflare/common/types.d.ts +2 -14
- package/dist/src/lib/cloudflare/construct/pages-static-site/main.d.ts +8 -10
- package/dist/src/lib/cloudflare/construct/pages-static-site/main.js +18 -25
- package/dist/src/lib/cloudflare/construct/worker-site/main.d.ts +13 -10
- package/dist/src/lib/cloudflare/construct/worker-site/main.js +29 -41
- package/dist/src/lib/cloudflare/index.d.ts +0 -1
- package/dist/src/lib/cloudflare/index.js +0 -1
- package/dist/src/lib/cloudflare/services/access/main.d.ts +31 -43
- package/dist/src/lib/cloudflare/services/access/main.js +56 -83
- package/dist/src/lib/cloudflare/services/access/types.d.ts +12 -22
- package/dist/src/lib/cloudflare/services/api-shield/main.d.ts +10 -15
- package/dist/src/lib/cloudflare/services/api-shield/main.js +16 -36
- package/dist/src/lib/cloudflare/services/api-shield/types.d.ts +6 -10
- package/dist/src/lib/cloudflare/services/argo/main.d.ts +6 -8
- package/dist/src/lib/cloudflare/services/argo/main.js +9 -17
- package/dist/src/lib/cloudflare/services/argo/types.d.ts +3 -4
- package/dist/src/lib/cloudflare/services/filter/main.d.ts +3 -4
- package/dist/src/lib/cloudflare/services/filter/main.js +6 -10
- package/dist/src/lib/cloudflare/services/filter/types.d.ts +2 -2
- package/dist/src/lib/cloudflare/services/firewall/main.d.ts +2 -3
- package/dist/src/lib/cloudflare/services/firewall/main.js +4 -8
- package/dist/src/lib/cloudflare/services/firewall/types.d.ts +2 -2
- package/dist/src/lib/cloudflare/services/page/main.d.ts +7 -11
- package/dist/src/lib/cloudflare/services/page/main.js +13 -26
- package/dist/src/lib/cloudflare/services/page/types.d.ts +4 -6
- package/dist/src/lib/cloudflare/services/record/main.d.ts +2 -3
- package/dist/src/lib/cloudflare/services/record/main.js +4 -8
- package/dist/src/lib/cloudflare/services/record/types.d.ts +2 -2
- package/dist/src/lib/cloudflare/services/rule-set/main.d.ts +5 -6
- package/dist/src/lib/cloudflare/services/rule-set/main.js +7 -10
- package/dist/src/lib/cloudflare/services/rule-set/types.d.ts +2 -2
- package/dist/src/lib/cloudflare/services/worker/main.d.ts +12 -18
- package/dist/src/lib/cloudflare/services/worker/main.js +15 -39
- package/dist/src/lib/cloudflare/services/worker/types.d.ts +7 -12
- package/dist/src/lib/cloudflare/services/zone/main.d.ts +13 -30
- package/dist/src/lib/cloudflare/services/zone/main.js +31 -84
- package/dist/src/lib/cloudflare/services/zone/types.d.ts +10 -20
- package/dist/src/lib/common/types.d.ts +4 -0
- package/package.json +29 -23
- package/src/lib/cloudflare/common/construct.ts +13 -70
- package/src/lib/cloudflare/common/index.ts +0 -1
- package/src/lib/cloudflare/common/stack.ts +58 -69
- package/src/lib/cloudflare/common/types.ts +2 -15
- package/src/lib/cloudflare/construct/pages-static-site/main.ts +22 -42
- package/src/lib/cloudflare/construct/worker-site/main.ts +38 -62
- package/src/lib/cloudflare/index.ts +0 -1
- package/src/lib/cloudflare/services/access/main.ts +57 -118
- package/src/lib/cloudflare/services/access/types.ts +24 -22
- package/src/lib/cloudflare/services/api-shield/main.ts +16 -63
- package/src/lib/cloudflare/services/api-shield/types.ts +12 -10
- package/src/lib/cloudflare/services/argo/main.ts +9 -23
- package/src/lib/cloudflare/services/argo/types.ts +3 -4
- package/src/lib/cloudflare/services/filter/main.ts +6 -13
- package/src/lib/cloudflare/services/filter/types.ts +2 -2
- package/src/lib/cloudflare/services/firewall/main.ts +4 -11
- package/src/lib/cloudflare/services/firewall/types.ts +2 -2
- package/src/lib/cloudflare/services/page/main.ts +19 -36
- package/src/lib/cloudflare/services/page/types.ts +4 -6
- package/src/lib/cloudflare/services/record/main.ts +4 -11
- package/src/lib/cloudflare/services/record/types.ts +2 -2
- package/src/lib/cloudflare/services/rule-set/main.ts +7 -12
- package/src/lib/cloudflare/services/rule-set/types.ts +2 -2
- package/src/lib/cloudflare/services/worker/main.ts +15 -52
- package/src/lib/cloudflare/services/worker/types.ts +14 -12
- package/src/lib/cloudflare/services/zone/main.ts +40 -103
- package/src/lib/cloudflare/services/zone/types.ts +20 -21
- package/src/lib/common/types.ts +5 -0
- package/dist/src/lib/cloudflare/common/constants.d.ts +0 -5
- package/dist/src/lib/cloudflare/common/constants.js +0 -6
- package/dist/src/lib/cloudflare/utils/index.d.ts +0 -3
- package/dist/src/lib/cloudflare/utils/index.js +0 -13
- package/src/lib/cloudflare/common/constants.ts +0 -5
- package/src/lib/cloudflare/utils/index.ts +0 -23
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { ZoneCacheVariants } from '@cdktf/provider-cloudflare/lib/zone-cache-variants/index.js';
|
|
4
|
-
import { ZoneDnsSettings } from '@cdktf/provider-cloudflare/lib/zone-dns-settings/index.js';
|
|
5
|
-
import { ZoneDnssec } from '@cdktf/provider-cloudflare/lib/zone-dnssec/index.js';
|
|
6
|
-
import { ZoneHold } from '@cdktf/provider-cloudflare/lib/zone-hold/index.js';
|
|
7
|
-
import { ZoneLockdown } from '@cdktf/provider-cloudflare/lib/zone-lockdown/index.js';
|
|
8
|
-
import { ZoneSetting } from '@cdktf/provider-cloudflare/lib/zone-setting/index.js';
|
|
9
|
-
import { Zone } from '@cdktf/provider-cloudflare/lib/zone/index.js';
|
|
10
|
-
import { createCloudflareTfOutput } from '../../utils/index.js';
|
|
1
|
+
import * as cloudflare from '@pulumi/cloudflare';
|
|
2
|
+
import * as pulumi from '@pulumi/pulumi';
|
|
11
3
|
/**
|
|
12
|
-
* @classdesc Provides operations on Cloudflare Zone
|
|
4
|
+
* @classdesc Provides operations on Cloudflare Zone using Pulumi
|
|
13
5
|
* - A new instance of this class is injected into {@link CommonCloudflareConstruct} constructor.
|
|
14
6
|
* - If a custom construct extends {@link CommonCloudflareConstruct}, an instance is available within the context.
|
|
15
7
|
* @example
|
|
16
8
|
* ```
|
|
17
|
-
* import { CommonCloudflareConstruct
|
|
9
|
+
* import { CommonCloudflareConstruct } from '@gradientedge/cdk-utils'
|
|
18
10
|
*
|
|
19
11
|
* class CustomConstruct extends CommonCloudflareConstruct {
|
|
20
|
-
* constructor(parent:
|
|
12
|
+
* constructor(parent: pulumi.ComponentResource, id: string, props: CommonCloudflareStackProps) {
|
|
21
13
|
* super(parent, id, props)
|
|
22
14
|
* this.props = props
|
|
23
15
|
* this.zoneManager.createZone('MyZone', this, props)
|
|
@@ -31,155 +23,115 @@ export class CloudflareZoneManager {
|
|
|
31
23
|
* @param id scoped id of the resource
|
|
32
24
|
* @param scope scope in which this resource is defined
|
|
33
25
|
* @param props zone properties
|
|
34
|
-
* @see [CDKTF Zone Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zone.typescript.md}
|
|
35
26
|
*/
|
|
36
27
|
createZone(id, scope, props) {
|
|
37
28
|
if (!props)
|
|
38
29
|
throw `Props undefined for ${id}`;
|
|
39
|
-
|
|
30
|
+
return new cloudflare.Zone(id, {
|
|
40
31
|
...props,
|
|
41
|
-
account:
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
name: props.name ?? scope.props.domainName,
|
|
32
|
+
account: props.account ?? scope.props.accountId,
|
|
33
|
+
name: scope.props.domainName,
|
|
45
34
|
});
|
|
46
|
-
createCloudflareTfOutput(`${id}-zoneName`, scope, zone.name);
|
|
47
|
-
createCloudflareTfOutput(`${id}-zoneFriendlyUniqueId`, scope, zone.friendlyUniqueId);
|
|
48
|
-
createCloudflareTfOutput(`${id}-zoneId`, scope, zone.id);
|
|
49
|
-
return zone;
|
|
50
35
|
}
|
|
51
36
|
resolveZone(id, scope, options) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
name: options?.name ?? scope.props.domainName,
|
|
55
|
-
},
|
|
56
|
-
zoneId: options?.zoneId,
|
|
57
|
-
});
|
|
58
|
-
return zone;
|
|
37
|
+
const name = options?.filter?.name ?? scope.props.domainName;
|
|
38
|
+
return cloudflare.Zone.get(name, id);
|
|
59
39
|
}
|
|
60
40
|
/**
|
|
61
41
|
* @summary Method to create a new zone cache reserve
|
|
62
42
|
* @param id scoped id of the resource
|
|
63
43
|
* @param scope scope in which this resource is defined
|
|
64
44
|
* @param props zone cache reserve properties
|
|
65
|
-
* @see [CDKTF Zone Cache Reserve Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneCacheReserve.typescript.md}
|
|
66
45
|
*/
|
|
67
46
|
createZoneCacheReserve(id, scope, props) {
|
|
68
47
|
if (!props)
|
|
69
48
|
throw `Props undefined for ${id}`;
|
|
70
|
-
const zoneId = props.zoneId
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const zoneCacheReserve = new ZoneCacheReserve(scope, `${id}`, {
|
|
49
|
+
const zoneId = props.zoneId ??
|
|
50
|
+
pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id;
|
|
51
|
+
return new cloudflare.ZoneCacheReserve(id, {
|
|
74
52
|
...props,
|
|
75
53
|
zoneId,
|
|
76
54
|
});
|
|
77
|
-
createCloudflareTfOutput(`${id}-zoneCacheReserveFriendlyUniqueId`, scope, zoneCacheReserve.friendlyUniqueId);
|
|
78
|
-
createCloudflareTfOutput(`${id}-zoneCacheReserveId`, scope, zoneCacheReserve.id);
|
|
79
|
-
return zoneCacheReserve;
|
|
80
55
|
}
|
|
81
56
|
/**
|
|
82
57
|
* @summary Method to create a new zone cache variants
|
|
83
58
|
* @param id scoped id of the resource
|
|
84
59
|
* @param scope scope in which this resource is defined
|
|
85
60
|
* @param props zone cache variants properties
|
|
86
|
-
* @see [CDKTF Zone Cache Variants Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneCacheVariants.typescript.md}
|
|
87
61
|
*/
|
|
88
62
|
createZoneCacheVariants(id, scope, props) {
|
|
89
63
|
if (!props)
|
|
90
64
|
throw `Props undefined for ${id}`;
|
|
91
|
-
const zoneId = props.zoneId
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const zoneCacheVariants = new ZoneCacheVariants(scope, `${id}`, {
|
|
65
|
+
const zoneId = props.zoneId ??
|
|
66
|
+
pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id;
|
|
67
|
+
return new cloudflare.ZoneCacheVariants(id, {
|
|
95
68
|
...props,
|
|
96
69
|
zoneId,
|
|
97
70
|
});
|
|
98
|
-
createCloudflareTfOutput(`${id}-zoneCacheVariantsFriendlyUniqueId`, scope, zoneCacheVariants.friendlyUniqueId);
|
|
99
|
-
createCloudflareTfOutput(`${id}-zoneCacheVariantsId`, scope, zoneCacheVariants.id);
|
|
100
|
-
return zoneCacheVariants;
|
|
101
71
|
}
|
|
102
72
|
/**
|
|
103
73
|
* @summary Method to create a new zone dnssec
|
|
104
74
|
* @param id scoped id of the resource
|
|
105
75
|
* @param scope scope in which this resource is defined
|
|
106
76
|
* @param props zone dnssec properties
|
|
107
|
-
* @see [CDKTF Zone DNS Security Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneDnssec.typescript.md}
|
|
108
77
|
*/
|
|
109
78
|
createZoneDnssec(id, scope, props) {
|
|
110
79
|
if (!props)
|
|
111
80
|
throw `Props undefined for ${id}`;
|
|
112
|
-
const zoneId = props.zoneId
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const zoneDnssec = new ZoneDnssec(scope, `${id}`, {
|
|
81
|
+
const zoneId = props.zoneId ??
|
|
82
|
+
pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id;
|
|
83
|
+
return new cloudflare.ZoneDnssec(id, {
|
|
116
84
|
...props,
|
|
117
85
|
zoneId,
|
|
118
86
|
});
|
|
119
|
-
createCloudflareTfOutput(`${id}-zoneDnssecFriendlyUniqueId`, scope, zoneDnssec.friendlyUniqueId);
|
|
120
|
-
createCloudflareTfOutput(`${id}-zoneDnssecId`, scope, zoneDnssec.id);
|
|
121
|
-
return zoneDnssec;
|
|
122
87
|
}
|
|
123
88
|
/**
|
|
124
89
|
* @summary Method to create a new zone hold
|
|
125
90
|
* @param id scoped id of the resource
|
|
126
91
|
* @param scope scope in which this resource is defined
|
|
127
92
|
* @param props zone hold properties
|
|
128
|
-
* @see [CDKTF Zone Hold Security Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneHold.typescript.md}
|
|
129
93
|
*/
|
|
130
94
|
createZoneHold(id, scope, props) {
|
|
131
95
|
if (!props)
|
|
132
96
|
throw `Props undefined for ${id}`;
|
|
133
|
-
const zoneId = props.zoneId
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const zoneHold = new ZoneHold(scope, `${id}`, {
|
|
97
|
+
const zoneId = props.zoneId ??
|
|
98
|
+
pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id;
|
|
99
|
+
return new cloudflare.ZoneHold(id, {
|
|
137
100
|
...props,
|
|
138
101
|
zoneId,
|
|
139
102
|
});
|
|
140
|
-
createCloudflareTfOutput(`${id}-zoneHoldFriendlyUniqueId`, scope, zoneHold.friendlyUniqueId);
|
|
141
|
-
createCloudflareTfOutput(`${id}-zoneHoldId`, scope, zoneHold.id);
|
|
142
|
-
return zoneHold;
|
|
143
103
|
}
|
|
144
104
|
/**
|
|
145
105
|
* @summary Method to create a new zone lockdown
|
|
146
106
|
* @param id scoped id of the resource
|
|
147
107
|
* @param scope scope in which this resource is defined
|
|
148
108
|
* @param props zone lockdown properties
|
|
149
|
-
* @see [CDKTF Zone Lockdown Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneLockdown.typescript.md}
|
|
150
109
|
*/
|
|
151
110
|
createZoneLockdown(id, scope, props) {
|
|
152
111
|
if (!props)
|
|
153
112
|
throw `Props undefined for ${id}`;
|
|
154
|
-
const zoneId = props.zoneId
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const zoneLockdown = new ZoneLockdown(scope, `${id}`, {
|
|
113
|
+
const zoneId = props.zoneId ??
|
|
114
|
+
pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id;
|
|
115
|
+
return new cloudflare.ZoneLockdown(id, {
|
|
158
116
|
...props,
|
|
159
117
|
zoneId,
|
|
160
118
|
});
|
|
161
|
-
createCloudflareTfOutput(`${id}-zoneLockdownFriendlyUniqueId`, scope, zoneLockdown.friendlyUniqueId);
|
|
162
|
-
createCloudflareTfOutput(`${id}-zoneLockdownId`, scope, zoneLockdown.id);
|
|
163
|
-
return zoneLockdown;
|
|
164
119
|
}
|
|
165
120
|
/**
|
|
166
121
|
* @summary Method to create new zone dns settings
|
|
167
122
|
* @param id scoped id of the resource
|
|
168
123
|
* @param scope scope in which this resource is defined
|
|
169
124
|
* @param props zone dns settings properties
|
|
170
|
-
* @see [CDKTF Zone Dns Settings Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/dnsZoneSettings.typescript.md}
|
|
171
125
|
*/
|
|
172
126
|
createZoneDnsSettings(id, scope, props) {
|
|
173
127
|
if (!props)
|
|
174
128
|
throw `Props undefined for ${id}`;
|
|
175
|
-
const zoneId = props.zoneId
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const zoneDnsSettings = new ZoneDnsSettings(scope, `${id}`, {
|
|
129
|
+
const zoneId = props.zoneId ??
|
|
130
|
+
pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id;
|
|
131
|
+
const zoneDnsSettings = new cloudflare.ZoneSetting(id, {
|
|
179
132
|
...props,
|
|
180
133
|
zoneId,
|
|
181
134
|
});
|
|
182
|
-
createCloudflareTfOutput(`${id}-zoneDnsSettingsFriendlyUniqueId`, scope, zoneDnsSettings.friendlyUniqueId);
|
|
183
135
|
return zoneDnsSettings;
|
|
184
136
|
}
|
|
185
137
|
/**
|
|
@@ -187,20 +139,15 @@ export class CloudflareZoneManager {
|
|
|
187
139
|
* @param id scoped id of the resource
|
|
188
140
|
* @param scope scope in which this resource is defined
|
|
189
141
|
* @param props zone setting properties
|
|
190
|
-
* @see [CDKTF Zone Setting Module]{@link https://github.com/cdktf/cdktf-provider-cloudflare/blob/main/docs/zoneSetting.typescript.md}
|
|
191
142
|
*/
|
|
192
143
|
createZoneSetting(id, scope, props) {
|
|
193
144
|
if (!props)
|
|
194
145
|
throw `Props undefined for ${id}`;
|
|
195
|
-
const zoneId = props.zoneId
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const zoneSetting = new ZoneSetting(scope, `${id}`, {
|
|
146
|
+
const zoneId = props.zoneId ??
|
|
147
|
+
pulumi.output(this.resolveZone(`${id}-data-zone`, scope, { filter: { name: scope.props.domainName } })).id;
|
|
148
|
+
return new cloudflare.ZoneSetting(id, {
|
|
199
149
|
...props,
|
|
200
150
|
zoneId,
|
|
201
151
|
});
|
|
202
|
-
createCloudflareTfOutput(`${id}-zoneSettingFriendlyUniqueId`, scope, zoneSetting.friendlyUniqueId);
|
|
203
|
-
createCloudflareTfOutput(`${id}-zoneSettingId`, scope, zoneSetting.id);
|
|
204
|
-
return zoneSetting;
|
|
205
152
|
}
|
|
206
153
|
}
|
|
@@ -1,29 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ZoneCacheVariantsConfig } from '@cdktf/provider-cloudflare/lib/zone-cache-variants/index.js';
|
|
4
|
-
import { ZoneDnssecConfig } from '@cdktf/provider-cloudflare/lib/zone-dnssec/index.js';
|
|
5
|
-
import { ZoneHoldConfig } from '@cdktf/provider-cloudflare/lib/zone-hold/index.js';
|
|
6
|
-
import { ZoneLockdownConfig } from '@cdktf/provider-cloudflare/lib/zone-lockdown/index.js';
|
|
7
|
-
import { ZoneSettingConfig } from '@cdktf/provider-cloudflare/lib/zone-setting/index.js';
|
|
8
|
-
import { ZoneDnsSettingsConfig } from '@cdktf/provider-cloudflare/lib/zone-dns-settings/index.js';
|
|
9
|
-
import { DataCloudflareZoneConfig } from '@cdktf/provider-cloudflare/lib/data-cloudflare-zone/index.js';
|
|
10
|
-
export interface ZoneProps extends ZoneConfig {
|
|
1
|
+
import { GetZoneArgs, ZoneArgs, ZoneCacheReserveArgs, ZoneCacheVariantsArgs, ZoneDnssecArgs, ZoneDnsSettingsArgs, ZoneHoldArgs, ZoneLockdownArgs, ZoneSettingArgs } from '@pulumi/cloudflare';
|
|
2
|
+
export interface ZoneProps extends ZoneArgs {
|
|
11
3
|
}
|
|
12
|
-
export interface
|
|
13
|
-
id?: string;
|
|
14
|
-
name?: string;
|
|
4
|
+
export interface GetZoneProps extends GetZoneArgs {
|
|
15
5
|
}
|
|
16
|
-
export interface ZoneCacheReserveProps extends
|
|
6
|
+
export interface ZoneCacheReserveProps extends ZoneCacheReserveArgs {
|
|
17
7
|
}
|
|
18
|
-
export interface ZoneCacheVariantsProps extends
|
|
8
|
+
export interface ZoneCacheVariantsProps extends ZoneCacheVariantsArgs {
|
|
19
9
|
}
|
|
20
|
-
export interface ZoneDnssecProps extends
|
|
10
|
+
export interface ZoneDnssecProps extends ZoneDnssecArgs {
|
|
21
11
|
}
|
|
22
|
-
export interface ZoneHoldProps extends
|
|
12
|
+
export interface ZoneHoldProps extends ZoneHoldArgs {
|
|
23
13
|
}
|
|
24
|
-
export interface ZoneLockdownProps extends
|
|
14
|
+
export interface ZoneLockdownProps extends ZoneLockdownArgs {
|
|
25
15
|
}
|
|
26
|
-
export interface ZoneSettingProps extends
|
|
16
|
+
export interface ZoneSettingProps extends ZoneSettingArgs {
|
|
27
17
|
}
|
|
28
|
-
export interface ZoneDnsSettingsProps extends
|
|
18
|
+
export interface ZoneDnsSettingsProps extends ZoneDnsSettingsArgs {
|
|
29
19
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ComponentResourceOptions } from '@pulumi/pulumi';
|
|
1
2
|
export interface BaseProps {
|
|
3
|
+
debug?: boolean;
|
|
2
4
|
domainName: string;
|
|
3
5
|
extraContexts?: string[];
|
|
4
6
|
name: string;
|
|
@@ -7,3 +9,5 @@ export interface BaseProps {
|
|
|
7
9
|
stageContextPath?: string;
|
|
8
10
|
subDomain?: string;
|
|
9
11
|
}
|
|
12
|
+
export interface BaseOptions extends ComponentResourceOptions {
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradientedge/cdk-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Utilities for AWS CDK provisioning",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node": ">=22 <=24",
|
|
15
15
|
"pnpm": "=10"
|
|
16
16
|
},
|
|
17
|
-
"packageManager": "pnpm@10.
|
|
17
|
+
"packageManager": "pnpm@10.28.2",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git+https://github.com/gradientedge/cdk-utils.git"
|
|
@@ -55,21 +55,27 @@
|
|
|
55
55
|
"prepare": "husky"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
59
|
-
"@aws-sdk/credential-providers": "^3.
|
|
60
|
-
"@aws-sdk/types": "^3.
|
|
58
|
+
"@aws-sdk/client-secrets-manager": "^3.975.0",
|
|
59
|
+
"@aws-sdk/credential-providers": "^3.975.0",
|
|
60
|
+
"@aws-sdk/types": "^3.973.1",
|
|
61
61
|
"@cdktf/provider-aws": "^21.22.1",
|
|
62
62
|
"@cdktf/provider-azurerm": "^14.23.1",
|
|
63
63
|
"@cdktf/provider-cloudflare": "^13.9.1",
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
64
|
+
"@pulumi/aws": "^7.16.0",
|
|
65
|
+
"@pulumi/azure-native": "^3.12.1",
|
|
66
|
+
"@pulumi/cloudflare": "^6.13.0",
|
|
67
|
+
"@pulumi/command": "^1.1.3",
|
|
68
|
+
"@pulumi/pulumi": "^3.217.1",
|
|
69
|
+
"@pulumi/std": "^2.2.0",
|
|
70
|
+
"@types/lodash": "^4.17.23",
|
|
71
|
+
"@types/node": "^25.0.10",
|
|
66
72
|
"@types/uuid": "^11.0.0",
|
|
67
73
|
"app-root-path": "^3.1.0",
|
|
68
|
-
"aws-cdk-lib": "^2.
|
|
74
|
+
"aws-cdk-lib": "^2.236.0",
|
|
69
75
|
"cdktf": "^0.21.0",
|
|
70
76
|
"cdktf-local-exec": "^0.6.28",
|
|
71
|
-
"constructs": "^10.4.
|
|
72
|
-
"lodash": "^4.17.
|
|
77
|
+
"constructs": "^10.4.5",
|
|
78
|
+
"lodash": "^4.17.23",
|
|
73
79
|
"moment": "^2.30.1",
|
|
74
80
|
"nconf": "^0.13.0",
|
|
75
81
|
"pluralize": "^8.0.0",
|
|
@@ -77,16 +83,16 @@
|
|
|
77
83
|
"uuid": "^13.0.0"
|
|
78
84
|
},
|
|
79
85
|
"devDependencies": {
|
|
80
|
-
"@babel/core": "^7.28.
|
|
81
|
-
"@babel/eslint-parser": "^7.28.
|
|
86
|
+
"@babel/core": "^7.28.6",
|
|
87
|
+
"@babel/eslint-parser": "^7.28.6",
|
|
82
88
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
83
89
|
"@eslint/config-array": "^0.23.0",
|
|
84
90
|
"@eslint/object-schema": "^3.0.0",
|
|
85
|
-
"@types/node": "^25.0.
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
87
|
-
"@typescript-eslint/parser": "^8.
|
|
88
|
-
"@vitest/coverage-v8": "^
|
|
89
|
-
"aws-cdk": "^2.
|
|
91
|
+
"@types/node": "^25.0.10",
|
|
92
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
93
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
94
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
95
|
+
"aws-cdk": "^2.1103.0",
|
|
90
96
|
"better-docs": "^2.7.3",
|
|
91
97
|
"codecov": "^3.8.3",
|
|
92
98
|
"commitizen": "^4.3.1",
|
|
@@ -96,25 +102,25 @@
|
|
|
96
102
|
"eslint": "^9.39.2",
|
|
97
103
|
"eslint-config-prettier": "^10.1.8",
|
|
98
104
|
"eslint-plugin-import": "^2.32.0",
|
|
99
|
-
"eslint-plugin-jsdoc": "^
|
|
105
|
+
"eslint-plugin-jsdoc": "^62.4.1",
|
|
100
106
|
"husky": "^9.1.7",
|
|
101
107
|
"jsdoc": "^4.0.5",
|
|
102
108
|
"jsdoc-babel": "^0.5.0",
|
|
103
109
|
"jsdoc-mermaid": "^1.0.0",
|
|
104
110
|
"jsdoc-plugin-typescript": "^3.2.0",
|
|
105
111
|
"jsdoc-to-markdown": "^9.1.3",
|
|
106
|
-
"prettier": "^3.
|
|
112
|
+
"prettier": "^3.8.1",
|
|
107
113
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
108
114
|
"rimraf": "^6.1.2",
|
|
109
|
-
"rollup": "^4.
|
|
115
|
+
"rollup": "^4.57.0",
|
|
110
116
|
"semantic-release": "^25.0.2",
|
|
111
117
|
"@semantic-release/changelog": "^6.0.3",
|
|
112
|
-
"@semantic-release/github": "^
|
|
113
|
-
"@semantic-release/npm": "^13.
|
|
118
|
+
"@semantic-release/github": "^12.0.2",
|
|
119
|
+
"@semantic-release/npm": "^13.1.3",
|
|
114
120
|
"taffydb": "^2.7.3",
|
|
115
121
|
"ts-node": "^10.9.2",
|
|
116
122
|
"typescript": "5.9.3",
|
|
117
|
-
"vitest": "^
|
|
123
|
+
"vitest": "^4.0.18",
|
|
118
124
|
"yaml": "^2.8.2"
|
|
119
125
|
},
|
|
120
126
|
"optionalDependencies": {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { AzurermProvider } from '@cdktf/provider-azurerm/lib/provider/index.js'
|
|
4
|
-
import { AzurermBackend, S3Backend, TerraformStack, TerraformVariable } from 'cdktf'
|
|
5
|
-
import { Construct } from 'constructs'
|
|
1
|
+
import { Provider as CloudflareProvider } from '@pulumi/cloudflare'
|
|
2
|
+
import { ComponentResource, ComponentResourceOptions, Config } from '@pulumi/pulumi'
|
|
6
3
|
import { isDevStage, isPrdStage, isTestStage, isUatStage } from '../../common/index.js'
|
|
7
4
|
import {
|
|
8
5
|
CloudflareAccessManager,
|
|
@@ -16,12 +13,13 @@ import {
|
|
|
16
13
|
CloudflareWorkerManager,
|
|
17
14
|
CloudflareZoneManager,
|
|
18
15
|
} from '../services/index.js'
|
|
19
|
-
import { RemoteBackend } from './constants.js'
|
|
20
16
|
import { CommonCloudflareStackProps } from './types.js'
|
|
21
17
|
|
|
22
|
-
export class CommonCloudflareConstruct extends
|
|
18
|
+
export class CommonCloudflareConstruct extends ComponentResource {
|
|
23
19
|
declare props: CommonCloudflareStackProps
|
|
20
|
+
declare options?: ComponentResourceOptions
|
|
24
21
|
id: string
|
|
22
|
+
config: Config
|
|
25
23
|
fullyQualifiedDomainName: string
|
|
26
24
|
accessManager: CloudflareAccessManager
|
|
27
25
|
apiShieldManager: CloudflareApiShieldManager
|
|
@@ -33,15 +31,13 @@ export class CommonCloudflareConstruct extends TerraformStack {
|
|
|
33
31
|
ruleSetManager: CloudflareRuleSetManager
|
|
34
32
|
workerManager: CloudflareWorkerManager
|
|
35
33
|
zoneManager: CloudflareZoneManager
|
|
36
|
-
|
|
37
|
-
s3Backend: S3Backend
|
|
38
|
-
azurermProvider: AzurermProvider
|
|
39
|
-
azurermBackend: AzurermBackend
|
|
34
|
+
provider: CloudflareProvider
|
|
40
35
|
|
|
41
|
-
constructor(
|
|
42
|
-
super(
|
|
36
|
+
constructor(name: string, props: CommonCloudflareStackProps, options?: ComponentResourceOptions) {
|
|
37
|
+
super(`custom:cloudflare:Construct:${name}`, name, props, options)
|
|
43
38
|
this.props = props
|
|
44
|
-
this.
|
|
39
|
+
this.options = options
|
|
40
|
+
this.id = name
|
|
45
41
|
|
|
46
42
|
this.accessManager = new CloudflareAccessManager()
|
|
47
43
|
this.apiShieldManager = new CloudflareApiShieldManager()
|
|
@@ -54,11 +50,10 @@ export class CommonCloudflareConstruct extends TerraformStack {
|
|
|
54
50
|
this.workerManager = new CloudflareWorkerManager()
|
|
55
51
|
this.zoneManager = new CloudflareZoneManager()
|
|
56
52
|
|
|
53
|
+
/* initialise config */
|
|
54
|
+
this.config = new Config()
|
|
57
55
|
this.determineFullyQualifiedDomain()
|
|
58
|
-
this.
|
|
59
|
-
this.determineApiToken()
|
|
60
|
-
this.determineRemoteBackend()
|
|
61
|
-
new CloudflareProvider(this, `${this.id}-provider`, this.props)
|
|
56
|
+
this.provider = new CloudflareProvider(`${this.id}-provider`, this.props, options)
|
|
62
57
|
}
|
|
63
58
|
|
|
64
59
|
/**
|
|
@@ -70,58 +65,6 @@ export class CommonCloudflareConstruct extends TerraformStack {
|
|
|
70
65
|
: this.props.domainName
|
|
71
66
|
}
|
|
72
67
|
|
|
73
|
-
/**
|
|
74
|
-
* @summary Determine the account id based on the cdktf.json context
|
|
75
|
-
*/
|
|
76
|
-
protected determineAccountId() {
|
|
77
|
-
this.props.accountId = new TerraformVariable(this, `accountId`, {}).stringValue
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @summary Determine the api token based on the cdktf.json context
|
|
82
|
-
*/
|
|
83
|
-
protected determineApiToken() {
|
|
84
|
-
this.props.apiToken = new TerraformVariable(this, `apiToken`, {}).stringValue
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
protected determineRemoteBackend() {
|
|
88
|
-
const debug = this.node.tryGetContext('debug')
|
|
89
|
-
|
|
90
|
-
switch (this.props.remoteBackend?.type) {
|
|
91
|
-
case RemoteBackend.s3:
|
|
92
|
-
this.awsProvider = new AwsProvider(this, `${this.id}-aws-provider`, {
|
|
93
|
-
profile: process.env.AWS_PROFILE,
|
|
94
|
-
region: this.props.remoteBackend.region,
|
|
95
|
-
})
|
|
96
|
-
this.s3Backend = new S3Backend(this, {
|
|
97
|
-
bucket: this.props.remoteBackend.bucketName,
|
|
98
|
-
dynamodbTable: this.props.remoteBackend.tableName,
|
|
99
|
-
key: `${this.id}`,
|
|
100
|
-
profile: process.env.AWS_PROFILE,
|
|
101
|
-
region: this.props.remoteBackend.region,
|
|
102
|
-
})
|
|
103
|
-
break
|
|
104
|
-
case RemoteBackend.azurerm:
|
|
105
|
-
this.azurermProvider = new AzurermProvider(this, `${this.id}-azurerm-provider`, {
|
|
106
|
-
features: [{}],
|
|
107
|
-
subscriptionId: this.props.remoteBackend.subscriptionId,
|
|
108
|
-
})
|
|
109
|
-
this.azurermBackend = new AzurermBackend(this, {
|
|
110
|
-
storageAccountName: this.props.remoteBackend.storageAccountName,
|
|
111
|
-
containerName: this.props.remoteBackend.containerName,
|
|
112
|
-
key: `${this.id}`,
|
|
113
|
-
subscriptionId: this.props.remoteBackend.subscriptionId,
|
|
114
|
-
resourceGroupName: this.props.remoteBackend.resourceGroupName,
|
|
115
|
-
})
|
|
116
|
-
break
|
|
117
|
-
case RemoteBackend.local:
|
|
118
|
-
if (debug) console.debug(`Using local backend for ${this.id}`)
|
|
119
|
-
break
|
|
120
|
-
default:
|
|
121
|
-
break
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
68
|
/**
|
|
126
69
|
* @summary Utility method to determine if the initialisation is in development (dev) stage
|
|
127
70
|
* This is determined by the stage property injected via cdk context
|