Skip to content

Commit

Permalink
Merge branch 'main' into fix/cleanup-codeowners-issuetemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSidebotham authored May 22, 2024
2 parents 210acd5 + 07699bd commit 34f3989
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 28 deletions.
16 changes: 16 additions & 0 deletions avm/res/app/container-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ module containerApp 'br/public:avm/res/app/container-app:<version>' = {
| [`scaleMinReplicas`](#parameter-scaleminreplicas) | int | Minimum number of container replicas. Defaults to 3 if not set. |
| [`scaleRules`](#parameter-scalerules) | array | Scaling rules. |
| [`secrets`](#parameter-secrets) | secureObject | The secrets of the Container App. |
| [`stickySessionsAffinity`](#parameter-stickysessionsaffinity) | string | Bool indicating if the Container App should enable session affinity. |
| [`tags`](#parameter-tags) | object | Tags of the resource. |
| [`trafficLabel`](#parameter-trafficlabel) | string | Associates a traffic label with a revision. Label name should be consist of lower case alphanumeric characters or dashes. |
| [`trafficLatestRevision`](#parameter-trafficlatestrevision) | bool | Indicates that the traffic weight belongs to a latest stable revision. |
Expand Down Expand Up @@ -834,6 +835,21 @@ The secrets of the Container App.
- Type: secureObject
- Default: `{}`

### Parameter: `stickySessionsAffinity`

Bool indicating if the Container App should enable session affinity.

- Required: No
- Type: string
- Default: `'none'`
- Allowed:
```Bicep
[
'none'
'sticky'
]
```

### Parameter: `tags`

Tags of the resource.
Expand Down
56 changes: 32 additions & 24 deletions avm/res/app/container-app/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ param location string = resourceGroup().location
@description('Optional. Bool indicating if the App exposes an external HTTP endpoint.')
param ingressExternal bool = true

@allowed([
'none'
'sticky'
])
@description('Optional. Bool indicating if the Container App should enable session affinity.')
param stickySessionsAffinity string = 'none'

@allowed([
'auto'
'http'
Expand Down Expand Up @@ -144,24 +151,23 @@ var builtInRoleNames = {
)
}

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' =
if (enableTelemetry) {
name: '46d3xbcp.res.app-containerapp.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
outputs: {
telemetry: {
type: 'String'
value: 'For more information, see https://aka.ms/avm/TelemetryInfo'
}
resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableTelemetry) {
name: '46d3xbcp.res.app-containerapp.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
outputs: {
telemetry: {
type: 'String'
value: 'For more information, see https://aka.ms/avm/TelemetryInfo'
}
}
}
}
}

resource containerApp 'Microsoft.App/containerApps@2023-05-01' = {
name: name
Expand All @@ -180,6 +186,9 @@ resource containerApp 'Microsoft.App/containerApps@2023-05-01' = {
external: ingressExternal
ipSecurityRestrictions: !empty(ipSecurityRestrictions) ? ipSecurityRestrictions : null
targetPort: ingressTargetPort
stickySessions: {
affinity: stickySessionsAffinity
}
traffic: [
{
label: trafficLabel
Expand Down Expand Up @@ -209,17 +218,16 @@ resource containerApp 'Microsoft.App/containerApps@2023-05-01' = {
}
}

resource containerApp_lock 'Microsoft.Authorization/locks@2020-05-01' =
if (!empty(lock ?? {}) && lock.?kind != 'None') {
name: lock.?name ?? 'lock-${name}'
properties: {
level: lock.?kind ?? ''
notes: lock.?kind == 'CanNotDelete'
? 'Cannot delete resource or child resources.'
: 'Cannot delete or modify the resource or child resources.'
}
scope: containerApp
resource containerApp_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock ?? {}) && lock.?kind != 'None') {
name: lock.?name ?? 'lock-${name}'
properties: {
level: lock.?kind ?? ''
notes: lock.?kind == 'CanNotDelete'
? 'Cannot delete resource or child resources.'
: 'Cannot delete or modify the resource or child resources.'
}
scope: containerApp
}

resource containerApp_roleAssignments 'Microsoft.Authorization/roleAssignments@2022-04-01' = [
for (roleAssignment, index) in (roleAssignments ?? []): {
Expand Down
18 changes: 16 additions & 2 deletions avm/res/app/container-app/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.170.59819",
"templateHash": "11829581770848647649"
"version": "0.27.1.19265",
"templateHash": "6545722573689550634"
},
"name": "Container Apps",
"description": "This module deploys a Container App.",
Expand Down Expand Up @@ -149,6 +149,17 @@
"description": "Optional. Bool indicating if the App exposes an external HTTP endpoint."
}
},
"stickySessionsAffinity": {
"type": "string",
"defaultValue": "none",
"allowedValues": [
"none",
"sticky"
],
"metadata": {
"description": "Optional. Bool indicating if the Container App should enable session affinity."
}
},
"ingressTransport": {
"type": "string",
"defaultValue": "auto",
Expand Down Expand Up @@ -411,6 +422,9 @@
"external": "[parameters('ingressExternal')]",
"ipSecurityRestrictions": "[if(not(empty(parameters('ipSecurityRestrictions'))), parameters('ipSecurityRestrictions'), null())]",
"targetPort": "[parameters('ingressTargetPort')]",
"stickySessions": {
"affinity": "[parameters('stickySessionsAffinity')]"
},
"traffic": [
{
"label": "[parameters('trafficLabel')]",
Expand Down
4 changes: 2 additions & 2 deletions avm/res/app/container-app/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.2",
"version": "0.3",
"pathFilters": [
"./main.json"
]
}
}

0 comments on commit 34f3989

Please sign in to comment.