Skip to content

Commit f265c58

Browse files
authored
Registry block for Custom Container Apps is optional (#342)
* Made 'registry' property optional for Custom Container Apps * Updated 'registry' block to be set only if var is not null
1 parent d2a7ca7 commit f265c58

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ module "azure_container_apps_hosting" {
729729
| <a name="input_container_scale_out_rule_end"></a> [container\_scale\_out\_rule\_end](#input\_container\_scale\_out\_rule\_end) | Specify a time using Linux cron format that represents the end of the scale-out window. Defaults to 18:00 | `string` | `"0 18 * * *"` | no |
730730
| <a name="input_container_scale_out_rule_start"></a> [container\_scale\_out\_rule\_start](#input\_container\_scale\_out\_rule\_start) | Specify a time using Linux cron format that represents the start of the scale-out window. Defaults to 08:00 | `string` | `"0 8 * * *"` | no |
731731
| <a name="input_container_secret_environment_variables"></a> [container\_secret\_environment\_variables](#input\_container\_secret\_environment\_variables) | Container environment variables, which are defined as `secrets` within the container app configuration. This is to help reduce the risk of accidentally exposing secrets. | `map(string)` | `{}` | no |
732-
| <a name="input_custom_container_apps"></a> [custom\_container\_apps](#input\_custom\_container\_apps) | Custom container apps, by default deployed within the container app environment managed by this module. | <pre>map(object({<br> container_app_environment_id = optional(string, "")<br> resource_group_name = optional(string, "")<br> revision_mode = optional(string, "Single")<br> container_port = optional(number, 0)<br> ingress = optional(object({<br> external_enabled = optional(bool, true)<br> target_port = optional(number, null)<br> traffic_weight = object({<br> percentage = optional(number, 100)<br> })<br> cdn_frontdoor_custom_domain = optional(string, "")<br> cdn_frontdoor_origin_fqdn_override = optional(string, "")<br> cdn_frontdoor_origin_host_header_override = optional(string, "")<br> enable_cdn_frontdoor_health_probe = optional(bool, false)<br> cdn_frontdoor_health_probe_protocol = optional(string, "")<br> cdn_frontdoor_health_probe_interval = optional(number, 120)<br> cdn_frontdoor_health_probe_request_type = optional(string, "")<br> cdn_frontdoor_health_probe_path = optional(string, "")<br> cdn_frontdoor_forwarding_protocol_override = optional(string, "")<br> }), null)<br> identity = optional(list(object({<br> type = string<br> identity_ids = list(string)<br> })), [])<br> secrets = optional(list(object({<br> name = string<br> value = string<br> })), [])<br> registry = object({<br> server = optional(string, "")<br> username = optional(string, "")<br> password_secret_name = optional(string, "")<br> identity = optional(string, "")<br> }),<br> image = string<br> cpu = number<br> memory = number<br> command = list(string)<br> liveness_probes = optional(list(object({<br> interval_seconds = number<br> transport = string<br> port = number<br> path = optional(string, null)<br> })), [])<br> env = optional(list(object({<br> name = string<br> value = optional(string, null)<br> secretRef = optional(string, null)<br> })), [])<br> min_replicas = number<br> max_replicas = number<br> }))</pre> | `{}` | no |
732+
| <a name="input_custom_container_apps"></a> [custom\_container\_apps](#input\_custom\_container\_apps) | Custom container apps, by default deployed within the container app environment managed by this module. | <pre>map(object({<br> container_app_environment_id = optional(string, "")<br> resource_group_name = optional(string, "")<br> revision_mode = optional(string, "Single")<br> container_port = optional(number, 0)<br> ingress = optional(object({<br> external_enabled = optional(bool, true)<br> target_port = optional(number, null)<br> traffic_weight = object({<br> percentage = optional(number, 100)<br> })<br> cdn_frontdoor_custom_domain = optional(string, "")<br> cdn_frontdoor_origin_fqdn_override = optional(string, "")<br> cdn_frontdoor_origin_host_header_override = optional(string, "")<br> enable_cdn_frontdoor_health_probe = optional(bool, false)<br> cdn_frontdoor_health_probe_protocol = optional(string, "")<br> cdn_frontdoor_health_probe_interval = optional(number, 120)<br> cdn_frontdoor_health_probe_request_type = optional(string, "")<br> cdn_frontdoor_health_probe_path = optional(string, "")<br> cdn_frontdoor_forwarding_protocol_override = optional(string, "")<br> }), null)<br> identity = optional(list(object({<br> type = string<br> identity_ids = list(string)<br> })), [])<br> secrets = optional(list(object({<br> name = string<br> value = string<br> })), [])<br> registry = optional(object({<br> server = optional(string, "")<br> username = optional(string, "")<br> password_secret_name = optional(string, "")<br> identity = optional(string, "")<br> }), null),<br> image = string<br> cpu = number<br> memory = number<br> command = list(string)<br> liveness_probes = optional(list(object({<br> interval_seconds = number<br> transport = string<br> port = number<br> path = optional(string, null)<br> })), [])<br> env = optional(list(object({<br> name = string<br> value = optional(string, null)<br> secretRef = optional(string, null)<br> })), [])<br> min_replicas = number<br> max_replicas = number<br> }))</pre> | `{}` | no |
733733
| <a name="input_dns_a_records"></a> [dns\_a\_records](#input\_dns\_a\_records) | DNS A records to add to the DNS Zone | <pre>map(<br> object({<br> ttl : optional(number, 300),<br> records : list(string)<br> })<br> )</pre> | `{}` | no |
734734
| <a name="input_dns_aaaa_records"></a> [dns\_aaaa\_records](#input\_dns\_aaaa\_records) | DNS AAAA records to add to the DNS Zone | <pre>map(<br> object({<br> ttl : optional(number, 300),<br> records : list(string)<br> })<br> )</pre> | `{}` | no |
735735
| <a name="input_dns_alias_records"></a> [dns\_alias\_records](#input\_dns\_alias\_records) | DNS ALIAS records to add to the DNS Zone | <pre>map(<br> object({<br> ttl : optional(number, 300),<br> target_resource_id : string<br> })<br> )</pre> | `{}` | no |

custom-container-apps.tf

+9-5
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,15 @@ resource "azurerm_container_app" "custom_container_apps" {
4949
}
5050
}
5151

52-
registry {
53-
server = each.value.registry.server != "" ? each.value.registry.server : local.registry_server
54-
username = each.value.registry.identity == "" ? each.value.registry.username != "" ? each.value.registry.username : local.registry_username : null
55-
password_secret_name = each.value.registry.identity == "" ? each.value.registry.password_secret_name != "" ? each.value.registry.password_secret_name : "acr-password" : null
56-
identity = each.value.registry.identity != "" ? each.value.registry.identity : null
52+
dynamic "registry" {
53+
for_each = each.value.registry != null ? [1] : []
54+
55+
content {
56+
server = each.value.registry.server != "" ? each.value.registry.server : local.registry_server
57+
username = each.value.registry.identity == "" ? each.value.registry.username != "" ? each.value.registry.username : local.registry_username : null
58+
password_secret_name = each.value.registry.identity == "" ? each.value.registry.password_secret_name != "" ? each.value.registry.password_secret_name : "acr-password" : null
59+
identity = each.value.registry.identity != "" ? each.value.registry.identity : null
60+
}
5761
}
5862

5963
template {

variables.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -1052,12 +1052,12 @@ variable "custom_container_apps" {
10521052
name = string
10531053
value = string
10541054
})), [])
1055-
registry = object({
1055+
registry = optional(object({
10561056
server = optional(string, "")
10571057
username = optional(string, "")
10581058
password_secret_name = optional(string, "")
10591059
identity = optional(string, "")
1060-
}),
1060+
}), null),
10611061
image = string
10621062
cpu = number
10631063
memory = number

0 commit comments

Comments
 (0)