@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.
Files changed (133) hide show
  1. package/dist/src/lib/azure/common/constants.d.ts +3 -2
  2. package/dist/src/lib/azure/common/constants.js +2 -1
  3. package/dist/src/lib/azure/common/construct.d.ts +26 -12
  4. package/dist/src/lib/azure/common/construct.js +31 -45
  5. package/dist/src/lib/azure/common/resource-name-formatter.d.ts +9 -4
  6. package/dist/src/lib/azure/common/resource-name-formatter.js +9 -5
  7. package/dist/src/lib/azure/common/stack.d.ts +18 -32
  8. package/dist/src/lib/azure/common/stack.js +77 -74
  9. package/dist/src/lib/azure/common/tagging.d.ts +29 -8
  10. package/dist/src/lib/azure/common/tagging.js +72 -26
  11. package/dist/src/lib/azure/common/types.d.ts +19 -4
  12. package/dist/src/lib/azure/services/api-management/main.d.ts +29 -32
  13. package/dist/src/lib/azure/services/api-management/main.js +100 -121
  14. package/dist/src/lib/azure/services/api-management/types.d.ts +33 -18
  15. package/dist/src/lib/azure/services/app-configuration/main.d.ts +6 -7
  16. package/dist/src/lib/azure/services/app-configuration/main.js +23 -26
  17. package/dist/src/lib/azure/services/app-configuration/types.d.ts +2 -2
  18. package/dist/src/lib/azure/services/app-service/main.d.ts +10 -12
  19. package/dist/src/lib/azure/services/app-service/main.js +37 -49
  20. package/dist/src/lib/azure/services/app-service/types.d.ts +4 -4
  21. package/dist/src/lib/azure/services/application-insights/main.d.ts +7 -8
  22. package/dist/src/lib/azure/services/application-insights/main.js +20 -26
  23. package/dist/src/lib/azure/services/application-insights/types.d.ts +2 -4
  24. package/dist/src/lib/azure/services/cosmosdb/main.d.ts +12 -15
  25. package/dist/src/lib/azure/services/cosmosdb/main.js +42 -61
  26. package/dist/src/lib/azure/services/cosmosdb/types.d.ts +4 -6
  27. package/dist/src/lib/azure/services/dns/main.d.ts +13 -17
  28. package/dist/src/lib/azure/services/dns/main.js +33 -51
  29. package/dist/src/lib/azure/services/dns/types.d.ts +5 -8
  30. package/dist/src/lib/azure/services/eventgrid/main.d.ts +20 -22
  31. package/dist/src/lib/azure/services/eventgrid/main.js +61 -89
  32. package/dist/src/lib/azure/services/eventgrid/types.d.ts +7 -8
  33. package/dist/src/lib/azure/services/function/main.d.ts +15 -15
  34. package/dist/src/lib/azure/services/function/main.js +54 -59
  35. package/dist/src/lib/azure/services/function/types.d.ts +18 -6
  36. package/dist/src/lib/azure/services/index.d.ts +1 -1
  37. package/dist/src/lib/azure/services/index.js +1 -1
  38. package/dist/src/lib/azure/services/key-vault/main.d.ts +6 -7
  39. package/dist/src/lib/azure/services/key-vault/main.js +29 -28
  40. package/dist/src/lib/azure/services/key-vault/types.d.ts +3 -2
  41. package/dist/src/lib/azure/services/monitor/main.d.ts +7 -8
  42. package/dist/src/lib/azure/services/monitor/main.js +10 -15
  43. package/dist/src/lib/azure/services/monitor/types.d.ts +2 -2
  44. package/dist/src/lib/azure/services/operational-insights/main.d.ts +29 -0
  45. package/dist/src/lib/azure/services/operational-insights/main.js +50 -0
  46. package/dist/src/lib/azure/services/operational-insights/types.d.ts +3 -0
  47. package/dist/src/lib/azure/services/redis/main.d.ts +8 -9
  48. package/dist/src/lib/azure/services/redis/main.js +24 -26
  49. package/dist/src/lib/azure/services/redis/types.d.ts +2 -2
  50. package/dist/src/lib/azure/services/resource-group/main.d.ts +6 -7
  51. package/dist/src/lib/azure/services/resource-group/main.js +9 -14
  52. package/dist/src/lib/azure/services/resource-group/types.d.ts +2 -2
  53. package/dist/src/lib/azure/services/servicebus/main.d.ts +17 -22
  54. package/dist/src/lib/azure/services/servicebus/main.js +47 -70
  55. package/dist/src/lib/azure/services/servicebus/types.d.ts +6 -10
  56. package/dist/src/lib/azure/services/storage/main.d.ts +24 -27
  57. package/dist/src/lib/azure/services/storage/main.js +70 -88
  58. package/dist/src/lib/azure/services/storage/types.d.ts +10 -8
  59. package/dist/src/lib/azure/types/index.d.ts +2 -1
  60. package/dist/src/lib/azure/utils/index.d.ts +19 -3
  61. package/dist/src/lib/azure/utils/index.js +19 -13
  62. package/dist/src/lib/cloudflare/common/stack.js +1 -1
  63. package/dist/src/lib/cloudflare/services/access/main.js +23 -23
  64. package/dist/src/lib/cloudflare/services/api-shield/main.js +11 -11
  65. package/dist/src/lib/cloudflare/services/argo/main.js +5 -5
  66. package/dist/src/lib/cloudflare/services/filter/main.js +3 -3
  67. package/dist/src/lib/cloudflare/services/firewall/main.js +3 -3
  68. package/dist/src/lib/cloudflare/services/page/main.js +7 -7
  69. package/dist/src/lib/cloudflare/services/record/main.js +3 -3
  70. package/dist/src/lib/cloudflare/services/rule-set/main.d.ts +1 -1
  71. package/dist/src/lib/cloudflare/services/rule-set/main.js +4 -5
  72. package/dist/src/lib/cloudflare/services/worker/main.js +13 -13
  73. package/dist/src/lib/cloudflare/services/zone/main.js +18 -18
  74. package/package.json +2 -1
  75. package/src/lib/azure/common/constants.ts +2 -1
  76. package/src/lib/azure/common/construct.ts +32 -48
  77. package/src/lib/azure/common/resource-name-formatter.ts +10 -6
  78. package/src/lib/azure/common/stack.ts +78 -78
  79. package/src/lib/azure/common/tagging.ts +78 -29
  80. package/src/lib/azure/common/types.ts +21 -4
  81. package/src/lib/azure/services/api-management/main.ts +172 -169
  82. package/src/lib/azure/services/api-management/types.ts +39 -16
  83. package/src/lib/azure/services/app-configuration/main.ts +33 -31
  84. package/src/lib/azure/services/app-configuration/types.ts +2 -2
  85. package/src/lib/azure/services/app-service/main.ts +61 -62
  86. package/src/lib/azure/services/app-service/types.ts +4 -4
  87. package/src/lib/azure/services/application-insights/main.ts +29 -30
  88. package/src/lib/azure/services/application-insights/types.ts +2 -5
  89. package/src/lib/azure/services/cosmosdb/main.ts +78 -77
  90. package/src/lib/azure/services/cosmosdb/types.ts +10 -6
  91. package/src/lib/azure/services/dns/main.ts +65 -72
  92. package/src/lib/azure/services/dns/types.ts +9 -9
  93. package/src/lib/azure/services/eventgrid/main.ts +120 -122
  94. package/src/lib/azure/services/eventgrid/types.ts +13 -8
  95. package/src/lib/azure/services/function/main.ts +75 -72
  96. package/src/lib/azure/services/function/types.ts +21 -6
  97. package/src/lib/azure/services/index.ts +1 -1
  98. package/src/lib/azure/services/key-vault/main.ts +38 -32
  99. package/src/lib/azure/services/key-vault/types.ts +4 -2
  100. package/src/lib/azure/services/monitor/main.ts +17 -21
  101. package/src/lib/azure/services/monitor/types.ts +2 -2
  102. package/src/lib/azure/services/operational-insights/main.ts +61 -0
  103. package/src/lib/azure/services/operational-insights/types.ts +3 -0
  104. package/src/lib/azure/services/redis/main.ts +30 -30
  105. package/src/lib/azure/services/redis/types.ts +2 -2
  106. package/src/lib/azure/services/resource-group/main.ts +20 -20
  107. package/src/lib/azure/services/resource-group/types.ts +2 -2
  108. package/src/lib/azure/services/servicebus/main.ts +103 -94
  109. package/src/lib/azure/services/servicebus/types.ts +17 -11
  110. package/src/lib/azure/services/storage/main.ts +113 -114
  111. package/src/lib/azure/services/storage/types.ts +16 -8
  112. package/src/lib/azure/types/index.ts +2 -1
  113. package/src/lib/azure/utils/index.ts +20 -22
  114. package/src/lib/cloudflare/common/stack.ts +1 -1
  115. package/src/lib/cloudflare/services/access/main.ts +114 -58
  116. package/src/lib/cloudflare/services/api-shield/main.ts +48 -22
  117. package/src/lib/cloudflare/services/argo/main.ts +17 -9
  118. package/src/lib/cloudflare/services/filter/main.ts +9 -5
  119. package/src/lib/cloudflare/services/firewall/main.ts +9 -5
  120. package/src/lib/cloudflare/services/page/main.ts +27 -15
  121. package/src/lib/cloudflare/services/record/main.ts +9 -5
  122. package/src/lib/cloudflare/services/rule-set/main.ts +10 -8
  123. package/src/lib/cloudflare/services/worker/main.ts +60 -29
  124. package/src/lib/cloudflare/services/zone/main.ts +75 -35
  125. package/dist/src/lib/azure/services/log-analytics-workspace/main.d.ts +0 -30
  126. package/dist/src/lib/azure/services/log-analytics-workspace/main.js +0 -55
  127. package/dist/src/lib/azure/services/log-analytics-workspace/types.d.ts +0 -3
  128. package/src/lib/azure/services/log-analytics-workspace/main.ts +0 -61
  129. package/src/lib/azure/services/log-analytics-workspace/types.ts +0 -3
  130. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.d.ts +0 -0
  131. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.js +0 -0
  132. /package/dist/src/lib/azure/services/{log-analytics-workspace → operational-insights}/types.js +0 -0
  133. /package/src/lib/azure/services/{log-analytics-workspace → operational-insights}/index.ts +0 -0
