1
1
import { DataAzurermResourceGroup } from '@cdktf/provider-azurerm/lib/data-azurerm-resource-group'
2
- import { DataAzurermFunctionApp } from '@cdktf/provider-azurerm/lib/data-azurerm-function-app'
3
- import { FunctionApp } from '@cdktf/provider-azurerm/lib/function-app'
2
+ import { LinuxFunctionApp } from '@cdktf/provider-azurerm/lib/linux-function-app'
4
3
import { FunctionAppFunction } from '@cdktf/provider-azurerm/lib/function-app-function'
5
4
import { CommonAzureConstruct } from '../../common'
6
5
import { createAzureTfOutput } from '../../utils'
@@ -37,12 +36,12 @@ export class AzureFunctionManager {
37
36
const resourceGroup = new DataAzurermResourceGroup ( scope , `${ id } -fa-rg` , {
38
37
name : scope . props . resourceGroupName
39
38
? `${ scope . props . resourceGroupName } -${ scope . props . stage } `
40
- : `${ props . resourceGroupName } - ${ scope . props . stage } ` ,
39
+ : `${ props . resourceGroupName } ` ,
41
40
} )
42
41
43
42
if ( ! resourceGroup ) throw `Resource group undefined for ${ id } `
44
43
45
- const functionApp = new FunctionApp ( scope , `${ id } -fa` , {
44
+ const functionApp = new LinuxFunctionApp ( scope , `${ id } -fa` , {
46
45
...props ,
47
46
name : `${ props . name } -${ scope . props . stage } ` ,
48
47
resourceGroupName : resourceGroup . name ,
@@ -68,22 +67,10 @@ export class AzureFunctionManager {
68
67
public createFunction ( id : string , scope : CommonAzureConstruct , props : FunctionProps ) {
69
68
if ( ! props ) throw `Props undefined for ${ id } `
70
69
71
- const resourceGroup = new DataAzurermResourceGroup ( scope , `${ id } -sb-rg` , {
72
- name : scope . props . resourceGroupName
73
- ? `${ scope . props . resourceGroupName } -${ scope . props . stage } `
74
- : `${ props . resourceGroupName } -${ scope . props . stage } ` ,
75
- } )
76
-
77
- if ( ! resourceGroup ) throw `Resource group undefined for ${ id } `
78
-
79
- const storageAccount = new DataAzurermFunctionApp ( scope , `${ id } -sa` , {
80
- name : `${ props . functionAppName } -${ scope . props . stage } ` ,
81
- resourceGroupName : resourceGroup . name ,
82
- } )
83
-
84
70
const functionAppFunction = new FunctionAppFunction ( scope , `${ id } -fc` , {
85
71
...props ,
86
72
name : `${ props . name } -${ scope . props . stage } ` ,
73
+ configJson : JSON . stringify ( props . configJson || { } ) ,
87
74
} )
88
75
89
76
createAzureTfOutput ( `${ id } -functionName` , scope , functionAppFunction . name )
0 commit comments