@gradientedge/cdk-utils 10.1.0 → 10.3.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 +3 -2
- package/dist/src/lib/azure/common/constants.js +2 -1
- package/dist/src/lib/azure/common/construct.d.ts +26 -12
- package/dist/src/lib/azure/common/construct.js +31 -45
- package/dist/src/lib/azure/common/resource-name-formatter.d.ts +9 -4
- package/dist/src/lib/azure/common/resource-name-formatter.js +9 -5
- package/dist/src/lib/azure/common/stack.d.ts +18 -32
- package/dist/src/lib/azure/common/stack.js +77 -74
- package/dist/src/lib/azure/common/tagging.d.ts +29 -8
- package/dist/src/lib/azure/common/tagging.js +72 -26
- package/dist/src/lib/azure/common/types.d.ts +19 -4
- package/dist/src/lib/azure/services/api-management/main.d.ts +29 -32
- package/dist/src/lib/azure/services/api-management/main.js +100 -121
- package/dist/src/lib/azure/services/api-management/types.d.ts +33 -18
- package/dist/src/lib/azure/services/app-configuration/main.d.ts +6 -7
- package/dist/src/lib/azure/services/app-configuration/main.js +23 -26
- package/dist/src/lib/azure/services/app-configuration/types.d.ts +2 -2
- package/dist/src/lib/azure/services/app-service/main.d.ts +10 -12
- package/dist/src/lib/azure/services/app-service/main.js +37 -49
- package/dist/src/lib/azure/services/app-service/types.d.ts +4 -4
- package/dist/src/lib/azure/services/application-insights/main.d.ts +7 -8
- package/dist/src/lib/azure/services/application-insights/main.js +20 -26
- package/dist/src/lib/azure/services/application-insights/types.d.ts +2 -4
- package/dist/src/lib/azure/services/cosmosdb/main.d.ts +12 -15
- package/dist/src/lib/azure/services/cosmosdb/main.js +42 -61
- package/dist/src/lib/azure/services/cosmosdb/types.d.ts +4 -6
- package/dist/src/lib/azure/services/dns/main.d.ts +13 -17
- package/dist/src/lib/azure/services/dns/main.js +33 -51
- package/dist/src/lib/azure/services/dns/types.d.ts +5 -8
- package/dist/src/lib/azure/services/eventgrid/main.d.ts +20 -22
- package/dist/src/lib/azure/services/eventgrid/main.js +61 -89
- package/dist/src/lib/azure/services/eventgrid/types.d.ts +7 -8
- package/dist/src/lib/azure/services/function/main.d.ts +15 -15
- package/dist/src/lib/azure/services/function/main.js +54 -59
- package/dist/src/lib/azure/services/function/types.d.ts +18 -6
- package/dist/src/lib/azure/services/index.d.ts +1 -1
- package/dist/src/lib/azure/services/index.js +1 -1
- package/dist/src/lib/azure/services/key-vault/main.d.ts +6 -7
- package/dist/src/lib/azure/services/key-vault/main.js +29 -28
- package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
- package/dist/src/lib/azure/services/monitor/main.d.ts +7 -8
- package/dist/src/lib/azure/services/monitor/main.js +10 -15
- package/dist/src/lib/azure/services/monitor/types.d.ts +2 -2
- package/dist/src/lib/azure/services/operational-insights/main.d.ts +29 -0
- package/dist/src/lib/azure/services/operational-insights/main.js +50 -0
- package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -0
- package/dist/src/lib/azure/services/redis/main.d.ts +8 -9
- package/dist/src/lib/azure/services/redis/main.js +24 -26
- package/dist/src/lib/azure/services/redis/types.d.ts +2 -2
- package/dist/src/lib/azure/services/resource-group/main.d.ts +6 -7
- package/dist/src/lib/azure/services/resource-group/main.js +9 -14
- package/dist/src/lib/azure/services/resource-group/types.d.ts +2 -2
- package/dist/src/lib/azure/services/servicebus/main.d.ts +17 -22
- package/dist/src/lib/azure/services/servicebus/main.js +47 -70
- package/dist/src/lib/azure/services/servicebus/types.d.ts +6 -10
- package/dist/src/lib/azure/services/storage/main.d.ts +24 -27
- package/dist/src/lib/azure/services/storage/main.js +70 -88
- package/dist/src/lib/azure/services/storage/types.d.ts +10 -8
- package/dist/src/lib/azure/types/index.d.ts +2 -1
- package/dist/src/lib/azure/utils/index.d.ts +19 -3
- package/dist/src/lib/azure/utils/index.js +19 -13
- package/dist/src/lib/cloudflare/common/stack.js +1 -1
- package/dist/src/lib/cloudflare/services/access/main.js +23 -23
- package/dist/src/lib/cloudflare/services/api-shield/main.js +11 -11
- package/dist/src/lib/cloudflare/services/argo/main.js +5 -5
- package/dist/src/lib/cloudflare/services/filter/main.js +3 -3
- package/dist/src/lib/cloudflare/services/firewall/main.js +3 -3
- package/dist/src/lib/cloudflare/services/page/main.js +7 -7
- package/dist/src/lib/cloudflare/services/record/main.js +3 -3
- package/dist/src/lib/cloudflare/services/rule-set/main.d.ts +1 -1
- package/dist/src/lib/cloudflare/services/rule-set/main.js +4 -5
- package/dist/src/lib/cloudflare/services/worker/main.js +13 -13
- package/dist/src/lib/cloudflare/services/zone/main.js +18 -18
- package/package.json +2 -1
- package/src/lib/azure/common/constants.ts +2 -1
- package/src/lib/azure/common/construct.ts +32 -48
- package/src/lib/azure/common/resource-name-formatter.ts +10 -6
- package/src/lib/azure/common/stack.ts +78 -78
- package/src/lib/azure/common/tagging.ts +78 -29
- package/src/lib/azure/common/types.ts +21 -4
- package/src/lib/azure/services/api-management/main.ts +172 -169
- package/src/lib/azure/services/api-management/types.ts +39 -16
- package/src/lib/azure/services/app-configuration/main.ts +33 -31
- package/src/lib/azure/services/app-configuration/types.ts +2 -2
- package/src/lib/azure/services/app-service/main.ts +61 -62
- package/src/lib/azure/services/app-service/types.ts +4 -4
- package/src/lib/azure/services/application-insights/main.ts +29 -30
- package/src/lib/azure/services/application-insights/types.ts +2 -5
- package/src/lib/azure/services/cosmosdb/main.ts +78 -77
- package/src/lib/azure/services/cosmosdb/types.ts +10 -6
- package/src/lib/azure/services/dns/main.ts +65 -72
- package/src/lib/azure/services/dns/types.ts +9 -9
- package/src/lib/azure/services/eventgrid/main.ts +120 -122
- package/src/lib/azure/services/eventgrid/types.ts +13 -8
- package/src/lib/azure/services/function/main.ts +75 -72
- package/src/lib/azure/services/function/types.ts +21 -6
- package/src/lib/azure/services/index.ts +1 -1
- package/src/lib/azure/services/key-vault/main.ts +38 -32
- package/src/lib/azure/services/key-vault/types.ts +4 -2
- package/src/lib/azure/services/monitor/main.ts +17 -21
- package/src/lib/azure/services/monitor/types.ts +2 -2
- package/src/lib/azure/services/operational-insights/main.ts +61 -0
- package/src/lib/azure/services/operational-insights/types.ts +3 -0
- package/src/lib/azure/services/redis/main.ts +30 -30
- package/src/lib/azure/services/redis/types.ts +2 -2
- package/src/lib/azure/services/resource-group/main.ts +20 -20
- package/src/lib/azure/services/resource-group/types.ts +2 -2
- package/src/lib/azure/services/servicebus/main.ts +103 -94
- package/src/lib/azure/services/servicebus/types.ts +17 -11
- package/src/lib/azure/services/storage/main.ts +113 -114
- package/src/lib/azure/services/storage/types.ts +16 -8
- package/src/lib/azure/types/index.ts +2 -1
- package/src/lib/azure/utils/index.ts +20 -22
- package/src/lib/cloudflare/common/stack.ts +1 -1
- package/src/lib/cloudflare/services/access/main.ts +114 -58
- package/src/lib/cloudflare/services/api-shield/main.ts +48 -22
- package/src/lib/cloudflare/services/argo/main.ts +17 -9
- package/src/lib/cloudflare/services/filter/main.ts +9 -5
- package/src/lib/cloudflare/services/firewall/main.ts +9 -5
- package/src/lib/cloudflare/services/page/main.ts +27 -15
- package/src/lib/cloudflare/services/record/main.ts +9 -5
- package/src/lib/cloudflare/services/rule-set/main.ts +10 -8
- package/src/lib/cloudflare/services/worker/main.ts +60 -29
- package/src/lib/cloudflare/services/zone/main.ts +75 -35
- package/dist/src/lib/azure/services/log-analytics-workspace/main.d.ts +0 -30
- package/dist/src/lib/azure/services/log-analytics-workspace/main.js +0 -55
- package/dist/src/lib/azure/services/log-analytics-workspace/types.d.ts +0 -3
- package/src/lib/azure/services/log-analytics-workspace/main.ts +0 -61
- package/src/lib/azure/services/log-analytics-workspace/types.ts +0 -3
- /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.d.ts +0 -0
- /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.js +0 -0
- /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/types.js +0 -0
- /package/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.ts +0 -0
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DataAzurermStorageAccountBlobContainerSas } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas/index.js'
|
|
3
|
-
import { DataAzurermStorageAccount } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account/index.js'
|
|
4
|
-
import { DataAzurermStorageContainer } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-container/index.js'
|
|
5
|
-
import { StorageAccount } from '@cdktf/provider-azurerm/lib/storage-account/index.js'
|
|
6
|
-
import { StorageBlob } from '@cdktf/provider-azurerm/lib/storage-blob/index.js'
|
|
7
|
-
import { StorageContainer } from '@cdktf/provider-azurerm/lib/storage-container/index.js'
|
|
8
|
-
import { CommonAzureConstruct } from '../../common/index.js'
|
|
9
|
-
import { createAzureTfOutput } from '../../utils/index.js'
|
|
1
|
+
import * as azure from '@pulumi/azure'
|
|
10
2
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
Blob,
|
|
4
|
+
BlobContainer,
|
|
5
|
+
HttpProtocol,
|
|
6
|
+
Kind,
|
|
7
|
+
listStorageAccountSAS,
|
|
8
|
+
Permissions,
|
|
9
|
+
Services,
|
|
10
|
+
SignedResourceTypes,
|
|
11
|
+
SkuName,
|
|
12
|
+
StorageAccount,
|
|
13
|
+
} from '@pulumi/azure-native/storage/index.js'
|
|
14
|
+
import * as pulumi from '@pulumi/pulumi'
|
|
15
|
+
import { CommonAzureConstruct } from '../../common/index.js'
|
|
16
|
+
import { ContainerSasTokenProps, StorageAccountProps, StorageBlobProps, StorageContainerProps } from './types.js'
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
|
-
* @classdesc Provides operations on Azure Storage
|
|
19
|
+
* @classdesc Provides operations on Azure Storage using Pulumi
|
|
19
20
|
* - A new instance of this class is injected into {@link CommonAzureConstruct} constructor.
|
|
20
21
|
* - If a custom construct extends {@link CommonAzureConstruct}, an instance is available within the context.
|
|
21
22
|
* @example
|
|
22
|
-
* ```
|
|
23
|
+
* ```typescript
|
|
23
24
|
* import { CommonAzureConstruct, CommonAzureStackProps } from '@gradientedge/cdk-utils'
|
|
24
25
|
*
|
|
25
26
|
* class CustomConstruct extends CommonAzureConstruct {
|
|
26
|
-
* constructor(
|
|
27
|
-
* super(
|
|
27
|
+
* constructor(name: string, props: CommonAzureStackProps) {
|
|
28
|
+
* super(name, props)
|
|
28
29
|
* this.props = props
|
|
29
30
|
* this.storageManager.createStorageAccount('MyAccount', this, props)
|
|
30
31
|
* }
|
|
@@ -37,60 +38,64 @@ export class AzureStorageManager {
|
|
|
37
38
|
* @param id scoped id of the resource
|
|
38
39
|
* @param scope scope in which this resource is defined
|
|
39
40
|
* @param props storage account properties
|
|
40
|
-
* @see [
|
|
41
|
+
* @see [Pulumi Azure Native Storage Account]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/storageaccount/}
|
|
41
42
|
*/
|
|
42
43
|
public createStorageAccount(id: string, scope: CommonAzureConstruct, props: StorageAccountProps) {
|
|
43
44
|
if (!props) throw `Props undefined for ${id}`
|
|
44
45
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
47
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
48
|
+
: `${props.resourceGroupName}`
|
|
49
|
+
|
|
50
|
+
return new StorageAccount(
|
|
51
|
+
`${id}-sa`,
|
|
52
|
+
{
|
|
53
|
+
...props,
|
|
54
|
+
accountName: scope.resourceNameFormatter
|
|
55
|
+
.format(props.accountName?.toString(), scope.props.resourceNameOptions?.storageAccount)
|
|
56
|
+
.replace(/\W/g, '')
|
|
57
|
+
.toLowerCase(),
|
|
58
|
+
resourceGroupName,
|
|
59
|
+
sku: props.sku ?? {
|
|
60
|
+
name: SkuName.Standard_LRS,
|
|
61
|
+
},
|
|
62
|
+
kind: props.kind ?? Kind.StorageV2,
|
|
63
|
+
location: props.location ?? scope.props.location,
|
|
64
|
+
tags: props.tags ?? {
|
|
65
|
+
environment: scope.props.stage,
|
|
66
|
+
},
|
|
64
67
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
createAzureTfOutput(`${id}-storageAccountName`, scope, storageAccount.name)
|
|
68
|
-
createAzureTfOutput(`${id}-storageAccountFriendlyUniqueId`, scope, storageAccount.friendlyUniqueId)
|
|
69
|
-
createAzureTfOutput(`${id}-storageAccountId`, scope, storageAccount.id)
|
|
70
|
-
|
|
71
|
-
return storageAccount
|
|
68
|
+
{ parent: scope }
|
|
69
|
+
)
|
|
72
70
|
}
|
|
73
71
|
|
|
74
72
|
/**
|
|
75
|
-
* @summary Method to create a new storage container
|
|
73
|
+
* @summary Method to create a new storage container (blob container)
|
|
76
74
|
* @param id scoped id of the resource
|
|
77
75
|
* @param scope scope in which this resource is defined
|
|
78
76
|
* @param props storage container properties
|
|
79
|
-
* @see [
|
|
77
|
+
* @see [Pulumi Azure Native Blob Container]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blobcontainer/}
|
|
80
78
|
*/
|
|
81
79
|
public createStorageContainer(id: string, scope: CommonAzureConstruct, props: StorageContainerProps) {
|
|
82
80
|
if (!props) throw `Props undefined for ${id}`
|
|
83
81
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
83
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
84
|
+
: `${props.resourceGroupName}`
|
|
85
|
+
|
|
86
|
+
return new BlobContainer(
|
|
87
|
+
`${id}-sc`,
|
|
88
|
+
{
|
|
89
|
+
...props,
|
|
90
|
+
containerName: scope.resourceNameFormatter.format(
|
|
91
|
+
props.containerName?.toString(),
|
|
92
|
+
scope.props.resourceNameOptions?.storageContainer
|
|
93
|
+
),
|
|
94
|
+
accountName: props.accountName,
|
|
95
|
+
resourceGroupName,
|
|
96
|
+
},
|
|
97
|
+
{ parent: scope }
|
|
98
|
+
)
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
/**
|
|
@@ -98,12 +103,12 @@ export class AzureStorageManager {
|
|
|
98
103
|
* @param id scoped id of the resource
|
|
99
104
|
* @param scope scope in which this resource is defined
|
|
100
105
|
* @param props storage blob properties
|
|
101
|
-
* @see [
|
|
106
|
+
* @see [Pulumi Azure Native Blob]{@link https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/blob/}
|
|
102
107
|
*/
|
|
103
108
|
public createStorageBlob(id: string, scope: CommonAzureConstruct, props: StorageBlobProps) {
|
|
104
109
|
if (!props) throw `Props undefined for ${id}`
|
|
105
110
|
|
|
106
|
-
const resourceGroup =
|
|
111
|
+
const resourceGroup = azure.core.getResourceGroupOutput({
|
|
107
112
|
name: scope.props.resourceGroupName
|
|
108
113
|
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
109
114
|
: `${props.resourceGroupName}`,
|
|
@@ -111,76 +116,70 @@ export class AzureStorageManager {
|
|
|
111
116
|
|
|
112
117
|
if (!resourceGroup) throw `Resource group undefined for ${id}`
|
|
113
118
|
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
createAzureTfOutput(`${id}-storageBlobName`, scope, storageBlob.name)
|
|
133
|
-
createAzureTfOutput(`${id}-storageBlobFriendlyUniqueId`, scope, storageBlob.friendlyUniqueId)
|
|
134
|
-
createAzureTfOutput(`${id}-storageBlobId`, scope, storageBlob.id)
|
|
135
|
-
|
|
136
|
-
return storageBlob
|
|
119
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
120
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
121
|
+
: `${props.resourceGroupName}`
|
|
122
|
+
|
|
123
|
+
return new Blob(
|
|
124
|
+
`${id}-sb`,
|
|
125
|
+
{
|
|
126
|
+
...props,
|
|
127
|
+
blobName: scope.resourceNameFormatter.format(
|
|
128
|
+
props.blobName?.toString(),
|
|
129
|
+
scope.props.resourceNameOptions?.storageBlob
|
|
130
|
+
),
|
|
131
|
+
accountName: props.accountName,
|
|
132
|
+
containerName: `${props.containerName}-${scope.props.stage}`,
|
|
133
|
+
resourceGroupName,
|
|
134
|
+
},
|
|
135
|
+
{ parent: scope }
|
|
136
|
+
)
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* @summary Generates a container-level SAS token for an existing Azure Storage container.
|
|
141
141
|
*
|
|
142
142
|
* @description
|
|
143
|
-
* This method
|
|
144
|
-
*
|
|
143
|
+
* This method generates a Shared Access Signature (SAS) token for secure container access.
|
|
144
|
+
* The token is generated using Pulumi's listStorageAccountSAS function.
|
|
145
145
|
*
|
|
146
146
|
* @param id - Unique scoped identifier for the SAS token resource
|
|
147
|
-
* @param scope -
|
|
147
|
+
* @param scope - Pulumi construct scope
|
|
148
148
|
* @param props - SAS options:
|
|
149
|
-
* - start: Optional start date in the format 'YYYY-MM-DD'.
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* @param
|
|
153
|
-
* @param storageContainer
|
|
149
|
+
* - start: Optional start date in the format 'YYYY-MM-DD'. Defaults to today's date.
|
|
150
|
+
* - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date.
|
|
151
|
+
* @param storageAccount - The storage account resource
|
|
152
|
+
* @param storageContainer - Optional blob container resource
|
|
154
153
|
*
|
|
155
|
-
* @returns A
|
|
154
|
+
* @returns A Pulumi Output containing the SAS token
|
|
156
155
|
*
|
|
157
|
-
* @see https://
|
|
156
|
+
* @see https://www.pulumi.com/registry/packages/azure-native/api-docs/storage/liststorageaccountsas/
|
|
158
157
|
*/
|
|
159
158
|
public generateContainerSasToken(
|
|
160
159
|
id: string,
|
|
161
160
|
scope: CommonAzureConstruct,
|
|
162
|
-
props:
|
|
163
|
-
storageAccount: StorageAccount
|
|
164
|
-
storageContainer?: StorageContainer
|
|
161
|
+
props: ContainerSasTokenProps,
|
|
162
|
+
storageAccount: StorageAccount
|
|
165
163
|
) {
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
164
|
+
const resourceGroupName = scope.props.resourceGroupName
|
|
165
|
+
? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
|
|
166
|
+
: `${props.resourceGroupName}`
|
|
167
|
+
|
|
168
|
+
return pulumi
|
|
169
|
+
.all([storageAccount.name])
|
|
170
|
+
.apply(([accountName]) => {
|
|
171
|
+
return listStorageAccountSAS({
|
|
172
|
+
accountName,
|
|
173
|
+
resourceGroupName,
|
|
174
|
+
protocols: props.httpsOnly === false ? HttpProtocol.Https_http : HttpProtocol.Https,
|
|
175
|
+
sharedAccessStartTime: props.start ?? new Date().toISOString().split('T')[0],
|
|
176
|
+
sharedAccessExpiryTime:
|
|
177
|
+
props.expiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
|
|
178
|
+
permissions: props.permissions ?? Permissions.R,
|
|
179
|
+
services: Services.B,
|
|
180
|
+
resourceTypes: SignedResourceTypes.C,
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
.apply(result => result.accountSasToken)
|
|
185
184
|
}
|
|
186
185
|
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
BlobArgs,
|
|
3
|
+
BlobContainerArgs,
|
|
4
|
+
ListStorageAccountSASArgs,
|
|
5
|
+
StorageAccountArgs,
|
|
6
|
+
} from '@pulumi/azure-native/storage/index.js'
|
|
5
7
|
import { BaseAzureConfigProps } from '../../types/index.js'
|
|
6
8
|
|
|
7
|
-
export interface StorageAccountProps extends
|
|
9
|
+
export interface StorageAccountProps extends StorageAccountArgs {}
|
|
8
10
|
|
|
9
|
-
export interface StorageContainerProps extends BaseAzureConfigProps,
|
|
11
|
+
export interface StorageContainerProps extends BaseAzureConfigProps, BlobContainerArgs {}
|
|
10
12
|
|
|
11
|
-
export interface StorageBlobProps extends BaseAzureConfigProps,
|
|
13
|
+
export interface StorageBlobProps extends BaseAzureConfigProps, BlobArgs {}
|
|
12
14
|
|
|
13
|
-
export interface
|
|
15
|
+
export interface ContainerSasTokenProps extends ListStorageAccountSASArgs {
|
|
16
|
+
resourceGroupName: string
|
|
17
|
+
containerName?: string
|
|
18
|
+
httpsOnly?: boolean
|
|
19
|
+
start?: string
|
|
20
|
+
expiry?: string
|
|
21
|
+
}
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Azure utility functions for Pulumi
|
|
3
|
+
*
|
|
4
|
+
* Note: Pulumi automatically exposes resource properties as outputs.
|
|
5
|
+
* Unlike CDKTF, explicit output creation is not required.
|
|
6
|
+
* Resource properties are already pulumi.Output<T> types and can be
|
|
7
|
+
* exported directly or used with .apply() for transformations.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // In CDKTF (old):
|
|
12
|
+
* createAzureTfOutput('resourceGroupName', scope, resourceGroup.name)
|
|
13
|
+
*
|
|
14
|
+
* // In Pulumi (new):
|
|
15
|
+
* // No explicit output creation needed - resourceGroup.name is already an output
|
|
16
|
+
* export const resourceGroupName = resourceGroup.name
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
4
19
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
scope: CommonAzureConstruct,
|
|
8
|
-
value?: string,
|
|
9
|
-
description?: string,
|
|
10
|
-
sensitive?: boolean,
|
|
11
|
-
overrideId = true
|
|
12
|
-
) => {
|
|
13
|
-
const output = new TerraformOutput(scope, id, {
|
|
14
|
-
description,
|
|
15
|
-
sensitive,
|
|
16
|
-
value,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
if (overrideId) {
|
|
20
|
-
output.overrideLogicalId(_.camelCase(id))
|
|
21
|
-
}
|
|
22
|
-
return output
|
|
23
|
-
}
|
|
20
|
+
// Utility functions can be added here as needed for Pulumi Azure operations
|
|
21
|
+
export {}
|
|
@@ -99,7 +99,7 @@ export class CommonCloudflareStack extends ComponentResource {
|
|
|
99
99
|
* - Primary use is to have layered config for each environment which is injected into the context
|
|
100
100
|
*/
|
|
101
101
|
protected determineStageContexts(props: CommonCloudflareStackProps) {
|
|
102
|
-
const stageContextFilePath = path.join(appRoot.path, props.stageContextPath ?? '
|
|
102
|
+
const stageContextFilePath = path.join(appRoot.path, props.stageContextPath ?? 'env', `${props.stage}.json`)
|
|
103
103
|
|
|
104
104
|
if (isDevStage(props.stage)) {
|
|
105
105
|
if (props.debug) console.debug(`Development stage. Using default stage context properties`)
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
AccessRule,
|
|
3
|
+
ZeroTrustAccessApplication,
|
|
4
|
+
ZeroTrustAccessCustomPage,
|
|
5
|
+
ZeroTrustAccessGroup,
|
|
6
|
+
ZeroTrustAccessIdentityProvider,
|
|
7
|
+
ZeroTrustAccessMtlsCertificate,
|
|
8
|
+
ZeroTrustAccessPolicy,
|
|
9
|
+
ZeroTrustAccessServiceToken,
|
|
10
|
+
ZeroTrustAccessShortLivedCertificate,
|
|
11
|
+
ZeroTrustAccessTag,
|
|
12
|
+
ZeroTrustOrganization,
|
|
13
|
+
} from '@pulumi/cloudflare'
|
|
2
14
|
import { CommonCloudflareConstruct } from '../../common/construct.js'
|
|
3
15
|
import {
|
|
4
16
|
AccessRuleProps,
|
|
@@ -47,12 +59,16 @@ export class CloudflareAccessManager {
|
|
|
47
59
|
filter: { name: scope.props.domainName },
|
|
48
60
|
})?.id
|
|
49
61
|
|
|
50
|
-
return new
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
return new ZeroTrustAccessApplication(
|
|
63
|
+
`${id}`,
|
|
64
|
+
{
|
|
65
|
+
...props,
|
|
66
|
+
domain: `${props.domain}-${scope.props.domainName}`,
|
|
67
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
68
|
+
zoneId,
|
|
69
|
+
},
|
|
70
|
+
{ parent: scope }
|
|
71
|
+
)
|
|
56
72
|
}
|
|
57
73
|
|
|
58
74
|
/**
|
|
@@ -75,10 +91,14 @@ export class CloudflareAccessManager {
|
|
|
75
91
|
filter: { name: scope.props.domainName },
|
|
76
92
|
})?.id
|
|
77
93
|
|
|
78
|
-
return new
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
return new ZeroTrustAccessShortLivedCertificate(
|
|
95
|
+
`${id}`,
|
|
96
|
+
{
|
|
97
|
+
...props,
|
|
98
|
+
zoneId,
|
|
99
|
+
},
|
|
100
|
+
{ parent: scope }
|
|
101
|
+
)
|
|
82
102
|
}
|
|
83
103
|
|
|
84
104
|
/**
|
|
@@ -91,11 +111,15 @@ export class CloudflareAccessManager {
|
|
|
91
111
|
public createAccessCustomPage(id: string, scope: CommonCloudflareConstruct, props: ZeroTrustAccessCustomPageProps) {
|
|
92
112
|
if (!props) throw `Props undefined for ${id}`
|
|
93
113
|
|
|
94
|
-
return new
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
114
|
+
return new ZeroTrustAccessCustomPage(
|
|
115
|
+
`${id}`,
|
|
116
|
+
{
|
|
117
|
+
...props,
|
|
118
|
+
accountId: props.accountId ?? scope.props.accountId,
|
|
119
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
120
|
+
},
|
|
121
|
+
{ parent: scope }
|
|
122
|
+
)
|
|
99
123
|
}
|
|
100
124
|
|
|
101
125
|
/**
|
|
@@ -114,11 +138,15 @@ export class CloudflareAccessManager {
|
|
|
114
138
|
filter: { name: scope.props.domainName },
|
|
115
139
|
})?.id
|
|
116
140
|
|
|
117
|
-
return new
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
141
|
+
return new ZeroTrustAccessGroup(
|
|
142
|
+
`${id}`,
|
|
143
|
+
{
|
|
144
|
+
...props,
|
|
145
|
+
name: `${props.name} - ${scope.props.stage.toUpperCase()}`,
|
|
146
|
+
zoneId,
|
|
147
|
+
},
|
|
148
|
+
{ parent: scope }
|
|
149
|
+
)
|
|
122
150
|
}
|
|
123
151
|
|
|
124
152
|
/**
|
|
@@ -141,12 +169,16 @@ export class CloudflareAccessManager {
|
|
|
141
169
|
filter: { name: scope.props.domainName },
|
|
142
170
|
})?.id
|
|
143
171
|
|
|
144
|
-
return new
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
172
|
+
return new ZeroTrustAccessIdentityProvider(
|
|
173
|
+
`${id}`,
|
|
174
|
+
{
|
|
175
|
+
...props,
|
|
176
|
+
config: props.config ?? {},
|
|
177
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
178
|
+
zoneId,
|
|
179
|
+
},
|
|
180
|
+
{ parent: scope }
|
|
181
|
+
)
|
|
150
182
|
}
|
|
151
183
|
|
|
152
184
|
/**
|
|
@@ -169,11 +201,15 @@ export class CloudflareAccessManager {
|
|
|
169
201
|
filter: { name: scope.props.domainName },
|
|
170
202
|
})?.id
|
|
171
203
|
|
|
172
|
-
return new
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
204
|
+
return new ZeroTrustAccessMtlsCertificate(
|
|
205
|
+
`${id}`,
|
|
206
|
+
{
|
|
207
|
+
...props,
|
|
208
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
209
|
+
zoneId,
|
|
210
|
+
},
|
|
211
|
+
{ parent: scope }
|
|
212
|
+
)
|
|
177
213
|
}
|
|
178
214
|
|
|
179
215
|
/**
|
|
@@ -192,11 +228,15 @@ export class CloudflareAccessManager {
|
|
|
192
228
|
filter: { name: scope.props.domainName },
|
|
193
229
|
})?.id
|
|
194
230
|
|
|
195
|
-
return new
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
231
|
+
return new ZeroTrustOrganization(
|
|
232
|
+
`${id}`,
|
|
233
|
+
{
|
|
234
|
+
...props,
|
|
235
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
236
|
+
zoneId,
|
|
237
|
+
},
|
|
238
|
+
{ parent: scope }
|
|
239
|
+
)
|
|
200
240
|
}
|
|
201
241
|
|
|
202
242
|
/**
|
|
@@ -209,11 +249,15 @@ export class CloudflareAccessManager {
|
|
|
209
249
|
public createAccessPolicy(id: string, scope: CommonCloudflareConstruct, props: ZeroTrustAccessPolicyProps) {
|
|
210
250
|
if (!props) throw `Props undefined for ${id}`
|
|
211
251
|
|
|
212
|
-
return new
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
252
|
+
return new ZeroTrustAccessPolicy(
|
|
253
|
+
`${id}`,
|
|
254
|
+
{
|
|
255
|
+
...props,
|
|
256
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
257
|
+
accountId: props.accountId ?? scope.props.accountId,
|
|
258
|
+
},
|
|
259
|
+
{ parent: scope }
|
|
260
|
+
)
|
|
217
261
|
}
|
|
218
262
|
|
|
219
263
|
/**
|
|
@@ -232,11 +276,15 @@ export class CloudflareAccessManager {
|
|
|
232
276
|
filter: { name: scope.props.domainName },
|
|
233
277
|
})?.id
|
|
234
278
|
|
|
235
|
-
return new
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
279
|
+
return new AccessRule(
|
|
280
|
+
`${id}`,
|
|
281
|
+
{
|
|
282
|
+
...props,
|
|
283
|
+
zoneId,
|
|
284
|
+
accountId: props.accountId ?? scope.props.accountId,
|
|
285
|
+
},
|
|
286
|
+
{ parent: scope }
|
|
287
|
+
)
|
|
240
288
|
}
|
|
241
289
|
|
|
242
290
|
/**
|
|
@@ -259,12 +307,16 @@ export class CloudflareAccessManager {
|
|
|
259
307
|
filter: { name: scope.props.domainName },
|
|
260
308
|
})?.id
|
|
261
309
|
|
|
262
|
-
return new
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
310
|
+
return new ZeroTrustAccessServiceToken(
|
|
311
|
+
`${id}`,
|
|
312
|
+
{
|
|
313
|
+
...props,
|
|
314
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
315
|
+
accountId: props.accountId ?? scope.props.accountId,
|
|
316
|
+
zoneId,
|
|
317
|
+
},
|
|
318
|
+
{ parent: scope }
|
|
319
|
+
)
|
|
268
320
|
}
|
|
269
321
|
|
|
270
322
|
/**
|
|
@@ -277,10 +329,14 @@ export class CloudflareAccessManager {
|
|
|
277
329
|
public createAccessTag(id: string, scope: CommonCloudflareConstruct, props: ZeroTrustAccessTagProps) {
|
|
278
330
|
if (!props) throw `Props undefined for ${id}`
|
|
279
331
|
|
|
280
|
-
return new
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
332
|
+
return new ZeroTrustAccessTag(
|
|
333
|
+
`${id}`,
|
|
334
|
+
{
|
|
335
|
+
...props,
|
|
336
|
+
name: `${props.name}-${scope.props.stage}`,
|
|
337
|
+
accountId: props.accountId ?? scope.props.accountId,
|
|
338
|
+
},
|
|
339
|
+
{ parent: scope }
|
|
340
|
+
)
|
|
285
341
|
}
|
|
286
342
|
}
|