@gradientedge/cdk-utils 9.36.0 → 9.37.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 (28) hide show
  1. package/dist/src/lib/azure/.gen/providers/azapi/provider/index.d.ts +414 -0
  2. package/dist/src/lib/azure/.gen/providers/azapi/provider/index.js +884 -0
  3. package/dist/src/lib/azure/.gen/providers/azapi/resource/index.d.ts +639 -0
  4. package/dist/src/lib/azure/.gen/providers/azapi/resource/index.js +1177 -0
  5. package/dist/src/lib/azure/common/construct.js +2 -0
  6. package/dist/src/lib/azure/services/function/main.d.ts +10 -2
  7. package/dist/src/lib/azure/services/function/main.js +79 -1
  8. package/dist/src/lib/azure/services/function/types.d.ts +18 -0
  9. package/dist/src/lib/azure/services/storage/main.js +5 -3
  10. package/package.json +1 -1
  11. package/src/lib/azure/.gen/constraints.json +6 -0
  12. package/src/lib/azure/.gen/providers/azapi/data-azapi-client-config/index.ts +257 -0
  13. package/src/lib/azure/.gen/providers/azapi/data-azapi-resource/index.ts +876 -0
  14. package/src/lib/azure/.gen/providers/azapi/data-azapi-resource-action/index.ts +779 -0
  15. package/src/lib/azure/.gen/providers/azapi/data-azapi-resource-id/index.ts +383 -0
  16. package/src/lib/azure/.gen/providers/azapi/data-azapi-resource-list/index.ts +713 -0
  17. package/src/lib/azure/.gen/providers/azapi/data-plane-resource/index.ts +1203 -0
  18. package/src/lib/azure/.gen/providers/azapi/index.ts +11 -0
  19. package/src/lib/azure/.gen/providers/azapi/lazy-index.ts +51 -0
  20. package/src/lib/azure/.gen/providers/azapi/provider/index.ts +1121 -0
  21. package/src/lib/azure/.gen/providers/azapi/resource/index.ts +1516 -0
  22. package/src/lib/azure/.gen/providers/azapi/resource-action/index.ts +935 -0
  23. package/src/lib/azure/.gen/providers/azapi/update-resource/index.ts +1042 -0
  24. package/src/lib/azure/.gen/versions.json +3 -0
  25. package/src/lib/azure/common/construct.ts +2 -0
  26. package/src/lib/azure/services/function/main.ts +95 -2
  27. package/src/lib/azure/services/function/types.ts +20 -1
  28. package/src/lib/azure/services/storage/main.ts +5 -3
@@ -0,0 +1,3 @@
1
+ {
2
+ "registry.terraform.io/azure/azapi": "2.2.0"
3
+ }
@@ -1,4 +1,5 @@
1
1
  import { AzurermProvider } from '@cdktf/provider-azurerm/lib/provider'
2
+ import { AzapiProvider } from '../.gen/providers/azapi/provider'
2
3
  import { DataAzurermClientConfig } from '@cdktf/provider-azurerm/lib/data-azurerm-client-config'
3
4
  import { AzurermBackend, TerraformStack } from 'cdktf'
4
5
  import { Construct } from 'constructs'
@@ -51,6 +52,7 @@ export class CommonAzureConstruct extends TerraformStack {
51
52
  this.determineRemoteBackend()
52
53
  this.determineTenantId()
53
54
  new AzurermProvider(this, `${this.id}-provider`, this.props)
55
+ new AzapiProvider(this, `${this.id}-azapi-provider`, this.props)
54
56
  }
55
57
 
