We have a requirement to set the vnetPrivatePortsCount which is a Configuration setting of Standard logic app. However, so far we could not find a way to set it via terraform. We use azurerm_logic_app_standard object to create Logic apps so we need an option to set it via that.
We have tried doing below but that does not work
site_config {
vnet_private_ports_count = 2
}
Is this property not available via terraform or am I missing something? Our terraform version is 1.8.5 and azurerm version is 3.106.1
Azure Logic app standard - set vnetPrivatePortsCount via Terraform
As per the documentation by hashicorp the vnet_private_ports_count
for logic App standard doesn't support as this feature need to be added.
Meanwhile we can leverage the same requirement using the CLI commands using null resource.
Terraform configuration:
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = var.resource_group_name
location = var.location
}
resource "azurerm_app_service_plan" "example" {
name = var.app_service_plan_name
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku {
tier = "WorkflowStandard"
size = "WS1"
}
}
resource "azurerm_storage_account" "example" {
name = var.storage_account_name
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_logic_app_standard" "example" {
name = var.logic_app_name
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
storage_account_name = azurerm_storage_account.example.name
storage_account_access_key = azurerm_storage_account.example.primary_access_key
identity {
type = "SystemAssigned"
}
site_config {
always_on = true
}
}
resource "null_resource" "set_vnet_private_ports_count" {
provisioner "local-exec" {
interpreter = ["pwsh", "-Command"]
command = <<EOT
az resource update --resource-group ${azurerm_resource_group.example.name} --name ${azurerm_logic_app_standard.example.name} --resource-type 'Microsoft.Web/sites' --set properties.siteConfig.vnetPrivatePortsCount=2
EOT
}
depends_on = [azurerm_logic_app_standard.example]
}
variable.tf:
variable "resource_group_name" {
default = "vinay-resources"
}
variable "location" {
default = "East US"
}
variable "app_service_plan_name" {
default = "vinay-appserviceplan"
}
variable "logic_app_name" {
default = "vinay-logicapp"
}
variable "storage_account_name" {
default = "sampvksbeacct"
}
Deployment succeeded:
Reference:
We can check with supported versions from
https://learn.microsoft.com/en-us/azure/templates/microsoft.logic/allversions