-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction-create.tf
27 lines (25 loc) · 902 Bytes
/
function-create.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
resource "azurerm_function_app_function" "bastion-snooze-create" {
name = "Create-Azure-Bastion"
function_app_id = azurerm_windows_function_app.bastion-snooze.id
language = "PowerShell"
file {
name = "run.ps1"
content = <<EOT
param($Timer)
$vNet = Get-AzVirtualNetwork -Name $env:BASTION_VNET_NAME -ResourceGroupName $env:BASTION_VNET_RG
$pip = Get-AzPublicIpAddress -Name $env:BASTION_PIP_NAME -ResourceGroupName $env:BASTION_PIP_RG
Set-AzContext -Subscription '${data.azurerm_subscription.current.display_name}'
New-AzBastion -Name $env:BASTION_NAME -ResourceGroupName $env:BASTION_RG -VirtualNetwork $vNet -PublicIpAddress $pip -AsJob
EOT
}
config_json = jsonencode({
"bindings" = [
{
"direction" = "in"
"name" = "Timer"
"type" = "timerTrigger"
"schedule" : "${var.CreateSchedule}"
}
]
})
}