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: Update avm/res/web/static-site - Add additional param for publicNetworkAccess #4286

Open
wants to merge 77 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
7ecd1a5
adding deployment files
ChrisSidebotham Oct 12, 2023
0f15c86
ficing rp ref
ChrisSidebotham Oct 12, 2023
c6993a6
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Oct 13, 2023
0e65d72
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Oct 17, 2023
482add6
Adding workflow file
ChrisSidebotham Oct 17, 2023
1bffa61
Merge branch 'Azure:main' into main
ChrisSidebotham Oct 18, 2023
8c358e7
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Oct 18, 2023
14a5d0d
Merge branch 'main' of https://github.com/ChrisSidebotham/bicep-regis…
ChrisSidebotham Oct 18, 2023
fba5375
fixing path
ChrisSidebotham Oct 18, 2023
05152a8
Fixing Workflow name
ChrisSidebotham Oct 18, 2023
f8d04c6
adding workflow
ChrisSidebotham Oct 19, 2023
d22a6c7
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Oct 25, 2023
6993c4d
Adding Workflow file
ChrisSidebotham Oct 25, 2023
cf44304
Adding workflow file
ChrisSidebotham Oct 27, 2023
5260056
Merge branch 'anchor' of https://github.com/ChrisSidebotham/bicep-reg…
ChrisSidebotham Oct 30, 2023
3740075
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Nov 1, 2023
c9b6b4c
Adding workflow file
ChrisSidebotham Nov 1, 2023
a3d83a4
adding workflow
ChrisSidebotham Nov 24, 2023
915d12c
Fixing workflow name
ChrisSidebotham Nov 24, 2023
1c56bb3
update workflow
ChrisSidebotham Nov 30, 2023
454bcc5
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Dec 5, 2023
fe017c1
updating Test Case s location to fix Pipeline
ChrisSidebotham Dec 12, 2023
ddb6e04
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Dec 12, 2023
1931d9a
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Dec 18, 2023
657311c
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Dec 18, 2023
fff3279
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Dec 22, 2023
c5f6e4f
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Dec 22, 2023
ffc5837
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Jan 2, 2024
e9b2e80
adding workflow
ChrisSidebotham Jan 2, 2024
018c016
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Jan 4, 2024
9a3e2bc
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Jan 9, 2024
ebed1d1
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Jan 11, 2024
d587154
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Jan 17, 2024
18a9a54
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Jan 30, 2024
bb9037e
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Jan 30, 2024
de4e665
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Feb 4, 2024
8994eff
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Feb 14, 2024
88df6f6
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Feb 15, 2024
cdfb68d
Adding workflow
ChrisSidebotham Feb 15, 2024
0e3020f
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Feb 28, 2024
40614c1
Update forwardTo property to null if empty
ChrisSidebotham Feb 28, 2024
4240d6c
Update templateHash values in Service Bus Namespace and Topic
ChrisSidebotham Feb 28, 2024
6e16d58
Merge branch 'main' into anchor
ChrisSidebotham Mar 4, 2024
d41dec0
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Mar 4, 2024
689f23d
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Apr 5, 2024
6cd9703
Merge branch 'main' of https://github.com/Azure/bicep-registry-modules
ChrisSidebotham Apr 5, 2024
27de0ec
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Apr 11, 2024
3249154
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Apr 12, 2024
65802d0
Merge branch 'Azure:main' into anchor
ChrisSidebotham May 8, 2024
8a0d70b
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham May 21, 2024
e19c970
Merge branch 'Azure:main' into main
ChrisSidebotham May 21, 2024
dc5e12d
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham May 22, 2024
379534f
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham May 22, 2024
77e2f8c
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham May 23, 2024
6e0b216
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham May 24, 2024
e4cf2a0
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham May 29, 2024
bacee7d
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Jun 12, 2024
e8c9b85
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Jun 26, 2024
4ca1290
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Aug 1, 2024
3211b7c
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Aug 13, 2024
bb507f9
#2578
ChrisSidebotham Aug 13, 2024
7ec58b0
typo
ChrisSidebotham Aug 13, 2024
88d09f1
typo
ChrisSidebotham Aug 13, 2024
0a7cefc
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Sep 6, 2024
64d7206
Merge branch 'anchor' of https://github.com/ChrisSidebotham/bicep-reg…
ChrisSidebotham Sep 6, 2024
ff6facc
Adding logic to skip for non resource modules
ChrisSidebotham Sep 6, 2024
d0dadd0
chore: Remove trailing whitespace in main.json file
ChrisSidebotham Sep 6, 2024
77014ff
Merge branch 'anchor' of https://github.com/ChrisSidebotham/bicep-reg…
ChrisSidebotham Oct 8, 2024
c679dd1
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Oct 10, 2024
3dff828
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Oct 30, 2024
6c9b47e
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Nov 6, 2024
6579a77
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Dec 9, 2024
783a91c
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Jan 16, 2025
739c32a
Merge branch 'main' of https://github.com/Azure/bicep-registry-module…
ChrisSidebotham Jan 24, 2025
f7ebd4f
Changes to support [AVM Module Issue]: Static Web App missing `public…
ChrisSidebotham Jan 24, 2025
1d694a3
update to execution type
ChrisSidebotham Jan 27, 2025
eb676fb
refactor: Update publicNetworkAccess parameter description and allowe…
ChrisSidebotham Jan 27, 2025
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
11 changes: 10 additions & 1 deletion avm/res/web/static-site/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This module deploys a Static Web App.
| `Microsoft.Authorization/roleAssignments` | [2022-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2022-04-01/roleAssignments) |
| `Microsoft.Network/privateEndpoints` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-11-01/privateEndpoints) |
| `Microsoft.Network/privateEndpoints/privateDnsZoneGroups` | [2023-11-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Network/2023-11-01/privateEndpoints/privateDnsZoneGroups) |
| `Microsoft.Web/staticSites` | [2021-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/2021-03-01/staticSites) |
| `Microsoft.Web/staticSites` | [2024-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/2024-04-01/staticSites) |
| `Microsoft.Web/staticSites/config` | [2022-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/2022-03-01/staticSites/config) |
| `Microsoft.Web/staticSites/customDomains` | [2022-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/2022-03-01/staticSites/customDomains) |
| `Microsoft.Web/staticSites/linkedBackends` | [2022-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Web/2022-03-01/staticSites/linkedBackends) |
Expand Down Expand Up @@ -619,6 +619,7 @@ param tags = {
| [`managedIdentities`](#parameter-managedidentities) | object | The managed identity definition for this resource. |
| [`privateEndpoints`](#parameter-privateendpoints) | array | Configuration details for private endpoints. For security reasons, it is recommended to use private endpoints whenever possible. Note, requires the 'sku' to be 'Standard'. |
| [`provider`](#parameter-provider) | string | The provider that submitted the last deployment to the primary environment of the static site. |
| [`publicNetworkAccess`](#parameter-publicnetworkaccess) | string | The public network access settings for the static site. `Disabled` is configured by default. |
| [`repositoryToken`](#parameter-repositorytoken) | securestring | The Personal Access Token for accessing the GitHub repository. |
| [`repositoryUrl`](#parameter-repositoryurl) | string | The name of the GitHub repository. |
| [`roleAssignments`](#parameter-roleassignments) | array | Array of role assignments to create. |
Expand Down Expand Up @@ -1204,6 +1205,14 @@ The provider that submitted the last deployment to the primary environment of th
- Type: string
- Default: `'None'`

### Parameter: `publicNetworkAccess`

The public network access settings for the static site. `Disabled` is configured by default.

- Required: No
- Type: string
- Default: `'Disabled'`

### Parameter: `repositoryToken`

The Personal Access Token for accessing the GitHub repository.
Expand Down
6 changes: 5 additions & 1 deletion avm/res/web/static-site/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ param functionAppSettings object = {}
@description('Optional. The custom domains associated with this static site. The deployment will fail as long as the validation records are not present.')
param customDomains array = []

@description('Optional. The public network access settings for the static site. `Disabled` is configured by default.')
Copy link
Contributor

Choose a reason for hiding this comment

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

Leveraging the PR to trigger a discussion about this setting in general and current implementation across the library.
I see the inconsistency is strong with this one.
In CARML we started disabling publicNetworkAccess within the resource implementation instead of through its default value, and only in case private endpoint is enabled. This is still the current implementation for multiple modules, such as for example storage-account
The reasoning behind was that it won't be useful to disable public network access by default if private endpoint is not configured. In these cases the default value is set to empty ''.
Meanwhile, many other resource modules are now disabling publicNetworkAccess by default via default values in AVM. An example is RSV. In these cases the default value is set to Disabled.
Needless to say, we also have cases where the default value is set to Enabled.
I think it would be nice to align the behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

I could imagine that some resources may have PSRule tests that request one or the other. Don't have an example at hand though (for RSV, for example, this test does not exist, so I guess the person implementing the parameter simply decided that it would be a good solution).
One added caveat is that aside from PEs, one could also navigate to a resource like a storage account using service endpoints, making the matter even harder to define a default for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am about t commit another push to this which updates it to the same configuration as we use for PaaS Services, but I am removing networkacl as this is not supportted for this resource

param publicNetworkAccess string = 'Disabled'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
param publicNetworkAccess string = 'Disabled'
@allowed([
''
'Enabled'
'Disabled'
])
param publicNetworkAccess string = 'Disabled'

Requires a regeneration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

applied


var formattedUserAssignedIdentities = reduce(
map((managedIdentities.?userAssignedResourceIds ?? []), (id) => { '${id}': {} }),
{},
Expand Down Expand Up @@ -155,7 +158,7 @@ resource avmTelemetry 'Microsoft.Resources/deployments@2024-03-01' = if (enableT
}
}

resource staticSite 'Microsoft.Web/staticSites@2021-03-01' = {
resource staticSite 'Microsoft.Web/staticSites@2024-04-01' = {
name: name
location: location
tags: tags
Expand All @@ -174,6 +177,7 @@ resource staticSite 'Microsoft.Web/staticSites@2021-03-01' = {
repositoryToken: repositoryToken
repositoryUrl: repositoryUrl
templateProperties: templateProperties
publicNetworkAccess: publicNetworkAccess
}
}

Expand Down
18 changes: 13 additions & 5 deletions avm/res/web/static-site/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.32.4.45862",
"templateHash": "7497371071073742378"
"templateHash": "11046224615249635639"
},
"name": "Static Web Apps",
"description": "This module deploys a Static Web App."
Expand Down Expand Up @@ -572,6 +572,13 @@
"metadata": {
"description": "Optional. The custom domains associated with this static site. The deployment will fail as long as the validation records are not present."
}
},
"publicNetworkAccess": {
"type": "string",
"defaultValue": "Disabled",
"metadata": {
"description": "Optional. The public network access settings for the static site. `Disabled` is configured by default."
}
}
},
"variables": {
Expand Down Expand Up @@ -617,7 +624,7 @@
},
"staticSite": {
"type": "Microsoft.Web/staticSites",
"apiVersion": "2021-03-01",
"apiVersion": "2024-04-01",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
Expand All @@ -635,7 +642,8 @@
"buildProperties": "[parameters('buildProperties')]",
"repositoryToken": "[parameters('repositoryToken')]",
"repositoryUrl": "[parameters('repositoryUrl')]",
"templateProperties": "[parameters('templateProperties')]"
"templateProperties": "[parameters('templateProperties')]",
"publicNetworkAccess": "[parameters('publicNetworkAccess')]"
}
},
"staticSite_lock": {
Expand Down Expand Up @@ -1851,14 +1859,14 @@
"metadata": {
"description": "The principal ID of the system assigned identity."
},
"value": "[tryGet(tryGet(reference('staticSite', '2021-03-01', 'full'), 'identity'), 'principalId')]"
"value": "[tryGet(tryGet(reference('staticSite', '2024-04-01', 'full'), 'identity'), 'principalId')]"
},
"location": {
"type": "string",
"metadata": {
"description": "The location the resource was deployed into."
},
"value": "[reference('staticSite', '2021-03-01', 'full').location]"
"value": "[reference('staticSite', '2024-04-01', 'full').location]"
},
"defaultHostname": {
"type": "string",
Expand Down
Loading