@gradientedge/cdk-utils 9.38.0 → 9.38.1
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/services/function/main.js +8 -0
- package/dist/src/lib/azure/services/function/types.d.ts +2 -0
- package/dist/src/lib/azure/services/storage/main.js +0 -13
- package/package.json +1 -1
- package/src/lib/azure/services/function/main.ts +9 -0
- package/src/lib/azure/services/function/types.ts +2 -0
- package/src/lib/azure/services/storage/main.ts +0 -15
|
@@ -5,6 +5,7 @@ const data_azurerm_resource_group_1 = require("@cdktf/provider-azurerm/lib/data-
|
|
|
5
5
|
const linux_function_app_1 = require("@cdktf/provider-azurerm/lib/linux-function-app");
|
|
6
6
|
const function_app_function_1 = require("@cdktf/provider-azurerm/lib/function-app-function");
|
|
7
7
|
const resource_1 = require("../../.gen/providers/azapi/resource");
|
|
8
|
+
const cdktf_local_exec_1 = require("cdktf-local-exec");
|
|
8
9
|
const utils_1 = require("../../utils");
|
|
9
10
|
/**
|
|
10
11
|
* @classdesc Provides operations on Azure Functions
|
|
@@ -144,6 +145,13 @@ class AzureFunctionManager {
|
|
|
144
145
|
ignoreCasing: true,
|
|
145
146
|
schemaValidationEnabled: false,
|
|
146
147
|
});
|
|
148
|
+
new cdktf_local_exec_1.Provider(scope, `${id}-local-exec-provider`);
|
|
149
|
+
new cdktf_local_exec_1.LocalExec(scope, `${id}-function-app-deploy`, {
|
|
150
|
+
triggers: {
|
|
151
|
+
hash: props.sourceCodeHash,
|
|
152
|
+
},
|
|
153
|
+
command: `az functionapp deployment source config-zip --resource-group ${resourceGroup.name} --name ${functionApp.name} --src ${props.deploySource}`,
|
|
154
|
+
});
|
|
147
155
|
return functionApp;
|
|
148
156
|
}
|
|
149
157
|
}
|
|
@@ -68,22 +68,9 @@ class AzureStorageManager {
|
|
|
68
68
|
createStorageContainer(id, scope, props) {
|
|
69
69
|
if (!props)
|
|
70
70
|
throw `Props undefined for ${id}`;
|
|
71
|
-
const resourceGroup = new data_azurerm_resource_group_1.DataAzurermResourceGroup(scope, `${id}-sc-rg`, {
|
|
72
|
-
name: scope.props.resourceGroupName
|
|
73
|
-
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
74
|
-
: `${props.resourceGroupName}`,
|
|
75
|
-
});
|
|
76
|
-
if (!resourceGroup)
|
|
77
|
-
throw `Resource group undefined for ${id}`;
|
|
78
|
-
const storageAccount = new data_azurerm_storage_account_1.DataAzurermStorageAccount(scope, `${id}-sa`, {
|
|
79
|
-
name: `${props.storageAccountName}-${scope.props.stage}`.replace(/\W/g, '').toLowerCase(),
|
|
80
|
-
resourceGroupName: resourceGroup.name,
|
|
81
|
-
});
|
|
82
71
|
const storageContainer = new storage_container_1.StorageContainer(scope, `${id}-sc`, {
|
|
83
72
|
...props,
|
|
84
73
|
name: `${props.name}-${scope.props.stage}`,
|
|
85
|
-
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.
|
|
86
|
-
storageAccountId: storageAccount.id,
|
|
87
74
|
});
|
|
88
75
|
(0, utils_1.createAzureTfOutput)(`${id}-storageContainerName`, scope, storageContainer.name);
|
|
89
76
|
(0, utils_1.createAzureTfOutput)(`${id}-storageContainerFriendlyUniqueId`, scope, storageContainer.friendlyUniqueId);
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azure
|
|
|
2
2
|
import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app'
|
|
3
3
|
import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function'
|
|
4
4
|
import { Resource } from '../../.gen/providers/azapi/resource'
|
|
5
|
+
import { LocalExec, Provider } from 'cdktf-local-exec'
|
|
5
6
|
import { CommonAzureConstruct } from '../../common'
|
|
6
7
|
import { createAzureTfOutput } from '../../utils'
|
|
7
8
|
import { FunctionAppProps, FunctionProps, FunctionAppFlexConsumptionProps } from './types'
|
|
@@ -164,6 +165,14 @@ export class AzureFunctionManager {
|
|
|
164
165
|
schemaValidationEnabled: false,
|
|
165
166
|
})
|
|
166
167
|
|
|
168
|
+
new Provider(scope, `${id}-local-exec-provider`)
|
|
169
|
+
new LocalExec(scope, `${id}-function-app-deploy`, {
|
|
170
|
+
triggers: {
|
|
171
|
+
hash: props.sourceCodeHash,
|
|
172
|
+
},
|
|
173
|
+
command: `az functionapp deployment source config-zip --resource-group ${resourceGroup.name} --name ${functionApp.name} --src ${props.deploySource}`,
|
|
174
|
+
})
|
|
175
|
+
|
|
167
176
|
return functionApp
|
|
168
177
|
}
|
|
169
178
|
}
|
|
@@ -72,24 +72,9 @@ export class AzureStorageManager {
|
|
|
72
72
|
public createStorageContainer(id: string, scope: CommonAzureConstruct, props: StorageContainerProps) {
|
|
73
73
|
if (!props) throw `Props undefined for ${id}`
|
|
74
74
|
|
|
75
|
-
const resourceGroup = new DataAzurermResourceGroup(scope, `${id}-sc-rg`, {
|
|
76
|
-
name: scope.props.resourceGroupName
|
|
77
|
-
? `${scope.props.resourceGroupName}-${scope.props.stage}`
|
|
78
|
-
: `${props.resourceGroupName}`,
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
if (!resourceGroup) throw `Resource group undefined for ${id}`
|
|
82
|
-
|
|
83
|
-
const storageAccount = new DataAzurermStorageAccount(scope, `${id}-sa`, {
|
|
84
|
-
name: `${props.storageAccountName}-${scope.props.stage}`.replace(/\W/g, '').toLowerCase(),
|
|
85
|
-
resourceGroupName: resourceGroup.name,
|
|
86
|
-
})
|
|
87
|
-
|
|
88
75
|
const storageContainer = new StorageContainer(scope, `${id}-sc`, {
|
|
89
76
|
...props,
|
|
90
77
|
name: `${props.name}-${scope.props.stage}`,
|
|
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,
|
|
93
78
|
})
|
|
94
79
|
|
|
95
80
|
createAzureTfOutput(`${id}-storageContainerName`, scope, storageContainer.name)
|