Project: KICS (Provisioning / Security & Compliance)
File: 96fe318e-d631-4156-99fa-9080d57280ae.md

title: App Service Without Latest PHP Version hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 96fe318e-d631-4156-99fa-9080d57280ae Query name: App Service Without Latest PHP Version Platform: Terraform Severity: <span style="color:#edd57e">Low</span> Category: Best Practices URL: Periodically newer versions are released for PHP software either due to security flaws or to include additional functionality. Using the latest PHP version for web apps is recommended in order to take advantage of security fixes, if any, and/or additional functionalities of the newer version.<br> ```tf title="Positive test num. 1 - tf file" hl_lines="11" resource "azurermappservice" "example4" { name = "example4-app-service" location = azurermresourcegroup.example.location resourcegroupname = azurermresourcegroup.example.name appserviceplanid = azurermappserviceplan.example.id site_config { dotnetframeworkversion = "v4.0" scm_type = "LocalGit" php_version = "7.3" } app_settings = { "SOME_KEY" = "some-value" } connection_string { name = "Database" type = "SQLServer" value = "Server=some-server.mydomain.com;Integrated Security=SSPI" } } ``` ```tf title="Positive test num. 2 - tf file" hl_lines="25" provider "azurerm" { features {} } resource "azurermresourcegroup" "example" { name = "example-resources" location = "West Europe" } resource "azurermserviceplan" "example" { name = "example" resourcegroupname = azurermresourcegroup.example.name location = azurermresourcegroup.example.location sku_name = "P1v2" } resource "azurermwindowsweb_app" "example5" { name = "example5" resourcegroupname = azurermresourcegroup.example.name location = azurermserviceplan.example.location serviceplanid = azurermserviceplan.example.id site_config{ application_stack{ php_version = "v7.3" } } } ``` ```tf title="Positive test num. 3 - tf file" hl_lines="26" provider "azurerm" { features {} } resource "azurermresourcegroup" "example" { name = "example-resources" location = "West Europe" } resource "azurermserviceplan" "example" { name = "example" resourcegroupname = azurermresourcegroup.example.name location = azurermresourcegroup.example.location os_type = "Linux" sku_name = "P1v2" } resource "azurermlinuxweb_app" "example6" { name = "example6" resourcegroupname = azurermresourcegroup.example.name location = azurermserviceplan.example.location serviceplanid = azurermserviceplan.example.id site_config{ application_stack{ php_version = "7.4" } } } ``` ```tf title="Negative test num. 1 - tf file" resource "azurermappservice" "example1" { name = "example1-app-service" location = azurermresourcegroup.example.location resourcegroupname = azurermresourcegroup.example.name appserviceplanid = azurermappserviceplan.example.id site_config { dotnetframeworkversion = "v4.0" scm_type = "LocalGit" php_version = "8.1" } app_settings = { "SOME_KEY" = "some-value" } connection_string { name = "Database" type = "SQLServer" value = "Server=some-server.mydomain.com;Integrated Security=SSPI" } } ``` ```tf title="Negative test num. 2 - tf file" provider "azurerm" { features {} } resource "azurermresourcegroup" "example" { name = "example-resources" location = "West Europe" } resource "azurermserviceplan" "example" { name = "example" resourcegroupname = azurermresourcegroup.example.name location = azurermresourcegroup.example.location sku_name = "P1v2" } resource "azurermwindowsweb_app" "example2" { name = "example2" resourcegroupname = azurermresourcegroup.example.name location = azurermserviceplan.example.location serviceplanid = azurermserviceplan.example.id site_config{ application_stack{ php_version = "v8.1" } } } ``` ```tf title="Negative test num. 3 - tf file" provider "azurerm" { features {} } resource "azurermresourcegroup" "example" { name = "example-resources" location = "West Europe" } resource "azurermserviceplan" "example" { name = "example" resourcegroupname = azurermresourcegroup.example.name location = azurermresourcegroup.example.location sku_name = "P1v2" } resource "azurermlinuxweb_app" "example3" { name = "example3" resourcegroupname = azurermresourcegroup.example.name location = azurermserviceplan.example.location serviceplanid = azurermserviceplan.example.id site_config{ application_stack{ php_version = "8.1" } } } ```