56
58
  /**
@@ -1,9 +1,11 @@
1
1
  import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
2
+ import { DataAzurermLinuxFunctionApp } from '@cdktf/provider-azurerm/lib/data-azurerm-linux-function-app'
2
3
  import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app'
3
4
  import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function'
5
+ import { Resource } from '../../.gen/providers/azapi/resource'
4
6
  import { CommonAzureConstruct } from '../../common'
5
7
  import { createAzureTfOutput } from '../../utils'
6
- import { FunctionAppProps, FunctionProps } from './types'
8
+ import { FunctionAppProps, FunctionProps, FunctionAppFlexConsumptionProps } from './types'
7
9
 
8
10
  /**
9
11
  * @classdesc Provides operations on Azure Functions
@@ -16,7 +18,7 @@ import { FunctionAppProps, FunctionProps } from './types'
16
18
  * class CustomConstruct extends CommonAzureConstruct {
17
19
  * constructor(parent: Construct, id: string, props: CommonAzureStackProps) {
18
20
  * super(parent, id, props)
19
- * this.props = props
21
+ * this.props: props
20
22
  * this.functionManager.createFunctionApp('MyFunctionApp', this, props)
21
23
  * }
22
24
  * }
@@ -79,4 +81,95 @@ export class AzureFunctionManager {
79
81
 
80
82
  return functionAppFunction
81
83
  }
84
+
85
+ /**
86
+ * @summary Method to create a new flex consumption function app
87
+ * @param id scoped id of the resource
88
+ * @param scope scope in which this resource is defined
89
+ * @param props flex consumption function app properties
90
+ */
91
+ public createFunctionAppFlexConsumption(
92
+ id: string,
93
+ scope: CommonAzureConstruct,
94
+ props: FunctionAppFlexConsumptionProps
95
+ ) {
96
+ if (!props) throw `Props undefined for ${id}`
97
+
98
+ const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-fa-rg`, {
99
+ name: scope.props.resourceGroupName
100
+ ? `${scope.props.resourceGroupName}-${scope.props.stage}`
101
+ : `${props.resourceGroupName}`,
102
+ })
103
+
104
+ if (!resourceGroup) throw `Resource group undefined for ${id}`
105
+
106
+ const functionApp = new Resource(scope, `${id}-fa`, {
107
+ type: 'Microsoft.Web/sites@2023-12-01',
108
+ name: `${props.name}-${scope.props.stage}`,
109
+ location: resourceGroup.location,
110
+ parentId: resourceGroup.id,
111
+
112
+ body: {
113
+ kind: props.kind || 'functionapp,linux',
114
+
115
+ properties: {
116
+ serverFarmId: props.appServicePlanId,
117
+ httpsOnly: props.httpsOnly || true,
118
+
119
+ functionAppConfig: {
120
+ deployment: {
121
+ storage: {
122
+ type: props.deploymentStorageType || 'blobContainer',
123
+ value: `${props.blobEndpoint}${props.containerName}`,
124
+ authentication: {
125
+ type: props.deploymentAuthenticationType || 'StorageAccountConnectionString',
126
+ storageAccountConnectionStringName:
127
+ props.storageAccountConnectionStringName || 'DEPLOYMENT_STORAGE_CONNECTION_STRING',
128
+ },
129
+ },
130
+ },
131
+ runtime: {
132
+ name: props.runtime || 'node',
133
+ version: props.runtimeVersion || '20',
134
+ },
135
+ scaleAndConcurrency: {
136
+ instanceMemoryMB: props.instanceMemory || 2048,
137
+ maximumInstanceCount: props.maximumInstanceCount || 40,
138
+ triggers: {},
139
+ },
140
+ },
141
+
142
+ siteConfig: {
143
+ appSettings: props.appSettings.concat([
144
+ {
145
+ name: 'FUNCTIONS_EXTENSION_VERSION',
146
+ value: '~4',
147
+ },
148
+ {
149
+ name: 'AzureWebJobsStorage',
150
+ value: props.storageConnectionString,
151
+ },
152
+ {
153
+ name: 'DEPLOYMENT_STORAGE_CONNECTION_STRING',
154
+ value: props.storageConnectionString,
155
+ },
156
+ ]),
157
+ },
158
+ },
159
+ },
160
+
161
+ identity: [{ type: 'SystemAssigned' }],
162
+
163
+ ignoreMissingProperty: true,
164
+ ignoreCasing: true,
165
+ schemaValidationEnabled: false,
166
+ })
167
+
168
+ const functionAppFlexConsumption = new DataAzurermLinuxFunctionApp(scope, `${id}-fa-flex`, {
169
+ name: functionApp.name,
170
+ resourceGroupName: resourceGroup.name,
171
+ })
172
+
173
+ return functionAppFlexConsumption
174
+ }
82
175
  }
@@ -1,7 +1,26 @@
1
1
  import { LinuxFunctionAppConfig } from '@cdktf/provider-azurerm/lib/linux-function-app'
2
2
  import { FunctionAppFunctionConfig } from '@cdktf/provider-azurerm/lib/function-app-function'
3
- import { BaseAzureConfigProps } from '../../types'
3
+ import { ResourceConfig } from '../../.gen/providers/azapi/resource'
4
4
 
5
5
  export interface FunctionAppProps extends LinuxFunctionAppConfig {}
6
6
 
7
7
  export interface FunctionProps extends FunctionAppFunctionConfig {}
8
+
9
+ export interface FunctionAppFlexConsumptionProps {
10
+ appServicePlanId: string
11
+ appSettings: any
12
+ blobEndpoint: string
13
+ containerName: string
14
+ deploymentAuthenticationType?: string
15
+ deploymentStorageType?: string
16
+ httpsOnly?: string
17
+ instanceMemory?: number
18
+ kind?: string
19
+ maximumInstanceCount?: number
20
+ name: string
21
+ resourceGroupName: string
22
+ runtime?: string
23
+ runtimeVersion?: string
24
+ storageAccountConnectionStringName?: string
25
+ storageConnectionString: string
26
+ }
@@ -81,14 +81,15 @@ export class AzureStorageManager {
81
81
  if (!resourceGroup) throw `Resource group undefined for ${id}`
82
82
 
83
83
  const storageAccount = new DataAzurermStorageAccount(scope, `${id}-sa`, {
84
- name: `${props.storageAccountName}-${scope.props.stage}`,
84
+ name: `${props.storageAccountName}-${scope.props.stage}`.replace(/\W/g, '').toLowerCase(),
85
85
  resourceGroupName: resourceGroup.name,
86
86
  })
87
87
 
88
88
  const storageContainer = new StorageContainer(scope, `${id}-sc`, {
89
89
  ...props,
90
90
  name: `${props.name}-${scope.props.stage}`,
91
- storageAccountName: storageAccount.name,
91
+ 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.
92
+ storageAccountId: storageAccount.id,
92
93
  })
93
94
 
94
95
  createAzureTfOutput(`${id}-storageContainerName`, scope, storageContainer.name)
@@ -123,7 +124,8 @@ export class AzureStorageManager {
123
124
 
124
125
  const storageContainer = new DataAzurermStorageContainer(scope, `${id}-sc`, {
125
126
  name: `${props.storageContainerName}-${scope.props.stage}`,
126
- storageAccountName: storageAccount.name,
127
+ 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.
128
+ storageAccountId: storageAccount.id,
127
129
  })
128
130
 
129
131
  const storageBlob = new StorageBlob(scope, `${id}-sb`, {