11<!-- BEGIN_TF_DOCS -->
2- # terraform-azurerm-avm-template
2+ # terraform-azurerm-avm-res-container-apps
33
4- This is a template repo for Terraform Azure Verified Modules.
4+ This is a repo for Container Apps in the style of Azure Verified Modules (AVM), it is an 'unofficial' example that has been used for learning AVM.
5+
6+ Note this uses the AZAPI provider because of support missing within the AzureRM provider for [ workload profiles] ( https://github.com/hashicorp/terraform-provider-azurerm/issues/21747 ) .
7+
8+ Once required functionality is available within AzureRM, [ azapi2azurerm] ( https://github.com/Azure/azapi2azurerm ) can be used to convert this code.
9+
10+ This project includes [ examples] ( ./examples/ ) showing default settings and an example from Microsoft Learn illustrating Dapr.
511
612Things to do:
713
@@ -20,7 +26,9 @@ Things to do:
2026
2127The following requirements are needed by this module:
2228
23- - <a name =" requirement_terraform " ></a > [ terraform] ( #requirement\_ terraform ) (>= 1.0.0)
29+ - <a name =" requirement_terraform " ></a > [ terraform] ( #requirement\_ terraform ) (>= 1.3.0)
30+
31+ - <a name =" requirement_azapi " ></a > [ azapi] ( #requirement\_ azapi ) (1.9.0)
2432
2533- <a name =" requirement_azurerm " ></a > [ azurerm] ( #requirement\_ azurerm ) (>= 3.71.0)
2634
@@ -30,6 +38,8 @@ The following requirements are needed by this module:
3038
3139The following providers are used by this module:
3240
41+ - <a name =" provider_azapi " ></a > [ azapi] ( #provider\_ azapi ) (1.9.0)
42+
3343- <a name =" provider_azurerm " ></a > [ azurerm] ( #provider\_ azurerm ) (>= 3.71.0)
3444
3545- <a name =" provider_random " ></a > [ random] ( #provider\_ random ) (>= 3.5.0)
@@ -38,14 +48,222 @@ The following providers are used by this module:
3848
3949The following resources are used by this module:
4050
51+ - [ azapi_resource.container_app] ( https://registry.terraform.io/providers/Azure/azapi/1.9.0/docs/resources/resource ) (resource)
4152- [ azurerm_resource_group_template_deployment.telemetry] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group_template_deployment ) (resource)
4253- [ random_id.telem] ( https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id ) (resource)
54+ - [ azurerm_resource_group.rg] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group ) (data source)
4355
4456<!-- markdownlint-disable MD013 -->
4557## Required Inputs
4658
4759The following input variables are required:
4860
61+ ### <a name =" input_container_app_environment_resource_id " ></a > [ container\_ app\_ environment\_ resource\_ id] ( #input\_ container\_ app\_ environment\_ resource\_ id )
62+
63+ Description: Resource ID of environment.
64+
65+ Type: ` string `
66+
67+ ### <a name =" input_container_apps " ></a > [ container\_ apps] ( #input\_ container\_ apps )
68+
69+ Description: Specifies the container apps in the managed environment.
70+
71+ Type:
72+
73+ ``` hcl
74+ list(object({
75+ name = string
76+ revision_mode = optional(string, "Single")
77+
78+ dapr = optional(object({
79+ appId = optional(string)
80+ appPort = optional(number)
81+ appProtocol = optional(string)
82+ enableApiLogging = optional(bool)
83+ enabled = optional(bool)
84+ httpMaxRequestSize = optional(number)
85+ httpReadBufferSize = optional(number)
86+ logLevel = optional(string)
87+ }))
88+ ingress = optional(object({
89+ allowInsecure = optional(bool)
90+ clientCertificateMode = optional(string)
91+ corsPolicy = optional(object({
92+ allowCredentials = optional(bool)
93+ allowedHeaders = optional(list(string))
94+ allowedMethods = optional(list(string))
95+ allowedOrigins = optional(list(string))
96+ exposeHeaders = optional(list(string))
97+ maxAge = optional(number)
98+ }))
99+ customDomains = optional(list(object({
100+ bindingType = optional(string)
101+ certificateId = optional(string)
102+ name = optional(string)
103+ })))
104+ exposedPort = optional(number)
105+ external = optional(bool)
106+ ipSecurityRestrictions = optional(list(object({
107+ action = optional(string)
108+ description = optional(string)
109+ ipAddressRange = optional(string)
110+ name = optional(string)
111+ })))
112+ stickySessions = optional(object({
113+ affinity = optional(string)
114+ }))
115+ targetPort = optional(number)
116+ traffic = optional(list(object({
117+ label = optional(string)
118+ latestRevision = optional(bool)
119+ revisionName = optional(string)
120+ weight = optional(number)
121+ })))
122+ transport = optional(string)
123+ }))
124+ maxInactiveRevisions = optional(number)
125+ registries = optional(list(object({
126+ identity = optional(string)
127+ passwordSecretRef = optional(string)
128+ server = optional(string)
129+ username = optional(string)
130+ })))
131+ secrets = optional(list(object({
132+ identity = optional(string)
133+ keyVaultUrl = optional(string)
134+ name = string
135+ value = string
136+ })))
137+ service = optional(object({
138+ type = optional(string)
139+ }))
140+
141+ template = object({
142+ containers = list(object({
143+ args = optional(list(string))
144+ command = optional(list(string))
145+ env = optional(list(object({
146+ name = string
147+ secretRef = optional(string)
148+ value = optional(string)
149+ })))
150+ image = string
151+ name = string
152+ probes = optional(list(object({
153+ failureThreshold = optional(number)
154+ httpGet = optional(object({
155+ host = optional(string)
156+ httpHeaders = optional(list(object({
157+ name = string
158+ value = string
159+ })))
160+ path = optional(string)
161+ port = optional(number)
162+ scheme = optional(string)
163+ }))
164+ initialDelaySeconds = optional(number)
165+ periodSeconds = optional(number)
166+ successThreshold = optional(number)
167+ tcpSocket = optional(object({
168+ host = optional(string)
169+ port = optional(number)
170+ }))
171+ terminationGracePeriodSeconds = optional(number)
172+ timeoutSeconds = optional(number)
173+ type = optional(string)
174+ })))
175+ resources = optional(object({
176+ cpu = optional(string)
177+ memory = optional(string)
178+ }))
179+ volumeMounts = optional(list(object({
180+ mountPath = optional(string)
181+ subPath = optional(string)
182+ volumeName = optional(string)
183+ })))
184+ }))
185+ initContainers = optional(list(object({
186+ args = optional(list(string))
187+ command = optional(list(string))
188+ env = optional(list(object({
189+ name = string
190+ secretRef = optional(string)
191+ value = optional(string)
192+ })))
193+ image = string
194+ name = string
195+ resources = optional(object({
196+ cpu = optional(string)
197+ memory = optional(string)
198+ }))
199+ volumeMounts = optional(list(object({
200+ mountPath = optional(string)
201+ subPath = optional(string)
202+ volumeName = optional(string)
203+ })))
204+ })))
205+ revisionSuffix = optional(string, null)
206+ scale = optional(object({
207+ maxReplicas = optional(number)
208+ minReplicas = optional(number)
209+ rules = optional(list(object({
210+ azureQueue = optional(object({
211+ auth = optional(list(object({
212+ secretRef = string
213+ triggerParameter = string
214+ })))
215+ queueLength = optional(number)
216+ queueName = optional(string)
217+ }))
218+ custom = optional(object({
219+ auth = optional(list(object({
220+ secretRef = string
221+ triggerParameter = string
222+ })))
223+ metadata = optional(map(string))
224+ type = optional(string)
225+ }))
226+ http = optional(object({
227+ auth = optional(list(object({
228+ secretRef = string
229+ triggerParameter = string
230+ })))
231+ metadata = optional(map(string))
232+ }))
233+ name = optional(string)
234+ tcp = optional(object({
235+ auth = optional(list(object({
236+ secretRef = string
237+ triggerParameter = string
238+ })))
239+ metadata = optional(map(string))
240+ }))
241+ })))
242+ }))
243+ serviceBinds = optional(list(object({
244+ name = string
245+ serviceId = string
246+ })))
247+ volumes = optional(list(object({
248+ mountOptions = string
249+ name = string
250+ secrets = optional(list(object({
251+ path = string
252+ secretRef = string
253+ })))
254+ storageName = string
255+ storageType = string
256+ })))
257+ })
258+ }))
259+ ```
260+
261+ ### <a name =" input_name " ></a > [ name] ( #input\_ name )
262+
263+ Description: Name for the resource.
264+
265+ Type: ` string `
266+
49267### <a name =" input_resource_group_name " ></a > [ resource\_ group\_ name] ( #input\_ resource\_ group\_ name )
50268
51269Description: The resource group where the resources will be deployed.
@@ -64,11 +282,47 @@ If it is set to false, then no telemetry will be collected.
64282
65283Type: ` bool `
66284
67- Default: ` true `
285+ Default: ` false `
286+
287+ ### <a name =" input_location " ></a > [ location] ( #input\_ location )
288+
289+ Description: Azure region where the resource should be deployed.
290+
291+ Type: ` string `
292+
293+ Default: ` null `
294+
295+ ### <a name =" input_tags " ></a > [ tags] ( #input\_ tags )
296+
297+ Description: Custom tags to apply to the resource.
298+
299+ Type: ` map(string) `
300+
301+ Default: ` {} `
302+
303+ ### <a name =" input_user_identity_resource_id " ></a > [ user\_ identity\_ resource\_ id] ( #input\_ user\_ identity\_ resource\_ id )
304+
305+ Description: The managed identity definition for this resource.
306+
307+ Type: ` string `
308+
309+ Default: ` "" `
310+
311+ ### <a name =" input_workload_profile_name " ></a > [ workload\_ profile\_ name] ( #input\_ workload\_ profile\_ name )
312+
313+ Description: Workload profile name to pin for container app execution. If not set, workload profiles are not used.
314+
315+ Type: ` string `
316+
317+ Default: ` null `
68318
69319## Outputs
70320
71- No outputs.
321+ The following outputs are exported:
322+
323+ ### <a name =" output_resource " ></a > [ resource] ( #output\_ resource )
324+
325+ Description: The Container Apps resource.
72326
73327## Modules
74328
0 commit comments