Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: site dns configuration #4373

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions avm/res/web/site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3061,6 +3061,7 @@ param siteConfig = {
| [`tags`](#parameter-tags) | object | Tags of the resource. |
| [`virtualNetworkSubnetId`](#parameter-virtualnetworksubnetid) | string | Azure Resource Manager ID of the Virtual network and subnet to be joined by Regional VNET Integration. This must be of the form /subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. |
| [`vnetContentShareEnabled`](#parameter-vnetcontentshareenabled) | bool | To enable accessing content over virtual network. |
| [`vnetDnsConfiguration`](#parameter-vnetdnsconfiguration) | object | Property to configure various DNS related settings for a site |
| [`vnetImagePullEnabled`](#parameter-vnetimagepullenabled) | bool | To enable pulling image over Virtual Network. |
| [`vnetRouteAllEnabled`](#parameter-vnetrouteallenabled) | bool | Virtual Network Route All enabled. This causes all outbound traffic to have Virtual Network Security Groups and User Defined Routes applied. |
| [`webConfiguration`](#parameter-webconfiguration) | object | The Site Config, Web settings to deploy. |
Expand Down Expand Up @@ -4117,6 +4118,64 @@ To enable accessing content over virtual network.
- Type: bool
- Default: `False`

### Parameter: `vnetDnsConfiguration`

Property to configure various DNS related settings for a site

- Required: No
- Type: object

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`dnsAltServer`](#parameter-vnetdnsconfigurationdnsaltserver) | string | Alternate DNS server to be used by apps. This property replicates the WEBSITE_DNS_ALT_SERVER app setting. |
| [`dnsMaxCacheTimeout`](#parameter-vnetdnsconfigurationdnsmaxcachetimeout) | int | Custom time for DNS to be cached in seconds. Allowed range: 0-60. Default is 30 seconds. 0 means caching disabled. |
| [`dnsRetryAttemptCount`](#parameter-vnetdnsconfigurationdnsretryattemptcount) | int | Total number of retries for dns lookup. Allowed range: 1-5. Default is 3. |
| [`dnsRetryAttemptTimeout`](#parameter-vnetdnsconfigurationdnsretryattempttimeout) | int | Timeout for a single dns lookup in seconds. Allowed range: 1-30. Default is 3. |
| [`dnsServers`](#parameter-vnetdnsconfigurationdnsservers) | array | List of custom DNS servers to be used by an app for lookups. Maximum 5 dns servers can be set. |

### Parameter: `vnetDnsConfiguration.dnsAltServer`

Alternate DNS server to be used by apps. This property replicates the WEBSITE_DNS_ALT_SERVER app setting.

- Required: No
- Type: string

### Parameter: `vnetDnsConfiguration.dnsMaxCacheTimeout`

Custom time for DNS to be cached in seconds. Allowed range: 0-60. Default is 30 seconds. 0 means caching disabled.

- Required: No
- Type: int

### Parameter: `vnetDnsConfiguration.dnsRetryAttemptCount`

Total number of retries for dns lookup. Allowed range: 1-5. Default is 3.

- Required: No
- Type: int
- MinValue: 1
- MaxValue: 5

### Parameter: `vnetDnsConfiguration.dnsRetryAttemptTimeout`

Timeout for a single dns lookup in seconds. Allowed range: 1-30. Default is 3.

- Required: No
- Type: int
- MinValue: 1
- MaxValue: 30

### Parameter: `vnetDnsConfiguration.dnsServers`

List of custom DNS servers to be used by an app for lookups. Maximum 5 dns servers can be set.

- Required: No
- Type: array
- MinValue: 1
- MaxValue: 30

### Parameter: `vnetImagePullEnabled`

To enable pulling image over Virtual Network.
Expand Down
28 changes: 28 additions & 0 deletions avm/res/web/site/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ param vnetImagePullEnabled bool = false
@description('Optional. Virtual Network Route All enabled. This causes all outbound traffic to have Virtual Network Security Groups and User Defined Routes applied.')
param vnetRouteAllEnabled bool = false

@description('Optional. Property to configure various DNS related settings for a site.')
param vnetDnsConfiguration vnetDnsConfigurationType?

@description('Optional. Stop SCM (KUDU) site when the app is stopped.')
param scmSiteAlsoStopped bool = false

Expand Down Expand Up @@ -294,6 +297,7 @@ resource app 'Microsoft.Web/sites@2024-04-01' = {
vnetContentShareEnabled: vnetContentShareEnabled
vnetImagePullEnabled: vnetImagePullEnabled
vnetRouteAllEnabled: vnetRouteAllEnabled
dnsConfiguration: vnetDnsConfiguration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it maybe make sense to add the same setting to the slot child module?

scmSiteAlsoStopped: scmSiteAlsoStopped
endToEndEncryptionEnabled: e2eEncryptionEnabled
}
Expand Down Expand Up @@ -541,6 +545,30 @@ module app_privateEndpoints 'br/public:avm/res/network/private-endpoint:0.7.1' =
}
]

@export()
@description('The type for a DNS configuration.')
type vnetDnsConfigurationType = {
@description('Optional. Alternate DNS server to be used by apps. This property replicates the WEBSITE_DNS_ALT_SERVER app setting.')
dnsAltServer: string?

@description('Optional. Custom time for DNS to be cached in seconds. Allowed range: 0-60. Default is 30 seconds. 0 means caching disabled.')
dnsMaxCacheTimeout: int?

@description('Optional. Total number of retries for dns lookup. Allowed range: 1-5. Default is 3.')
@maxValue(5)
@minValue(1)
dnsRetryAttemptCount: int?

@description('Optional. Timeout for a single dns lookup in seconds. Allowed range: 1-30. Default is 3.')
@maxValue(30)
@minValue(1)
dnsRetryAttemptTimeout: int?

@description('Optional. List of custom DNS servers to be used by an app for lookups. Maximum 5 dns servers can be set.')
@maxLength(5)
dnsServers: string[]?
}

@description('The name of the site.')
output name string = app.name

Expand Down
115 changes: 87 additions & 28 deletions avm/res/web/site/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,64 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "11078104901059265686"
"version": "0.33.13.18514",
"templateHash": "17112853441798085324"
},
"name": "Web/Function Apps",
"description": "This module deploys a Web or Function App."
},
"definitions": {
"vnetDnsConfigurationType": {
"type": "object",
"properties": {
"dnsAltServer": {
"type": "string",
"nullable": true,
"metadata": {
"description": "Optional. Alternate DNS server to be used by apps. This property replicates the WEBSITE_DNS_ALT_SERVER app setting."
}
},
"dnsMaxCacheTimeout": {
"type": "int",
"nullable": true,
"metadata": {
"description": "Optional. Custom time for DNS to be cached in seconds. Allowed range: 0-60. Default is 30 seconds. 0 means caching disabled."
}
},
"dnsRetryAttemptCount": {
"type": "int",
"nullable": true,
"minValue": 1,
"maxValue": 5,
"metadata": {
"description": "Optional. Total number of retries for dns lookup. Allowed range: 1-5. Default is 3."
}
},
"dnsRetryAttemptTimeout": {
"type": "int",
"nullable": true,
"minValue": 1,
"maxValue": 30,
"metadata": {
"description": "Optional. Timeout for a single dns lookup in seconds. Allowed range: 1-30. Default is 3."
}
},
"dnsServers": {
"type": "array",
"items": {
"type": "string"
},
"nullable": true,
"maxLength": 5,
"metadata": {
"description": "Optional. List of custom DNS servers to be used by an app for lookups. Maximum 5 dns servers can be set."
}
}
},
"metadata": {
"__bicep_export!": true
}
},
"_1.privateEndpointCustomDnsConfigType": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -636,6 +687,13 @@
"description": "Optional. Virtual Network Route All enabled. This causes all outbound traffic to have Virtual Network Security Groups and User Defined Routes applied."
}
},
"vnetDnsConfiguration": {
"$ref": "#/definitions/vnetDnsConfigurationType",
"nullable": true,
"metadata": {
"description": "Optional. Property to configure various DNS related settings for a site"
}
},
"scmSiteAlsoStopped": {
"type": "bool",
"defaultValue": false,
Expand Down Expand Up @@ -965,6 +1023,7 @@
"vnetContentShareEnabled": "[parameters('vnetContentShareEnabled')]",
"vnetImagePullEnabled": "[parameters('vnetImagePullEnabled')]",
"vnetRouteAllEnabled": "[parameters('vnetRouteAllEnabled')]",
"dnsConfiguration": "[parameters('vnetDnsConfiguration')]",
"scmSiteAlsoStopped": "[parameters('scmSiteAlsoStopped')]",
"endToEndEncryptionEnabled": "[parameters('e2eEncryptionEnabled')]"
}
Expand Down Expand Up @@ -1084,8 +1143,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "6410547302386858558"
"version": "0.33.13.18514",
"templateHash": "3773744005628323179"
},
"name": "Site App Settings",
"description": "This module deploys a Site App Setting."
Expand Down Expand Up @@ -1246,8 +1305,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "11113399312695963924"
"version": "0.33.13.18514",
"templateHash": "12604769145311962317"
},
"name": "Site Auth Settings V2 Config",
"description": "This module deploys a Site Auth Settings V2 Configuration."
Expand Down Expand Up @@ -1349,8 +1408,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "7848470524705559903"
"version": "0.33.13.18514",
"templateHash": "10353279242186955906"
},
"name": "Site logs Config",
"description": "This module deploys a Site logs Configuration."
Expand Down Expand Up @@ -1440,8 +1499,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "17229460238192107968"
"version": "0.33.13.18514",
"templateHash": "15063123874711680503"
},
"name": "Site Web Config",
"description": "This module deploys web settings configuration available under sites/config name: web."
Expand Down Expand Up @@ -1530,8 +1589,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "18138875055545072289"
"version": "0.33.13.18514",
"templateHash": "10653723640225381902"
},
"name": "Site Deployment Extension ",
"description": "This module deploys a Site extension for MSDeploy."
Expand Down Expand Up @@ -1748,8 +1807,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "12729018089714646839"
"version": "0.33.13.18514",
"templateHash": "13395324329635678417"
},
"name": "Web/Function App Deployment Slots",
"description": "This module deploys a Web or Function App Deployment Slot."
Expand Down Expand Up @@ -2784,8 +2843,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "10124842813698211071"
"version": "0.33.13.18514",
"templateHash": "6379851449588708934"
},
"name": "Site Slot App Settings",
"description": "This module deploys a Site Slot App Setting."
Expand Down Expand Up @@ -2961,8 +3020,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "7246612330843636406"
"version": "0.33.13.18514",
"templateHash": "4192061847386712633"
},
"name": "Site Slot Auth Settings V2 Config",
"description": "This module deploys a Site Auth Settings V2 Configuration."
Expand Down Expand Up @@ -3081,8 +3140,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "13728299747043713048"
"version": "0.33.13.18514",
"templateHash": "13483227944246460692"
},
"name": "Web Site Slot Basic Publishing Credentials Policies",
"description": "This module deploys a Web Site Slot Basic Publishing Credentials Policy."
Expand Down Expand Up @@ -3205,8 +3264,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "1399655044962772411"
"version": "0.33.13.18514",
"templateHash": "17428168852439619558"
},
"name": "Web/Function Apps Slot Hybrid Connection Relay",
"description": "This module deploys a Site Slot Hybrid Connection Namespace Relay."
Expand Down Expand Up @@ -3309,8 +3368,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "18138875055545072289"
"version": "0.33.13.18514",
"templateHash": "10653723640225381902"
},
"name": "Site Deployment Extension ",
"description": "This module deploys a Site extension for MSDeploy."
Expand Down Expand Up @@ -4230,8 +4289,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "7686713695944836722"
"version": "0.33.13.18514",
"templateHash": "1499299399255876013"
},
"name": "Web Site Basic Publishing Credentials Policies",
"description": "This module deploys a Web Site Basic Publishing Credentials Policy."
Expand Down Expand Up @@ -4345,8 +4404,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "6378705059063789109"
"version": "0.33.13.18514",
"templateHash": "3864138738153964150"
},
"name": "Web/Function Apps Hybrid Connection Relay",
"description": "This module deploys a Site Hybrid Connection Namespace Relay."
Expand Down
4 changes: 2 additions & 2 deletions avm/res/web/site/version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.13",
"version": "0.14",
"pathFilters": [
"./main.json"
]
}
}
Loading