@gradientedge/cdk-utils 9.89.0 → 10.0.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 +7 -1
- 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,18 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { DataAzurermKeyVault } from '@cdktf/provider-azurerm/lib/data-azurerm-key-vault/index.js'
|
|
5
|
-
import { DataCloudflareZone } from '@cdktf/provider-cloudflare/lib/data-cloudflare-zone/index.js'
|
|
6
|
-
import { DnsRecord } from '@cdktf/provider-cloudflare/lib/dns-record/index.js'
|
|
7
|
-
import { PagesDomain } from '@cdktf/provider-cloudflare/lib/pages-domain/index.js'
|
|
1
|
+
import * as aws from '@pulumi/aws'
|
|
2
|
+
import * as azure from '@pulumi/azure-native'
|
|
3
|
+
import { DnsRecord, PagesDomain, PagesProject, Zone } from '@pulumi/cloudflare'
|
|
8
4
|
import {
|
|
9
|
-
PagesProject,
|
|
10
5
|
PagesProjectDeploymentConfigsPreviewEnvVars,
|
|
11
6
|
PagesProjectDeploymentConfigsProductionEnvVars,
|
|
12
|
-
} from '@
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import { Construct } from 'constructs'
|
|
7
|
+
} from '@pulumi/cloudflare/types/input.js'
|
|
8
|
+
import { ComponentResourceOptions } from '@pulumi/pulumi'
|
|
9
|
+
import * as std from '@pulumi/std'
|
|
16
10
|
import { CommonCloudflareConstruct } from '../../common/index.js'
|
|
17
11
|
import { CloudflarePagesStaticSiteProps } from './types.js'
|
|
18
12
|
|
|
@@ -38,16 +32,17 @@ export class CloudflarePagesStaticSite extends CommonCloudflareConstruct {
|
|
|
38
32
|
sitePagesCnameRecord: DnsRecord
|
|
39
33
|
sitePagesDomain: PagesDomain
|
|
40
34
|
sitePagesProject: PagesProject
|
|
41
|
-
siteZone:
|
|
35
|
+
siteZone: Zone
|
|
42
36
|
sitePagesEnvironmentVariables: { [key: string]: PagesProjectDeploymentConfigsProductionEnvVars }
|
|
43
37
|
sitePagesPreviewEnvironmentVariables: { [key: string]: PagesProjectDeploymentConfigsPreviewEnvVars }
|
|
44
38
|
sitePagesSecrets: { [key: string]: PagesProjectDeploymentConfigsProductionEnvVars }
|
|
45
39
|
sitePagesPreviewSecrets: { [key: string]: PagesProjectDeploymentConfigsPreviewEnvVars }
|
|
46
40
|
siteDeploymentDependsOn: any
|
|
47
41
|
|
|
48
|
-
constructor(
|
|
49
|
-
super(
|
|
42
|
+
constructor(id: string, props: CloudflarePagesStaticSiteProps, options?: ComponentResourceOptions) {
|
|
43
|
+
super(id, props)
|
|
50
44
|
this.props = props
|
|
45
|
+
this.options = options
|
|
51
46
|
this.id = id
|
|
52
47
|
}
|
|
53
48
|
|
|
@@ -116,14 +111,11 @@ export class CloudflarePagesStaticSite extends CommonCloudflareConstruct {
|
|
|
116
111
|
* @returns the secret value
|
|
117
112
|
*/
|
|
118
113
|
protected resolveSecretFromAWS(secretName: string, secretKey: string) {
|
|
119
|
-
if (
|
|
120
|
-
const secret =
|
|
121
|
-
const secretVersion =
|
|
122
|
-
provider: this.awsProvider,
|
|
123
|
-
secretId: secret.id,
|
|
124
|
-
})
|
|
114
|
+
if (this.config.require('secretsProvider') !== 'aws') return
|
|
115
|
+
const secret = aws.secretsmanager.getSecretOutput({ name: secretName })
|
|
116
|
+
const secretVersion = aws.secretsmanager.getSecretVersionOutput({ secretId: secret.id })
|
|
125
117
|
if (!secretVersion) throw new Error(`Unable to resolve secret:${secretName}`)
|
|
126
|
-
return
|
|
118
|
+
return std.jsondecodeOutput({ input: secretVersion.secretString })
|
|
127
119
|
}
|
|
128
120
|
|
|
129
121
|
/**
|
|
@@ -135,26 +127,14 @@ export class CloudflarePagesStaticSite extends CommonCloudflareConstruct {
|
|
|
135
127
|
* @returns the secret value
|
|
136
128
|
*/
|
|
137
129
|
protected resolveSecretFromAzure(resourceGroupName: string, keyVaultName: string, secretKey: string) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
provider: this.azurermProvider,
|
|
145
|
-
}
|
|
146
|
-
)
|
|
147
|
-
const secretValueData = new DataAzurermKeyVaultSecret(
|
|
148
|
-
this,
|
|
149
|
-
`${this.id}-${resourceGroupName}-${keyVaultName}-${secretKey}-secret`,
|
|
150
|
-
{
|
|
151
|
-
name: secretKey,
|
|
152
|
-
keyVaultId: keyVaultData.id,
|
|
153
|
-
provider: this.azurermProvider,
|
|
154
|
-
}
|
|
155
|
-
)
|
|
130
|
+
if (this.config.require('secretsProvider') !== 'azure') return
|
|
131
|
+
const secretValueData = azure.keyvault.getSecretOutput({
|
|
132
|
+
resourceGroupName,
|
|
133
|
+
secretName: secretKey,
|
|
134
|
+
vaultName: keyVaultName,
|
|
135
|
+
})
|
|
156
136
|
if (!secretValueData) throw new Error(`Unable to resolve secret:${secretKey}`)
|
|
157
|
-
return secretValueData.value
|
|
137
|
+
return secretValueData.properties?.value
|
|
158
138
|
}
|
|
159
139
|
|
|
160
140
|
/**
|
|
@@ -201,7 +181,7 @@ export class CloudflarePagesStaticSite extends CommonCloudflareConstruct {
|
|
|
201
181
|
branch: this.props.siteBranch ?? 'main',
|
|
202
182
|
directory: this.props.siteAssetDir,
|
|
203
183
|
message: this.props.siteDeployMessage,
|
|
204
|
-
projectName: this.sitePagesProject.name,
|
|
184
|
+
projectName: String(this.sitePagesProject.name),
|
|
205
185
|
dependsOn: this.siteDeploymentDependsOn,
|
|
206
186
|
})
|
|
207
187
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { AssetType, Fn, TerraformAsset } from 'cdktf'
|
|
9
|
-
import { Construct } from 'constructs'
|
|
1
|
+
import * as aws from '@pulumi/aws'
|
|
2
|
+
import * as azure from '@pulumi/azure-native'
|
|
3
|
+
import { Ruleset, WorkersCustomDomain, WorkersScript, Zone, ZoneSetting } from '@pulumi/cloudflare'
|
|
4
|
+
import { WorkersScriptBinding } from '@pulumi/cloudflare/types/input.js'
|
|
5
|
+
import { ComponentResourceOptions } from '@pulumi/pulumi'
|
|
6
|
+
import * as std from '@pulumi/std'
|
|
7
|
+
import fs from 'fs'
|
|
10
8
|
import { CommonCloudflareConstruct } from '../../common/index.js'
|
|
11
9
|
import { CloudflareWorkerSiteProps } from './types.js'
|
|
12
10
|
|
|
@@ -29,14 +27,18 @@ export class CloudflareWorkerSite extends CommonCloudflareConstruct {
|
|
|
29
27
|
declare props: CloudflareWorkerSiteProps
|
|
30
28
|
|
|
31
29
|
/* worker site resources */
|
|
32
|
-
siteZone:
|
|
30
|
+
siteZone: Zone
|
|
33
31
|
siteWorkerScript: WorkersScript
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
siteWorkerDomain: WorkersCustomDomain
|
|
33
|
+
siteRuleSet: Ruleset
|
|
34
|
+
siteZoneSetting: ZoneSetting
|
|
35
|
+
workerPlainTextBindingEnvironmentVariables: WorkersScriptBinding[] = []
|
|
36
|
+
workerSecretTextBindingEnvironmentVariables: WorkersScriptBinding[] = []
|
|
36
37
|
|
|
37
|
-
constructor(
|
|
38
|
-
super(
|
|
38
|
+
constructor(id: string, props: CloudflareWorkerSiteProps, options?: ComponentResourceOptions) {
|
|
39
|
+
super(id, props)
|
|
39
40
|
this.props = props
|
|
41
|
+
this.options = options
|
|
40
42
|
this.id = id
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -79,14 +81,10 @@ export class CloudflareWorkerSite extends CommonCloudflareConstruct {
|
|
|
79
81
|
* @summary Create the worker
|
|
80
82
|
*/
|
|
81
83
|
protected createWorker() {
|
|
82
|
-
const workerContent =
|
|
83
|
-
path: this.props.siteWorkerAsset,
|
|
84
|
-
type: AssetType.FILE,
|
|
85
|
-
})
|
|
86
|
-
|
|
84
|
+
const workerContent = fs.readFileSync(this.props.siteWorkerAsset, 'utf-8')
|
|
87
85
|
this.siteWorkerScript = this.workerManager.createWorkerScript(`${this.id}-worker-script`, this, {
|
|
88
86
|
...this.props.siteWorkerScript,
|
|
89
|
-
content:
|
|
87
|
+
content: workerContent,
|
|
90
88
|
})
|
|
91
89
|
}
|
|
92
90
|
|
|
@@ -94,7 +92,7 @@ export class CloudflareWorkerSite extends CommonCloudflareConstruct {
|
|
|
94
92
|
* @summary Create the worker domain
|
|
95
93
|
*/
|
|
96
94
|
protected createWorkerDomain() {
|
|
97
|
-
this.workerManager.createWorkerDomain(`${this.id}-worker-domain`, this, {
|
|
95
|
+
this.siteWorkerDomain = this.workerManager.createWorkerDomain(`${this.id}-worker-domain`, this, {
|
|
98
96
|
...this.props.siteWorkerDomain,
|
|
99
97
|
environment: this.props.siteWorkerDomain.environment ?? 'production',
|
|
100
98
|
hostname: `${this.props.siteSubDomain}.${this.props.domainName}`,
|
|
@@ -108,23 +106,12 @@ export class CloudflareWorkerSite extends CommonCloudflareConstruct {
|
|
|
108
106
|
* @param secretKey the secret key
|
|
109
107
|
* @returns the secret value
|
|
110
108
|
*/
|
|
111
|
-
protected resolveSecretFromAWS(secretName: string, secretKey: string
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
const secret = new DataAwsSecretsmanagerSecret(this, id ?? `${this.id}-${secretName}-${secretKey}`, {
|
|
116
|
-
name: secretName,
|
|
117
|
-
})
|
|
118
|
-
const secretVersion = new DataAwsSecretsmanagerSecretVersion(
|
|
119
|
-
this,
|
|
120
|
-
id ? `${id}-ver` : `${this.id}-${secretName}-${secretKey}-ver`,
|
|
121
|
-
{
|
|
122
|
-
provider: this.awsProvider,
|
|
123
|
-
secretId: secret.id,
|
|
124
|
-
}
|
|
125
|
-
)
|
|
109
|
+
protected resolveSecretFromAWS(secretName: string, secretKey: string) {
|
|
110
|
+
if (this.config.require('secretsProvider') !== 'aws') return
|
|
111
|
+
const secret = aws.secretsmanager.getSecretOutput({ name: secretName })
|
|
112
|
+
const secretVersion = aws.secretsmanager.getSecretVersionOutput({ secretId: secret.id })
|
|
126
113
|
if (!secretVersion) throw new Error(`Unable to resolve secret:${secretName}`)
|
|
127
|
-
return
|
|
114
|
+
return std.jsondecodeOutput({ input: secretVersion.secretString })
|
|
128
115
|
}
|
|
129
116
|
|
|
130
117
|
/**
|
|
@@ -135,30 +122,15 @@ export class CloudflareWorkerSite extends CommonCloudflareConstruct {
|
|
|
135
122
|
* @param secretKey the secret key
|
|
136
123
|
* @returns the secret value
|
|
137
124
|
*/
|
|
138
|
-
protected resolveSecretFromAzure(resourceGroupName: string, keyVaultName: string, secretKey: string
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
{
|
|
146
|
-
resourceGroupName: resourceGroupName,
|
|
147
|
-
name: keyVaultName,
|
|
148
|
-
provider: this.azurermProvider,
|
|
149
|
-
}
|
|
150
|
-
)
|
|
151
|
-
const secretValueData = new DataAzurermKeyVaultSecret(
|
|
152
|
-
this,
|
|
153
|
-
id ? `${id}-secret` : `${this.id}-${resourceGroupName}-${keyVaultName}-${secretKey}-secret`,
|
|
154
|
-
{
|
|
155
|
-
name: secretKey,
|
|
156
|
-
keyVaultId: keyVaultData.id,
|
|
157
|
-
provider: this.azurermProvider,
|
|
158
|
-
}
|
|
159
|
-
)
|
|
125
|
+
protected resolveSecretFromAzure(resourceGroupName: string, keyVaultName: string, secretKey: string) {
|
|
126
|
+
if (this.config.require('secretsProvider') !== 'azure') return
|
|
127
|
+
const secretValueData = azure.keyvault.getSecretOutput({
|
|
128
|
+
resourceGroupName,
|
|
129
|
+
secretName: secretKey,
|
|
130
|
+
vaultName: keyVaultName,
|
|
131
|
+
})
|
|
160
132
|
if (!secretValueData) throw new Error(`Unable to resolve secret:${secretKey}`)
|
|
161
|
-
return secretValueData.value
|
|
133
|
+
return secretValueData.properties?.value
|
|
162
134
|
}
|
|
163
135
|
|
|
164
136
|
/**
|
|
@@ -166,7 +138,7 @@ export class CloudflareWorkerSite extends CommonCloudflareConstruct {
|
|
|
166
138
|
*/
|
|
167
139
|
protected createRuleset() {
|
|
168
140
|
if (!this.props.siteRuleSet) return
|
|
169
|
-
this.ruleSetManager.createRuleSet(`${this.id}-rule`, this, this.props.siteRuleSet)
|
|
141
|
+
this.siteRuleSet = this.ruleSetManager.createRuleSet(`${this.id}-rule`, this, this.props.siteRuleSet)
|
|
170
142
|
}
|
|
171
143
|
|
|
172
144
|
/**
|
|
@@ -174,6 +146,10 @@ export class CloudflareWorkerSite extends CommonCloudflareConstruct {
|
|
|
174
146
|
*/
|
|
175
147
|
protected createZoneSetting() {
|
|
176
148
|
if (!this.props.siteZoneSetting) return
|
|
177
|
-
this.
|
|
149
|
+
this.siteZoneSetting = this.zoneManager.createZoneSetting(
|
|
150
|
+
`${this.id}-zone-setting`,
|
|
151
|
+
this,
|
|
152
|
+
this.props.siteZoneSetting
|
|
153
|
+
)
|
|
178
154
|
}
|
|
179
155
|
}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { ZeroTrustAccessCustomPage } from '@cdktf/provider-cloudflare/lib/zero-trust-access-custom-page/index.js'
|
|
4
|
-
import { ZeroTrustAccessGroup } from '@cdktf/provider-cloudflare/lib/zero-trust-access-group/index.js'
|
|
5
|
-
import { ZeroTrustAccessIdentityProvider } from '@cdktf/provider-cloudflare/lib/zero-trust-access-identity-provider/index.js'
|
|
6
|
-
import { ZeroTrustAccessMtlsCertificate } from '@cdktf/provider-cloudflare/lib/zero-trust-access-mtls-certificate/index.js'
|
|
7
|
-
import { ZeroTrustAccessPolicy } from '@cdktf/provider-cloudflare/lib/zero-trust-access-policy/index.js'
|
|
8
|
-
import { ZeroTrustAccessServiceToken } from '@cdktf/provider-cloudflare/lib/zero-trust-access-service-token/index.js'
|
|
9
|
-
import { ZeroTrustAccessShortLivedCertificate } from '@cdktf/provider-cloudflare/lib/zero-trust-access-short-lived-certificate/index.js'
|
|
10
|
-
import { ZeroTrustAccessTag } from '@cdktf/provider-cloudflare/lib/zero-trust-access-tag/index.js'
|
|
11
|
-
import { ZeroTrustOrganization } from '@cdktf/provider-cloudflare/lib/zero-trust-organization/index.js'
|
|
12
|
-
import { CommonCloudflareConstruct } from '../../common/index.js'
|
|
13
|
-
import { createCloudflareTfOutput } from '../../utils/index.js'
|
|
1
|
+
import * as cloudflare from '@pulumi/cloudflare'
|
|
2
|
+
import { CommonCloudflareConstruct } from '../../common/construct.js'
|
|
14
3
|
import {
|
|
15
4
|
AccessRuleProps,
|
|
16
5
|
ZeroTrustAccessApplicationProps,
|
|
@@ -27,17 +16,16 @@ import {
|
|
|
27
16
|
|
|
28
17
|
/**
|
|
29
18
|
* @classdesc Provides operations on Cloudflare Access
|
|
30
|
-
* - A new instance of this class is injected into {@link
|
|
31
|
-
* - If a custom
|
|
19
|
+
* - A new instance of this class is injected into {@link CommonCloudflareComponent} constructor.
|
|
20
|
+
* - If a custom component extends {@link CommonCloudflareComponent}, an instance is available within the context.
|
|
32
21
|
* @example
|
|
33
22
|
* ```
|
|
34
|
-
* import {
|
|
23
|
+
* import { CommonCloudflareComponent, CloudflareAccessManager } from '@gradientedge/cdk-utils'
|
|
35
24
|
*
|
|
36
|
-
* class
|
|
37
|
-
* constructor(
|
|
38
|
-
* super(
|
|
39
|
-
* this.
|
|
40
|
-
* this.accessManager.createApiShield('MyAppAccess', this, props)
|
|
25
|
+
* class CustomComponent extends CommonCloudflareComponent {
|
|
26
|
+
* constructor(name: string, args: any, opts?: pulumi.ComponentResourceOptions) {
|
|
27
|
+
* super(name, args, opts)
|
|
28
|
+
* this.accessManager.createAccessApplication('MyAppAccess', this, props)
|
|
41
29
|
* }
|
|
42
30
|
* }
|
|
43
31
|
* ```
|
|
@@ -48,34 +36,31 @@ export class CloudflareAccessManager {
|
|
|
48
36
|
* @param id scoped id of the resource
|
|
49
37
|
* @param scope scope in which this resource is defined
|
|
50
38
|
* @param props access application properties
|
|
51
|
-
* @see [
|
|
39
|
+
* @see [Pulumi Cloudflare Access Application]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustaccessapplication/}
|
|
52
40
|
*/
|
|
53
41
|
public createAccessApplication(id: string, scope: CommonCloudflareConstruct, props: ZeroTrustAccessApplicationProps) {
|
|
54
42
|
if (!props) throw `Props undefined for ${id}`
|
|
55
43
|
|
|
56
44
|
const zoneId = props.zoneId
|
|
57
45
|
? props.zoneId
|
|
58
|
-
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
46
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
47
|
+
filter: { name: scope.props.domainName },
|
|
48
|
+
})?.id
|
|
59
49
|
|
|
60
|
-
|
|
50
|
+
return new cloudflare.ZeroTrustAccessApplication(`${id}`, {
|
|
61
51
|
...props,
|
|
62
52
|
domain: `${props.domain}-${scope.props.domainName}`,
|
|
63
53
|
name: `${props.name}-${scope.props.stage}`,
|
|
64
54
|
zoneId,
|
|
65
55
|
})
|
|
66
|
-
|
|
67
|
-
createCloudflareTfOutput(`${id}-accessApplicationFriendlyUniqueId`, scope, accessApplication.friendlyUniqueId)
|
|
68
|
-
createCloudflareTfOutput(`${id}-accessApplicationId`, scope, accessApplication.id)
|
|
69
|
-
|
|
70
|
-
return accessApplication
|
|
71
56
|
}
|
|
72
57
|
|
|
73
58
|
/**
|
|
74
59
|
* @summary Method to create a new Cloudflare Application Access Short Lived Certificate
|
|
75
60
|
* @param id scoped id of the resource
|
|
76
61
|
* @param scope scope in which this resource is defined
|
|
77
|
-
* @param props access short lived
|
|
78
|
-
* @see [
|
|
62
|
+
* @param props access short lived certificate properties
|
|
63
|
+
* @see [Pulumi Cloudflare Access Short Lived Certificate]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustaccessshortlivedcertificate/}
|
|
79
64
|
*/
|
|
80
65
|
public createAccessShortLivedCertificate(
|
|
81
66
|
id: string,
|
|
@@ -86,21 +71,14 @@ export class CloudflareAccessManager {
|
|
|
86
71
|
|
|
87
72
|
const zoneId = props.zoneId
|
|
88
73
|
? props.zoneId
|
|
89
|
-
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
74
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
75
|
+
filter: { name: scope.props.domainName },
|
|
76
|
+
})?.id
|
|
90
77
|
|
|
91
|
-
|
|
78
|
+
return new cloudflare.ZeroTrustAccessShortLivedCertificate(`${id}`, {
|
|
92
79
|
...props,
|
|
93
80
|
zoneId,
|
|
94
81
|
})
|
|
95
|
-
|
|
96
|
-
createCloudflareTfOutput(
|
|
97
|
-
`${id}-accessShortLivedCertificateFriendlyUniqueId`,
|
|
98
|
-
scope,
|
|
99
|
-
accessShortLivedCertificate.friendlyUniqueId
|
|
100
|
-
)
|
|
101
|
-
createCloudflareTfOutput(`${id}-accessShortLivedCertificateId`, scope, accessShortLivedCertificate.id)
|
|
102
|
-
|
|
103
|
-
return accessShortLivedCertificate
|
|
104
82
|
}
|
|
105
83
|
|
|
106
84
|
/**
|
|
@@ -108,21 +86,16 @@ export class CloudflareAccessManager {
|
|
|
108
86
|
* @param id scoped id of the resource
|
|
109
87
|
* @param scope scope in which this resource is defined
|
|
110
88
|
* @param props access custom page properties
|
|
111
|
-
* @see [
|
|
89
|
+
* @see [Pulumi Cloudflare Access Custom Page]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustaccesscustompage/}
|
|
112
90
|
*/
|
|
113
91
|
public createAccessCustomPage(id: string, scope: CommonCloudflareConstruct, props: ZeroTrustAccessCustomPageProps) {
|
|
114
92
|
if (!props) throw `Props undefined for ${id}`
|
|
115
93
|
|
|
116
|
-
|
|
94
|
+
return new cloudflare.ZeroTrustAccessCustomPage(`${id}`, {
|
|
117
95
|
...props,
|
|
118
96
|
accountId: props.accountId ?? scope.props.accountId,
|
|
119
97
|
name: `${props.name}-${scope.props.stage}`,
|
|
120
98
|
})
|
|
121
|
-
|
|
122
|
-
createCloudflareTfOutput(`${id}-accessCustomPageFriendlyUniqueId`, scope, accessCustomPage.friendlyUniqueId)
|
|
123
|
-
createCloudflareTfOutput(`${id}-accessCustomPageId`, scope, accessCustomPage.id)
|
|
124
|
-
|
|
125
|
-
return accessCustomPage
|
|
126
99
|
}
|
|
127
100
|
|
|
128
101
|
/**
|
|
@@ -130,25 +103,22 @@ export class CloudflareAccessManager {
|
|
|
130
103
|
* @param id scoped id of the resource
|
|
131
104
|
* @param scope scope in which this resource is defined
|
|
132
105
|
* @param props access group properties
|
|
133
|
-
* @see [
|
|
106
|
+
* @see [Pulumi Cloudflare Access Group]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustaccessgroup/}
|
|
134
107
|
*/
|
|
135
108
|
public createAccessGroup(id: string, scope: CommonCloudflareConstruct, props: ZeroTrustAccessGroupProps) {
|
|
136
109
|
if (!props) throw `Props undefined for ${id}`
|
|
137
110
|
|
|
138
111
|
const zoneId = props.zoneId
|
|
139
112
|
? props.zoneId
|
|
140
|
-
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
113
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
114
|
+
filter: { name: scope.props.domainName },
|
|
115
|
+
})?.id
|
|
141
116
|
|
|
142
|
-
|
|
117
|
+
return new cloudflare.ZeroTrustAccessGroup(`${id}`, {
|
|
143
118
|
...props,
|
|
144
119
|
name: `${props.name} - ${scope.props.stage.toUpperCase()}`,
|
|
145
120
|
zoneId,
|
|
146
121
|
})
|
|
147
|
-
|
|
148
|
-
createCloudflareTfOutput(`${id}-accessGroupFriendlyUniqueId`, scope, accessGroup.friendlyUniqueId)
|
|
149
|
-
createCloudflareTfOutput(`${id}-accessGroupId`, scope, accessGroup.id)
|
|
150
|
-
|
|
151
|
-
return accessGroup
|
|
152
122
|
}
|
|
153
123
|
|
|
154
124
|
/**
|
|
@@ -156,7 +126,7 @@ export class CloudflareAccessManager {
|
|
|
156
126
|
* @param id scoped id of the resource
|
|
157
127
|
* @param scope scope in which this resource is defined
|
|
158
128
|
* @param props access identity provider properties
|
|
159
|
-
* @see [
|
|
129
|
+
* @see [Pulumi Cloudflare Access Identity Provider]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustaccessidentityprovider/}
|
|
160
130
|
*/
|
|
161
131
|
public createAccessIdentityProvider(
|
|
162
132
|
id: string,
|
|
@@ -167,22 +137,16 @@ export class CloudflareAccessManager {
|
|
|
167
137
|
|
|
168
138
|
const zoneId = props.zoneId
|
|
169
139
|
? props.zoneId
|
|
170
|
-
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
140
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
141
|
+
filter: { name: scope.props.domainName },
|
|
142
|
+
})?.id
|
|
171
143
|
|
|
172
|
-
|
|
144
|
+
return new cloudflare.ZeroTrustAccessIdentityProvider(`${id}`, {
|
|
173
145
|
...props,
|
|
146
|
+
config: props.config ?? {},
|
|
174
147
|
name: `${props.name}-${scope.props.stage}`,
|
|
175
148
|
zoneId,
|
|
176
149
|
})
|
|
177
|
-
|
|
178
|
-
createCloudflareTfOutput(
|
|
179
|
-
`${id}-accessIdentityProviderFriendlyUniqueId`,
|
|
180
|
-
scope,
|
|
181
|
-
accessIdentityProvider.friendlyUniqueId
|
|
182
|
-
)
|
|
183
|
-
createCloudflareTfOutput(`${id}-accessIdentityProviderId`, scope, accessIdentityProvider.id)
|
|
184
|
-
|
|
185
|
-
return accessIdentityProvider
|
|
186
150
|
}
|
|
187
151
|
|
|
188
152
|
/**
|
|
@@ -190,7 +154,7 @@ export class CloudflareAccessManager {
|
|
|
190
154
|
* @param id scoped id of the resource
|
|
191
155
|
* @param scope scope in which this resource is defined
|
|
192
156
|
* @param props access mutual tls certificate properties
|
|
193
|
-
* @see [
|
|
157
|
+
* @see [Pulumi Cloudflare Access Mutual Tls Certificate]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustaccessmtlscertificate/}
|
|
194
158
|
*/
|
|
195
159
|
public createAccessMutualTlsCertificate(
|
|
196
160
|
id: string,
|
|
@@ -201,22 +165,15 @@ export class CloudflareAccessManager {
|
|
|
201
165
|
|
|
202
166
|
const zoneId = props.zoneId
|
|
203
167
|
? props.zoneId
|
|
204
|
-
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
168
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
169
|
+
filter: { name: scope.props.domainName },
|
|
170
|
+
})?.id
|
|
205
171
|
|
|
206
|
-
|
|
172
|
+
return new cloudflare.ZeroTrustAccessMtlsCertificate(`${id}`, {
|
|
207
173
|
...props,
|
|
208
174
|
name: `${props.name}-${scope.props.stage}`,
|
|
209
175
|
zoneId,
|
|
210
176
|
})
|
|
211
|
-
|
|
212
|
-
createCloudflareTfOutput(
|
|
213
|
-
`${id}-accessMutualTlsCertificateFriendlyUniqueId`,
|
|
214
|
-
scope,
|
|
215
|
-
accessMutualTlsCertificate.friendlyUniqueId
|
|
216
|
-
)
|
|
217
|
-
createCloudflareTfOutput(`${id}-accessMutualTlsCertificateId`, scope, accessMutualTlsCertificate.id)
|
|
218
|
-
|
|
219
|
-
return accessMutualTlsCertificate
|
|
220
177
|
}
|
|
221
178
|
|
|
222
179
|
/**
|
|
@@ -224,24 +181,22 @@ export class CloudflareAccessManager {
|
|
|
224
181
|
* @param id scoped id of the resource
|
|
225
182
|
* @param scope scope in which this resource is defined
|
|
226
183
|
* @param props access organisation properties
|
|
227
|
-
* @see [
|
|
184
|
+
* @see [Pulumi Cloudflare Zero Trust Organization]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustorganization/}
|
|
228
185
|
*/
|
|
229
186
|
public createAccessOrganization(id: string, scope: CommonCloudflareConstruct, props: ZeroTrustOrganizationProps) {
|
|
230
187
|
if (!props) throw `Props undefined for ${id}`
|
|
231
188
|
|
|
232
189
|
const zoneId = props.zoneId
|
|
233
190
|
? props.zoneId
|
|
234
|
-
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
191
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
192
|
+
filter: { name: scope.props.domainName },
|
|
193
|
+
})?.id
|
|
235
194
|
|
|
236
|
-
|
|
195
|
+
return new cloudflare.ZeroTrustOrganization(`${id}`, {
|
|
237
196
|
...props,
|
|
238
197
|
name: `${props.name}-${scope.props.stage}`,
|
|
239
198
|
zoneId,
|
|
240
199
|
})
|
|
241
|
-
|
|
242
|
-
createCloudflareTfOutput(`${id}-accessOrganizationFriendlyUniqueId`, scope, accessOrganization.friendlyUniqueId)
|
|
243
|
-
|
|
244
|
-
return accessOrganization
|
|
245
200
|
}
|
|
246
201
|
|
|
247
202
|
/**
|
|
@@ -249,21 +204,16 @@ export class CloudflareAccessManager {
|
|
|
249
204
|
* @param id scoped id of the resource
|
|
250
205
|
* @param scope scope in which this resource is defined
|
|
251
206
|
* @param props access policy properties
|
|
252
|
-
* @see [
|
|
207
|
+
* @see [Pulumi Cloudflare Access Policy]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustaccesspolicy/}
|
|
253
208
|
*/
|
|
254
209
|
public createAccessPolicy(id: string, scope: CommonCloudflareConstruct, props: ZeroTrustAccessPolicyProps) {
|
|
255
210
|
if (!props) throw `Props undefined for ${id}`
|
|
256
211
|
|
|
257
|
-
|
|
212
|
+
return new cloudflare.ZeroTrustAccessPolicy(`${id}`, {
|
|
258
213
|
...props,
|
|
259
214
|
name: `${props.name}-${scope.props.stage}`,
|
|
260
215
|
accountId: props.accountId ?? scope.props.accountId,
|
|
261
216
|
})
|
|
262
|
-
|
|
263
|
-
createCloudflareTfOutput(`${id}-accessPolicyFriendlyUniqueId`, scope, accessPolicy.friendlyUniqueId)
|
|
264
|
-
createCloudflareTfOutput(`${id}-accessPolicyId`, scope, accessPolicy.id)
|
|
265
|
-
|
|
266
|
-
return accessPolicy
|
|
267
217
|
}
|
|
268
218
|
|
|
269
219
|
/**
|
|
@@ -271,25 +221,22 @@ export class CloudflareAccessManager {
|
|
|
271
221
|
* @param id scoped id of the resource
|
|
272
222
|
* @param scope scope in which this resource is defined
|
|
273
223
|
* @param props access rule properties
|
|
274
|
-
* @see [
|
|
224
|
+
* @see [Pulumi Cloudflare Access Rule]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/accessrule/}
|
|
275
225
|
*/
|
|
276
226
|
public createAccessRule(id: string, scope: CommonCloudflareConstruct, props: AccessRuleProps) {
|
|
277
227
|
if (!props) throw `Props undefined for ${id}`
|
|
278
228
|
|
|
279
229
|
const zoneId = props.zoneId
|
|
280
230
|
? props.zoneId
|
|
281
|
-
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
231
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
232
|
+
filter: { name: scope.props.domainName },
|
|
233
|
+
})?.id
|
|
282
234
|
|
|
283
|
-
|
|
235
|
+
return new cloudflare.AccessRule(`${id}`, {
|
|
284
236
|
...props,
|
|
285
237
|
zoneId,
|
|
286
238
|
accountId: props.accountId ?? scope.props.accountId,
|
|
287
239
|
})
|
|
288
|
-
|
|
289
|
-
createCloudflareTfOutput(`${id}-accessRuleFriendlyUniqueId`, scope, accessRule.friendlyUniqueId)
|
|
290
|
-
createCloudflareTfOutput(`${id}-accessRuleId`, scope, accessRule.id)
|
|
291
|
-
|
|
292
|
-
return accessRule
|
|
293
240
|
}
|
|
294
241
|
|
|
295
242
|
/**
|
|
@@ -297,7 +244,7 @@ export class CloudflareAccessManager {
|
|
|
297
244
|
* @param id scoped id of the resource
|
|
298
245
|
* @param scope scope in which this resource is defined
|
|
299
246
|
* @param props access service token properties
|
|
300
|
-
* @see [
|
|
247
|
+
* @see [Pulumi Cloudflare Access Service Token]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustaccessservicetoken/}
|
|
301
248
|
*/
|
|
302
249
|
public createAccessServiceToken(
|
|
303
250
|
id: string,
|
|
@@ -308,19 +255,16 @@ export class CloudflareAccessManager {
|
|
|
308
255
|
|
|
309
256
|
const zoneId = props.zoneId
|
|
310
257
|
? props.zoneId
|
|
311
|
-
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
258
|
+
: scope.zoneManager.resolveZone(`${id}-data-zone`, scope, {
|
|
259
|
+
filter: { name: scope.props.domainName },
|
|
260
|
+
})?.id
|
|
312
261
|
|
|
313
|
-
|
|
262
|
+
return new cloudflare.ZeroTrustAccessServiceToken(`${id}`, {
|
|
314
263
|
...props,
|
|
315
264
|
name: `${props.name}-${scope.props.stage}`,
|
|
316
265
|
accountId: props.accountId ?? scope.props.accountId,
|
|
317
266
|
zoneId,
|
|
318
267
|
})
|
|
319
|
-
|
|
320
|
-
createCloudflareTfOutput(`${id}-accessServiceTokenFriendlyUniqueId`, scope, accessServiceToken.friendlyUniqueId)
|
|
321
|
-
createCloudflareTfOutput(`${id}-accessServiceTokenId`, scope, accessServiceToken.id)
|
|
322
|
-
|
|
323
|
-
return accessServiceToken
|
|
324
268
|
}
|
|
325
269
|
|
|
326
270
|
/**
|
|
@@ -328,20 +272,15 @@ export class CloudflareAccessManager {
|
|
|
328
272
|
* @param id scoped id of the resource
|
|
329
273
|
* @param scope scope in which this resource is defined
|
|
330
274
|
* @param props access tag properties
|
|
331
|
-
* @see [
|
|
275
|
+
* @see [Pulumi Cloudflare Access Tag]{@link https://www.pulumi.com/registry/packages/cloudflare/api-docs/zerotrustaccesstag/}
|
|
332
276
|
*/
|
|
333
277
|
public createAccessTag(id: string, scope: CommonCloudflareConstruct, props: ZeroTrustAccessTagProps) {
|
|
334
278
|
if (!props) throw `Props undefined for ${id}`
|
|
335
279
|
|
|
336
|
-
|
|
280
|
+
return new cloudflare.ZeroTrustAccessTag(`${id}`, {
|
|
337
281
|
...props,
|
|
338
282
|
name: `${props.name}-${scope.props.stage}`,
|
|
339
283
|
accountId: props.accountId ?? scope.props.accountId,
|
|
340
284
|
})
|
|
341
|
-
|
|
342
|
-
createCloudflareTfOutput(`${id}-accessTagFriendlyUniqueId`, scope, accessTag.friendlyUniqueId)
|
|
343
|
-
createCloudflareTfOutput(`${id}-accessTagId`, scope, accessTag.id)
|
|
344
|
-
|
|
345
|
-
return accessTag
|
|
346
285
|
}
|
|
347
286
|
}
|