@@ -1,30 +1,31 @@
1
- import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group/index.js'
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
- DataAzurermStorageAccountBlobContainerSasProps,
12
- StorageAccountProps,
13
- StorageBlobProps,
14
- StorageContainerProps,
15
- } from './types.js'
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(parent: Construct, id: string, props: CommonAzureStackProps) {
27
- * super(parent, id, props)
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 [CDKTF Storage Account Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageAccount.typescript.md}
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 resourceGroup = new DataAzurermResourceGroup(scope, `${id}-sa-rg`, {
46
- name: scope.props.resourceGroupName
47
- ? scope.resourceNameFormatter.format(scope.props.resourceGroupName)
48
- : `${props.resourceGroupName}`,
49
- })
50
-
51
- if (!resourceGroup) throw `Resource group undefined for ${id}`
52
-
53
- const storageAccount = new StorageAccount(scope, `${id}-sa`, {
54
- ...props,
55
- accountTier: props.accountTier ?? 'Standard',
56
- location: props.location ?? resourceGroup.location,
57
- name: scope.resourceNameFormatter
58
- .format(props.name, scope.props.resourceNameOptions?.storageAccount)
59
- .replace(/\W/g, '')
60
- .toLowerCase(),
61
- resourceGroupName: resourceGroup.name,
62
- tags: props.tags ?? {
63
- environment: scope.props.stage,
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 [CDKTF Storage Container Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageContainer.typescript.md}
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 storageContainer = new StorageContainer(scope, `${id}-sc`, {
85
- ...props,
86
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageContainer),
87
- })
88
-
89
- createAzureTfOutput(`${id}-storageContainerName`, scope, storageContainer.name)
90
- createAzureTfOutput(`${id}-storageContainerFriendlyUniqueId`, scope, storageContainer.friendlyUniqueId)
91
- createAzureTfOutput(`${id}-storageContainerId`, scope, storageContainer.id)
92
-
93
- return storageContainer
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 [CDKTF Storage Blob Module]{@link https://github.com/cdktf/cdktf-provider-azurerm/blob/main/docs/storageBlob.typescript.md}
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 = new DataAzurermResourceGroup(scope, `${id}-sb-rg`, {
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 storageAccount = new DataAzurermStorageAccount(scope, `${id}-sa`, {
115
- name: `${props.storageAccountName}-${scope.props.stage}`,
116
- resourceGroupName: resourceGroup.name,
117
- })
118
-
119
- const storageContainer = new DataAzurermStorageContainer(scope, `${id}-sc`, {
120
- name: `${props.storageContainerName}-${scope.props.stage}`,
121
- storageAccountName: undefined, // the `storage_account_name` property has been deprecated in favour of `storage_account_id` and will be removed in version 5.0 of the Provider.
122
- storageAccountId: storageAccount.id,
123
- })
124
-
125
- const storageBlob = new StorageBlob(scope, `${id}-sb`, {
126
- ...props,
127
- name: scope.resourceNameFormatter.format(props.name, scope.props.resourceNameOptions?.storageBlob),
128
- storageAccountName: storageAccount.name,
129
- storageContainerName: storageContainer.name,
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 creates a `DataAzurermStorageAccountBlobContainerSas` resource, allowing secure access
144
- * to a container via a generated Shared Access Signature (SAS) token.
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 - CDKTF construct scope in which the resource will be created
147
+ * @param scope - Pulumi construct scope
148
148
  * @param props - SAS options:
149
- * - start: Optional start date in the format 'YYYY-MM-DD'. If not provided, defaults to todays date.
150
- * To avoid diffs on every deploy, it is recommended to supply a fixed value.
151
- * - expiry: Optional expiry date in the format 'YYYY-MM-DD'. Defaults to 7 days from current date if not provided.
152
- * @param storageAccount
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 `DataAzurermStorageAccountBlobContainerSas` instance with the generated SAS token
154
+ * @returns A Pulumi Output containing the SAS token
156
155
  *
157
- * @see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/storage_account_blob_container_sas
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: DataAzurermStorageAccountBlobContainerSasProps,
163
- storageAccount: StorageAccount,
164
- storageContainer?: StorageContainer
161
+ props: ContainerSasTokenProps,
162
+ storageAccount: StorageAccount
165
163
  ) {
166
- const containerSas = new DataAzurermStorageAccountBlobContainerSas(scope, `${id}-sc-sas`, {
167
- connectionString: storageAccount.primaryConnectionString,
168
- containerName: props.containerName ?? storageContainer?.name,
169
- httpsOnly: props.httpsOnly ?? true,
170
- start: props.start ?? new Date().toISOString().split('T')[0],
171
- expiry: props.expiry ?? new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString().split('T')[0],
172
- permissions: props.permissions ?? {
173
- read: true,
174
- add: false,
175
- create: false,
176
- delete: false,
177
- list: false,
178
- write: false,
179
- },
180
- })
181
-
182
- createAzureTfOutput(`${id}-sas-token`, scope, containerSas.sas, 'output', true)
183
-
184
- return containerSas
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 { DataAzurermStorageAccountBlobContainerSasConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-storage-account-blob-container-sas/index.js'
2
- import { StorageAccountConfig } from '@cdktf/provider-azurerm/lib/storage-account/index.js'
3
- import { StorageBlobConfig } from '@cdktf/provider-azurerm/lib/storage-blob/index.js'
4
- import { StorageContainerConfig } from '@cdktf/provider-azurerm/lib/storage-container/index.js'
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 StorageAccountConfig {}
9
+ export interface StorageAccountProps extends StorageAccountArgs {}
8
10
 
9
- export interface StorageContainerProps extends BaseAzureConfigProps, StorageContainerConfig {}
11
+ export interface StorageContainerProps extends BaseAzureConfigProps, BlobContainerArgs {}
10
12
 
11
- export interface StorageBlobProps extends BaseAzureConfigProps, StorageBlobConfig {}
13
+ export interface StorageBlobProps extends BaseAzureConfigProps, BlobArgs {}
12
14
 
13
- export interface DataAzurermStorageAccountBlobContainerSasProps extends DataAzurermStorageAccountBlobContainerSasConfig {}
15
+ export interface ContainerSasTokenProps extends ListStorageAccountSASArgs {
16
+ resourceGroupName: string
17
+ containerName?: string
18
+ httpsOnly?: boolean
19
+ start?: string
20
+ expiry?: string
21
+ }
@@ -1,3 +1,4 @@
1
+ import * as pulumi from '@pulumi/pulumi'
1
2
  export interface BaseAzureConfigProps {
2
- resourceGroupName: string
3
+ resourceGroupName: pulumi.Input<string>
3
4
  }
@@ -1,23 +1,21 @@
1
- import { TerraformOutput } from 'cdktf'
2
- import _ from 'lodash'
3
- import { CommonAzureConstruct } from '../common/index.js'
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
- export const createAzureTfOutput = (
6
- id: string,
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 ?? 'cdkEnv', `${props.stage}.json`)
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 * as cloudflare from '@pulumi/cloudflare'
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 cloudflare.ZeroTrustAccessApplication(`${id}`, {
51
- ...props,
52
- domain: `${props.domain}-${scope.props.domainName}`,
53
- name: `${props.name}-${scope.props.stage}`,
54
- zoneId,
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 cloudflare.ZeroTrustAccessShortLivedCertificate(`${id}`, {
79
- ...props,
80
- zoneId,
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 cloudflare.ZeroTrustAccessCustomPage(`${id}`, {
95
- ...props,
96
- accountId: props.accountId ?? scope.props.accountId,
97
- name: `${props.name}-${scope.props.stage}`,
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 cloudflare.ZeroTrustAccessGroup(`${id}`, {
118
- ...props,
119
- name: `${props.name} - ${scope.props.stage.toUpperCase()}`,
120
- zoneId,
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 cloudflare.ZeroTrustAccessIdentityProvider(`${id}`, {
145
- ...props,
146
- config: props.config ?? {},
147
- name: `${props.name}-${scope.props.stage}`,
148
- zoneId,
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 cloudflare.ZeroTrustAccessMtlsCertificate(`${id}`, {
173
- ...props,
174
- name: `${props.name}-${scope.props.stage}`,
175
- zoneId,
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 cloudflare.ZeroTrustOrganization(`${id}`, {
196
- ...props,
197
- name: `${props.name}-${scope.props.stage}`,
198
- zoneId,
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 cloudflare.ZeroTrustAccessPolicy(`${id}`, {
213
- ...props,
214
- name: `${props.name}-${scope.props.stage}`,
215
- accountId: props.accountId ?? scope.props.accountId,
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 cloudflare.AccessRule(`${id}`, {
236
- ...props,
237
- zoneId,
238
- accountId: props.accountId ?? scope.props.accountId,
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 cloudflare.ZeroTrustAccessServiceToken(`${id}`, {
263
- ...props,
264
- name: `${props.name}-${scope.props.stage}`,
265
- accountId: props.accountId ?? scope.props.accountId,
266
- zoneId,
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 cloudflare.ZeroTrustAccessTag(`${id}`, {
281
- ...props,
282
- name: `${props.name}-${scope.props.stage}`,
283
- accountId: props.accountId ?? scope.props.accountId,
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
  }