Skip to content

Commit c1f3317

Browse files
feat: Container App - Updated UDTs to pending specs (#4123)
## Description Updated user-defined types with pending Azure/Azure-Verified-Modules#1738 & #4098. ## Pipeline Reference <!-- Insert your Pipeline Status Badge below --> | Pipeline | | -------- | | [![avm.res.app.container-app](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.app.container-app.yml/badge.svg?branch=users%2Falsehr%2FcontainerApp_udt&event=workflow_dispatch)](https://github.com/Azure/bicep-registry-modules/actions/workflows/avm.res.app.container-app.yml) | ## Type of Change <!-- Use the checkboxes [x] on the options that are relevant. --> - [ ] Update to CI Environment or utilities (Non-module affecting changes) - [x] Azure Verified Module updates: - [ ] Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in `version.json`: - [ ] Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description. - [ ] The bug was found by the module author, and no one has opened an issue to report it yet. - [ ] Feature update backwards compatible feature updates, and I have bumped the MINOR version in `version.json`. - [ ] Breaking changes and I have bumped the MAJOR version in `version.json`. - [ ] Update to documentation
1 parent a0c48e2 commit c1f3317

File tree

3 files changed

+251
-215
lines changed

3 files changed

+251
-215
lines changed

avm/res/app/container-app/README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This module deploys a Container App.
88
- [Usage examples](#Usage-examples)
99
- [Parameters](#Parameters)
1010
- [Outputs](#Outputs)
11+
- [Cross-referenced modules](#Cross-referenced-modules)
1112
- [Data Collection](#Data-Collection)
1213

1314
## Resource Types
@@ -1086,7 +1087,7 @@ List of probes for the container.
10861087
| [`initialDelaySeconds`](#parameter-containersprobesinitialdelayseconds) | int | Number of seconds after the container has started before liveness probes are initiated. |
10871088
| [`periodSeconds`](#parameter-containersprobesperiodseconds) | int | How often (in seconds) to perform the probe. Default to 10 seconds. |
10881089
| [`successThreshold`](#parameter-containersprobessuccessthreshold) | int | Minimum consecutive successes for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness and startup. |
1089-
| [`tcpSocket`](#parameter-containersprobestcpsocket) | object | TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. |
1090+
| [`tcpSocket`](#parameter-containersprobestcpsocket) | object | The TCP socket specifies an action involving a TCP port. TCP hooks not yet supported. |
10901091
| [`terminationGracePeriodSeconds`](#parameter-containersprobesterminationgraceperiodseconds) | int | Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is an alpha field and requires enabling ProbeTerminationGracePeriod feature gate. Maximum value is 3600 seconds (1 hour). |
10911092
| [`timeoutSeconds`](#parameter-containersprobestimeoutseconds) | int | Number of seconds after which the probe times out. Defaults to 1 second. |
10921093
| [`type`](#parameter-containersprobestype) | string | The type of probe. |
@@ -1230,7 +1231,7 @@ Minimum consecutive successes for the probe to be considered successful after ha
12301231

12311232
### Parameter: `containers.probes.tcpSocket`
12321233

1233-
TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported.
1234+
The TCP socket specifies an action involving a TCP port. TCP hooks not yet supported.
12341235

12351236
- Required: No
12361237
- Type: object
@@ -1650,7 +1651,7 @@ The managed identity definition for this resource.
16501651
| Parameter | Type | Description |
16511652
| :-- | :-- | :-- |
16521653
| [`systemAssigned`](#parameter-managedidentitiessystemassigned) | bool | Enables system assigned managed identity on the resource. |
1653-
| [`userAssignedResourceIds`](#parameter-managedidentitiesuserassignedresourceids) | array | The resource ID(s) to assign to the resource. |
1654+
| [`userAssignedResourceIds`](#parameter-managedidentitiesuserassignedresourceids) | array | The resource ID(s) to assign to the resource. Required if a user assigned identity is used for encryption. |
16541655

16551656
### Parameter: `managedIdentities.systemAssigned`
16561657

@@ -1661,7 +1662,7 @@ Enables system assigned managed identity on the resource.
16611662

16621663
### Parameter: `managedIdentities.userAssignedResourceIds`
16631664

1664-
The resource ID(s) to assign to the resource.
1665+
The resource ID(s) to assign to the resource. Required if a user assigned identity is used for encryption.
16651666

16661667
- Required: No
16671668
- Type: array
@@ -1943,6 +1944,14 @@ Workload profile name to pin for container app execution.
19431944
| `resourceId` | string | The resource ID of the Container App. |
19441945
| `systemAssignedMIPrincipalId` | string | The principal ID of the system assigned identity. |
19451946

1947+
## Cross-referenced modules
1948+
1949+
This section gives you an overview of all local-referenced module files (i.e., other modules that are referenced in this module) and all remote-referenced files (i.e., Bicep modules that are referenced from a Bicep Registry or Template Specs).
1950+
1951+
| Reference | Type |
1952+
| :-- | :-- |
1953+
| `br/public:avm/utl/types/avm-common-types:0.4.1` | Remote reference |
1954+
19461955
## Data Collection
19471956

19481957
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the [repository](https://aka.ms/avm/telemetry). There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

avm/res/app/container-app/main.bicep

Lines changed: 41 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ param ingressExternal bool = true
2323
param clientCertificateMode string = 'ignore'
2424

2525
@description('Optional. Object userd to configure CORS policy.')
26-
param corsPolicy corsPolicyType
26+
param corsPolicy corsPolicyType?
2727

2828
@allowed([
2929
'none'
@@ -48,7 +48,7 @@ param service object = {}
4848
param includeAddOns bool = false
4949

5050
@description('Optional. Settings to expose additional ports on container app.')
51-
param additionalPortMappings ingressPortMapping[]?
51+
param additionalPortMappings ingressPortMappingType[]?
5252

5353
@description('Optional. Bool indicating if HTTP connections to is allowed. If set to false HTTP connections are automatically redirected to HTTPS connections.')
5454
param ingressAllowInsecure bool = true
@@ -66,7 +66,7 @@ param scaleMinReplicas int = 3
6666
param scaleRules array = []
6767

6868
@description('Optional. List of container app services bound to the app.')
69-
param serviceBinds serviceBind[]?
69+
param serviceBinds serviceBindingType[]?
7070

7171
@allowed([
7272
'Multiple'
@@ -78,20 +78,23 @@ param activeRevisionsMode string = 'Single'
7878
@description('Required. Resource ID of environment.')
7979
param environmentResourceId string
8080

81+
import { lockType } from 'br/public:avm/utl/types/avm-common-types:0.4.1'
8182
@description('Optional. The lock settings of the service.')
82-
param lock lockType
83+
param lock lockType?
8384

8485
@description('Optional. Tags of the resource.')
8586
param tags object?
8687

8788
@description('Optional. Collection of private container registry credentials for containers used by the Container app.')
8889
param registries array = []
8990

91+
import { managedIdentityAllType } from 'br/public:avm/utl/types/avm-common-types:0.4.1'
9092
@description('Optional. The managed identity definition for this resource.')
91-
param managedIdentities managedIdentitiesType
93+
param managedIdentities managedIdentityAllType?
9294

95+
import { roleAssignmentType } from 'br/public:avm/utl/types/avm-common-types:0.4.1'
9396
@description('Optional. Array of role assignments to create.')
94-
param roleAssignments roleAssignmentType
97+
param roleAssignments roleAssignmentType[]?
9598

9699
@description('Optional. Enable/Disable usage telemetry for module.')
97100
param enableTelemetry bool = true
@@ -124,7 +127,7 @@ param dapr object = {}
124127
param maxInactiveRevisions int = 0
125128

126129
@description('Required. List of container definitions for the Container App.')
127-
param containers container[]
130+
param containers containerType[]
128131

129132
@description('Optional. List of specialized containers that run before app containers.')
130133
param initContainersTemplate array = []
@@ -323,57 +326,17 @@ output location string = containerApp.location
323326
// Definitions //
324327
// =============== //
325328

326-
type managedIdentitiesType = {
327-
@description('Optional. Enables system assigned managed identity on the resource.')
328-
systemAssigned: bool?
329-
330-
@description('Optional. The resource ID(s) to assign to the resource.')
331-
userAssignedResourceIds: string[]?
332-
}?
333-
334-
type lockType = {
335-
@description('Optional. Specify the name of lock.')
336-
name: string?
337-
338-
@description('Optional. Specify the type of lock.')
339-
kind: ('CanNotDelete' | 'ReadOnly' | 'None')?
340-
}?
341-
342-
type roleAssignmentType = {
343-
@description('Optional. The name (as GUID) of the role assignment. If not provided, a GUID will be generated.')
344-
name: string?
345-
346-
@description('Required. The role to assign. You can provide either the display name of the role definition, the role definition GUID, or its fully qualified ID in the following format: \'/providers/Microsoft.Authorization/roleDefinitions/c2f4ef07-c644-48eb-af81-4b1b4947fb11\'.')
347-
roleDefinitionIdOrName: string
348-
349-
@description('Required. The principal ID of the principal (user/group/identity) to assign the role to.')
350-
principalId: string
351-
352-
@description('Optional. The principal type of the assigned principal ID.')
353-
principalType: ('ServicePrincipal' | 'Group' | 'User' | 'ForeignGroup' | 'Device')?
354-
355-
@description('Optional. The description of the role assignment.')
356-
description: string?
357-
358-
@description('Optional. The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase "foo_storage_container".')
359-
condition: string?
360-
361-
@description('Optional. Version of the condition.')
362-
conditionVersion: '2.0'?
363-
364-
@description('Optional. The Resource Id of the delegated managed identity resource.')
365-
delegatedManagedIdentityResourceId: string?
366-
}[]?
367-
368-
type container = {
329+
@export()
330+
@description('The type for a container.')
331+
type containerType = {
369332
@description('Optional. Container start command arguments.')
370333
args: string[]?
371334

372335
@description('Optional. Container start command.')
373336
command: string[]?
374337

375338
@description('Optional. Container environment variables.')
376-
env: environmentVar[]?
339+
env: environmentVarType[]?
377340

378341
@description('Required. Container image tag.')
379342
image: string
@@ -382,16 +345,18 @@ type container = {
382345
name: string?
383346

384347
@description('Optional. List of probes for the container.')
385-
probes: containerAppProbe[]?
348+
probes: containerAppProbeType[]?
386349

387350
@description('Required. Container resource requirements.')
388351
resources: object
389352

390353
@description('Optional. Container volume mounts.')
391-
volumeMounts: volumeMount[]?
354+
volumeMounts: volumeMountType[]?
392355
}
393356

394-
type ingressPortMapping = {
357+
@export()
358+
@description('The type for an ingress port mapping.')
359+
type ingressPortMappingType = {
395360
@description('Optional. Specifies the exposed port for the target port. If not specified, it defaults to target port.')
396361
exposedPort: int?
397362

@@ -402,15 +367,18 @@ type ingressPortMapping = {
402367
targetPort: int
403368
}
404369

405-
type serviceBind = {
370+
@description('The type for a service binding.')
371+
type serviceBindingType = {
406372
@description('Required. The name of the service.')
407373
name: string
408374

409375
@description('Required. The service ID.')
410376
serviceId: string
411377
}
412378

413-
type environmentVar = {
379+
@export()
380+
@description('The type for an environment variable.')
381+
type environmentVarType = {
414382
@description('Required. Environment variable name.')
415383
name: string
416384

@@ -421,14 +389,15 @@ type environmentVar = {
421389
value: string?
422390
}
423391

424-
type containerAppProbe = {
392+
@description('The type for a container app probe.')
393+
type containerAppProbeType = {
425394
@description('Optional. Minimum consecutive failures for the probe to be considered failed after having succeeded. Defaults to 3.')
426395
@minValue(1)
427396
@maxValue(10)
428397
failureThreshold: int?
429398

430399
@description('Optional. HTTPGet specifies the http request to perform.')
431-
httpGet: containerAppProbeHttpGet?
400+
httpGet: containerAppProbeHttpGetType?
432401

433402
@description('Optional. Number of seconds after the container has started before liveness probes are initiated.')
434403
@minValue(1)
@@ -445,8 +414,8 @@ type containerAppProbe = {
445414
@maxValue(10)
446415
successThreshold: int?
447416

448-
@description('Optional. TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported.')
449-
tcpSocket: containerAppProbeTcpSocket?
417+
@description('Optional. The TCP socket specifies an action involving a TCP port. TCP hooks not yet supported.')
418+
tcpSocket: containerAppProbeTcpSocketType?
450419

451420
@description('Optional. Optional duration in seconds the pod needs to terminate gracefully upon probe failure. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. If this value is nil, the pod\'s terminationGracePeriodSeconds will be used. Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut down). This is an alpha field and requires enabling ProbeTerminationGracePeriod feature gate. Maximum value is 3600 seconds (1 hour).')
452421
terminationGracePeriodSeconds: int?
@@ -460,6 +429,8 @@ type containerAppProbe = {
460429
type: ('Liveness' | 'Startup' | 'Readiness')?
461430
}
462431

432+
@export()
433+
@description('The type for a CORS policy.')
463434
type corsPolicyType = {
464435
@description('Optional. Switch to determine whether the resource allows credentials.')
465436
allowCredentials: bool?
@@ -478,14 +449,15 @@ type corsPolicyType = {
478449

479450
@description('Optional. Specifies the content for the access-control-max-age header.')
480451
maxAge: int?
481-
}?
452+
}
482453

483-
type containerAppProbeHttpGet = {
454+
@description('The type for a container app probe HTTP GET.')
455+
type containerAppProbeHttpGetType = {
484456
@description('Optional. Host name to connect to. Defaults to the pod IP.')
485457
host: string?
486458

487459
@description('Optional. HTTP headers to set in the request.')
488-
httpHeaders: containerAppProbeHttpGetHeadersItem[]?
460+
httpHeaders: containerAppProbeHttpGetHeadersItemType[]?
489461

490462
@description('Required. Path to access on the HTTP server.')
491463
path: string
@@ -497,15 +469,17 @@ type containerAppProbeHttpGet = {
497469
scheme: ('HTTP' | 'HTTPS')?
498470
}
499471

500-
type containerAppProbeHttpGetHeadersItem = {
472+
@description('The type for a container app probe HTTP GET header.')
473+
type containerAppProbeHttpGetHeadersItemType = {
501474
@description('Required. Name of the header.')
502475
name: string
503476

504477
@description('Required. Value of the header.')
505478
value: string
506479
}
507480

508-
type containerAppProbeTcpSocket = {
481+
@description('The type for a container app probe TCP socket.')
482+
type containerAppProbeTcpSocketType = {
509483
@description('Optional. Host name to connect to, defaults to the pod IP.')
510484
host: string?
511485

@@ -515,7 +489,8 @@ type containerAppProbeTcpSocket = {
515489
port: int
516490
}
517491

518-
type volumeMount = {
492+
@description('The type for a volume mount.')
493+
type volumeMountType = {
519494
@description('Required. Path within the container at which the volume should be mounted.Must not contain \':\'.')
520495
mountPath: string
521496

0 commit comments

Comments
 (0)