-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathvariables.tf
More file actions
2150 lines (2019 loc) · 101 KB
/
variables.tf
File metadata and controls
2150 lines (2019 loc) · 101 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
variable "location" {
type = string
description = "Azure region where the resource should be deployed."
nullable = false
}
variable "name" {
type = string
description = "The name which should be used for the App Service."
nullable = false
}
variable "parent_id" {
type = string
description = "The resource ID of the Resource Group where the App Service will be deployed."
nullable = false
validation {
error_message = "The value must be a valid Azure Resource Group resource ID. e.g. `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}`"
condition = can(regex("^/subscriptions/[a-f0-9-]+/resourceGroups/[a-zA-Z0-9._-]+$", var.parent_id))
}
}
variable "service_plan_resource_id" {
type = string
description = "The resource ID of the App Service Plan to deploy the App Service in."
nullable = false
validation {
error_message = "The value must be a valid Azure App Service Plan resource ID. e.g. `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverFarms/{serverFarmName}`"
condition = can(regex("^/subscriptions/[a-f0-9-]+/resourceGroups/[a-zA-Z0-9._-]+/providers/Microsoft.Web/[sS]erver[fF]arms/[a-zA-Z0-9._-]+$", var.service_plan_resource_id))
}
}
variable "all_child_resources_inherit_tags" {
type = bool
default = true
description = "Should child resources inherit tags from the parent resource? Defaults to `true`."
}
variable "always_ready" {
type = map(object({
name = optional(string)
instance_count = optional(number, 0)
}))
default = {}
description = <<DESCRIPTION
A map of always-ready instances for Flex Consumption Function Apps.
- `name`: The trigger type or function name. Valid values: `http`, `blob`, `durable`, `function:<target-function-app-name>`.
- `instance_count`: The number of always-ready instances. Defaults to `0`.
DESCRIPTION
}
variable "app_service_active_slot" {
type = object({
slot_key = optional(string)
overwrite_network_config = optional(bool, true)
})
default = null
description = <<DESCRIPTION
Object that sets the active slot for the App Service.
- `slot_key` - The key of the slot object to set as active.
- `overwrite_network_config` - Determines if the network configuration should be overwritten. Defaults to `true`.
DESCRIPTION
}
variable "app_settings" {
type = map(string)
default = {}
description = <<DESCRIPTION
A map of key-value pairs for App Settings and custom values to assign to the App Service.
These are set via the `Microsoft.Web/sites/config` (name: `appsettings`) sub-resource.
DESCRIPTION
}
variable "application_insights_connection_string" {
type = string
default = null
description = "The Application Insights connection string. Provide this from an externally managed Application Insights resource."
sensitive = true
}
variable "application_insights_key" {
type = string
default = null
description = "The Application Insights instrumentation key. Provide this from an externally managed Application Insights resource."
sensitive = true
}
variable "auth_settings" {
type = object({
additional_login_parameters = optional(map(string))
allowed_external_redirect_urls = optional(list(string))
default_provider = optional(string)
enabled = optional(bool, false)
issuer = optional(string)
runtime_version = optional(string)
token_refresh_extension_hours = optional(number, 72)
token_store_enabled = optional(bool, false)
unauthenticated_client_action = optional(string)
active_directory = optional(object({
client_id = optional(string)
allowed_audiences = optional(list(string))
client_secret = optional(string)
client_secret_setting_name = optional(string)
}))
facebook = optional(object({
app_id = optional(string)
app_secret = optional(string)
app_secret_setting_name = optional(string)
oauth_scopes = optional(list(string))
}))
github = optional(object({
client_id = optional(string)
client_secret = optional(string)
client_secret_setting_name = optional(string)
oauth_scopes = optional(list(string))
}))
google = optional(object({
client_id = optional(string)
client_secret = optional(string)
client_secret_setting_name = optional(string)
oauth_scopes = optional(list(string))
}))
microsoft = optional(object({
client_id = optional(string)
client_secret = optional(string)
client_secret_setting_name = optional(string)
oauth_scopes = optional(list(string))
}))
twitter = optional(object({
consumer_key = optional(string)
consumer_secret = optional(string)
consumer_secret_setting_name = optional(string)
}))
})
default = null
description = <<DESCRIPTION
A map of authentication settings to assign to the App Service.
- `additional_login_parameters` - (Optional) A map of additional login parameters.
- `allowed_external_redirect_urls` - (Optional) A list of allowed external redirect URLs.
- `default_provider` - (Optional) The default authentication provider.
- `enabled` - (Optional) Is authentication enabled? Defaults to `false`.
- `issuer` - (Optional) The issuer URI.
- `runtime_version` - (Optional) The runtime version of the authentication module.
- `token_refresh_extension_hours` - (Optional) Hours before token expiry to refresh. Defaults to `72`.
- `token_store_enabled` - (Optional) Should the token store be enabled? Defaults to `false`.
- `unauthenticated_client_action` - (Optional) The action to take for unauthenticated requests.
- `active_directory` - (Optional) An Active Directory authentication block.
- `client_id` - (Optional) The Client ID of the Azure AD application.
- `allowed_audiences` - (Optional) A list of allowed audience values.
- `client_secret` - (Optional) The Client Secret of the Azure AD application.
- `client_secret_setting_name` - (Optional) The app setting name that contains the client secret.
- `facebook` - (Optional) A Facebook authentication block.
- `app_id` - (Optional) The App ID of the Facebook application.
- `app_secret` - (Optional) The App Secret of the Facebook application.
- `app_secret_setting_name` - (Optional) The app setting name that contains the app secret.
- `oauth_scopes` - (Optional) A list of OAuth scopes to request.
- `github` - (Optional) A GitHub authentication block.
- `client_id` - (Optional) The Client ID of the GitHub application.
- `client_secret` - (Optional) The Client Secret of the GitHub application.
- `client_secret_setting_name` - (Optional) The app setting name that contains the client secret.
- `oauth_scopes` - (Optional) A list of OAuth scopes to request.
- `google` - (Optional) A Google authentication block.
- `client_id` - (Optional) The Client ID of the Google application.
- `client_secret` - (Optional) The Client Secret of the Google application.
- `client_secret_setting_name` - (Optional) The app setting name that contains the client secret.
- `oauth_scopes` - (Optional) A list of OAuth scopes to request.
- `microsoft` - (Optional) A Microsoft authentication block.
- `client_id` - (Optional) The Client ID of the Microsoft application.
- `client_secret` - (Optional) The Client Secret of the Microsoft application.
- `client_secret_setting_name` - (Optional) The app setting name that contains the client secret.
- `oauth_scopes` - (Optional) A list of OAuth scopes to request.
- `twitter` - (Optional) A Twitter authentication block.
- `consumer_key` - (Optional) The consumer key of the Twitter application.
- `consumer_secret` - (Optional) The consumer secret of the Twitter application.
- `consumer_secret_setting_name` - (Optional) The app setting name that contains the consumer secret.
DESCRIPTION
}
variable "auth_settings_v2" {
type = object({
auth_enabled = optional(bool, false)
config_file_path = optional(string)
excluded_paths = optional(list(string))
forward_proxy_convention = optional(string, "NoProxy")
forward_proxy_custom_host_header_name = optional(string)
forward_proxy_custom_proto_header_name = optional(string)
http_route_api_prefix = optional(string, "/.auth")
redirect_to_provider = optional(string)
require_authentication = optional(bool, false)
require_https = optional(bool, true)
runtime_version = optional(string, "~1")
unauthenticated_client_action = optional(string, "RedirectToLoginPage")
identity_providers = optional(object({
apple = optional(object({
enabled = optional(bool)
login = optional(object({
scopes = optional(list(string))
}))
registration = optional(object({
client_id = optional(string)
client_secret_setting_name = optional(string)
}))
}))
azure_active_directory = optional(object({
enabled = optional(bool)
is_auto_provisioned = optional(bool)
login = optional(object({
disable_www_authenticate = optional(bool)
login_parameters = optional(list(string))
}))
registration = optional(object({
client_id = optional(string)
client_secret_certificate_issuer = optional(string)
client_secret_certificate_subject_alternative_name = optional(string)
client_secret_certificate_thumbprint = optional(string)
client_secret_setting_name = optional(string)
open_id_issuer = optional(string)
}))
validation = optional(object({
allowed_audiences = optional(list(string))
default_authorization_policy = optional(object({
allowed_applications = optional(list(string))
allowed_principals = optional(object({
groups = optional(list(string))
identities = optional(list(string))
}))
}))
jwt_claim_checks = optional(object({
allowed_client_applications = optional(list(string))
allowed_groups = optional(list(string))
}))
}))
}))
azure_static_web_apps = optional(object({
enabled = optional(bool)
registration = optional(object({
client_id = optional(string)
}))
}))
custom_open_id_connect_providers = optional(map(object({
enabled = optional(bool)
login = optional(object({
name_claim_type = optional(string)
scopes = optional(list(string))
}))
registration = optional(object({
client_id = optional(string)
client_credential = optional(object({
method = optional(string)
client_secret_setting_name = optional(string)
}))
open_id_connect_configuration = optional(object({
authorization_endpoint = optional(string)
certification_uri = optional(string)
issuer = optional(string)
token_endpoint = optional(string)
well_known_open_id_configuration = optional(string)
}))
}))
})))
facebook = optional(object({
enabled = optional(bool)
graph_api_version = optional(string)
login = optional(object({
scopes = optional(list(string))
}))
registration = optional(object({
app_id = optional(string)
app_secret_setting_name = optional(string)
}))
}))
github = optional(object({
enabled = optional(bool)
login = optional(object({
scopes = optional(list(string))
}))
registration = optional(object({
client_id = optional(string)
client_secret_setting_name = optional(string)
}))
}))
google = optional(object({
enabled = optional(bool)
login = optional(object({
scopes = optional(list(string))
}))
registration = optional(object({
client_id = optional(string)
client_secret_setting_name = optional(string)
}))
validation = optional(object({
allowed_audiences = optional(list(string))
}))
}))
legacy_microsoft_account = optional(object({
enabled = optional(bool)
login = optional(object({
scopes = optional(list(string))
}))
registration = optional(object({
client_id = optional(string)
client_secret_setting_name = optional(string)
}))
validation = optional(object({
allowed_audiences = optional(list(string))
}))
}))
twitter = optional(object({
enabled = optional(bool)
registration = optional(object({
consumer_key = optional(string)
consumer_secret_setting_name = optional(string)
}))
}))
}))
login = optional(object({
allowed_external_redirect_urls = optional(list(string))
cookie_expiration = optional(object({
convention = optional(string, "FixedTime")
time_to_expiration = optional(string, "08:00:00")
}))
nonce = optional(object({
nonce_expiration_interval = optional(string, "00:05:00")
validate_nonce = optional(bool, true)
}))
preserve_url_fragments_for_logins = optional(bool, false)
routes = optional(object({
logout_endpoint = optional(string)
}))
token_store = optional(object({
azure_blob_storage = optional(object({
sas_url_setting_name = optional(string)
}))
enabled = optional(bool, false)
file_system = optional(object({
directory = optional(string)
}))
token_refresh_extension_hours = optional(number, 72)
}))
}))
})
default = null
description = <<DESCRIPTION
Authentication settings V2 configuration for the App Service. Mirrors the API structure.
- `auth_enabled` - (Optional) Is authentication enabled? Defaults to `false`.
- `config_file_path` - (Optional) The path to the auth configuration file.
- `excluded_paths` - (Optional) A list of paths excluded from authentication.
- `forward_proxy_convention` - (Optional) The convention for forwarding proxy headers. Defaults to `NoProxy`.
- `forward_proxy_custom_host_header_name` - (Optional) The custom host header name for the forward proxy.
- `forward_proxy_custom_proto_header_name` - (Optional) The custom proto header name for the forward proxy.
- `http_route_api_prefix` - (Optional) The prefix for the HTTP route API. Defaults to `/.auth`.
- `redirect_to_provider` - (Optional) The default authentication provider when multiple providers are configured.
- `require_authentication` - (Optional) Should authentication be required? Defaults to `false`.
- `require_https` - (Optional) Should HTTPS be required? Defaults to `true`.
- `runtime_version` - (Optional) The runtime version of the auth module. Defaults to `~1`.
- `unauthenticated_client_action` - (Optional) The action for unauthenticated requests. Defaults to `RedirectToLoginPage`.
- `identity_providers` - (Optional) The identity providers configuration. See variable description in the submodule for full details.
- `login` - (Optional) The login configuration. See variable description in the submodule for full details.
DESCRIPTION
}
variable "auto_generated_domain_name_label_scope" {
type = string
default = null
description = "(Optional) The scope of the auto-generated domain name label. Possible values are `NoReuse`, `ResourceGroupReuse`, `SubscriptionReuse`, and `TenantReuse`."
validation {
error_message = "The value must be one of: `NoReuse`, `ResourceGroupReuse`, `SubscriptionReuse`, or `TenantReuse`."
condition = var.auto_generated_domain_name_label_scope == null || can(index(["NoReuse", "ResourceGroupReuse", "SubscriptionReuse", "TenantReuse"], var.auto_generated_domain_name_label_scope))
}
}
variable "backup" {
type = map(object({
enabled = optional(bool, true)
name = optional(string)
storage_account_url = optional(string)
schedule = optional(map(object({
frequency_interval = optional(number)
frequency_unit = optional(string)
keep_at_least_one_backup = optional(bool)
retention_period_days = optional(number)
start_time = optional(string)
})))
}))
default = {}
description = <<DESCRIPTION
A map of backup settings for the App Service.
- `enabled` - (Optional) Is backup enabled? Defaults to `true`.
- `name` - (Optional) The name of the backup.
- `storage_account_url` - (Optional) The SAS URL to the Storage Account container for backup.
- `schedule` - (Optional) A map of backup schedule settings.
- `frequency_interval` - (Optional) How often the backup should be executed.
- `frequency_unit` - (Optional) The unit of time for the backup frequency. Possible values are `Day` and `Hour`.
- `keep_at_least_one_backup` - (Optional) Should at least one backup always be kept?
- `retention_period_days` - (Optional) The number of days to retain backups.
- `start_time` - (Optional) The start time for the backup schedule.
DESCRIPTION
}
variable "builtin_logging_enabled" {
type = bool
default = true
description = "Should builtin logging be enabled for the Function App? Defaults to `true`."
}
variable "bundle_version" {
type = string
default = "[1.*, 2.0.0)"
description = "The version of the extension bundle to use. Defaults to `[1.*, 2.0.0)`. (Logic App)"
}
variable "certificates" {
type = map(object({
name = optional(string)
key_vault_id = optional(string)
key_vault_secret_name = optional(string)
pfx_blob = optional(string)
password = optional(string)
host_names = optional(list(string))
tags = optional(map(string))
}))
default = {}
description = <<DESCRIPTION
A map of `Microsoft.Web/certificates` resources to create on the App Service
plan. Each entry materialises a certificate that can be referenced from a
`custom_domains` entry (on the main site or any slot) via `certificate_key`,
removing the need for callers to invoke the `certificate` submodule directly.
Either `key_vault_id` + `key_vault_secret_name` (Key Vault sourced) or
`pfx_blob` (+ optional `password`) (inline upload) must be supplied; the two
modes are mutually exclusive. When sourcing from Key Vault the App Service
first-party service principal (`abfa0a7c-a6b6-4736-8310-5855508787cd`) must
have the `Key Vault Certificate User` role on the vault scope.
- `name` - (Optional) The name of the certificate resource. Defaults to the map key.
- `key_vault_id` - (Optional) The resource ID of the Key Vault holding the certificate.
- `key_vault_secret_name` - (Optional) The Key Vault secret/certificate name.
- `pfx_blob` - (Optional) Base64-encoded PFX contents.
- `password` - (Optional) Password for the supplied PFX blob.
- `host_names` - (Optional) Hostnames the certificate applies to.
- `tags` - (Optional) Tags applied to the certificate resource.
DESCRIPTION
nullable = false
}
variable "client_affinity_enabled" {
type = bool
default = false
description = "Should client affinity be enabled for the App Service? Defaults to `false`."
}
variable "client_affinity_partitioning_enabled" {
type = bool
default = null
description = "(Optional) Should client affinity partitioning (CHIPS cookie partitioning) be enabled? When enabled, the affinity cookie uses the CHIPS partitioned attribute."
}
variable "client_affinity_proxy_enabled" {
type = bool
default = null
description = "(Optional) Should client affinity proxy be enabled? When enabled, the `X-Forwarded-Host` header overrides the host value used for affinity cookie routing."
}
variable "client_certificate_enabled" {
type = bool
default = false
description = "Should client certificate be enabled for the App Service? Defaults to `false`."
}
variable "client_certificate_exclusion_paths" {
type = string
default = null
description = "The client certificate exclusion paths for the App Service."
}
variable "client_certificate_mode" {
type = string
default = "Required"
description = "The client certificate mode for the App Service. Possible values are `Required`, `Optional`, and `OptionalInteractiveUser`. Defaults to `Required`."
}
variable "connection_strings" {
type = map(object({
name = optional(string)
type = optional(string)
value = optional(string)
}))
default = {}
description = <<DESCRIPTION
A map of connection strings to assign to the App Service.
- `name` - (Optional) The name of the connection string.
- `type` - (Optional) The type of the connection string.
- `value` - (Optional) The value of the connection string.
DESCRIPTION
}
variable "container_size" {
type = number
default = null
description = "(Optional) The size of the function container in MB. Only applicable to Function Apps under a Consumption plan."
}
variable "content_share_force_disabled" {
type = bool
default = false
description = "Should content share be force disabled for the Function App? Defaults to `false`."
}
variable "custom_domains" {
type = map(object({
hostname = string
ssl_state = optional(string)
thumbprint = optional(string)
certificate_key = optional(string)
}))
default = {}
description = <<DESCRIPTION
A map of custom domains to bind to the main App Service site.
To bind a custom domain to a deployment slot instead, set
`custom_domains` on the corresponding entry in `var.deployment_slots`.
This module only creates the hostname binding. It does **not** create the
underlying DNS records – those must be provisioned separately (for example
with `Azure/avm-res-network-dnszone/azurerm`) before the binding is applied.
Certificates may either be provisioned out of band and referenced by
`thumbprint`, or declared inline via `var.certificates` and referenced by
`certificate_key`.
### DNS prerequisites
Azure validates ownership of the custom hostname when the binding is created.
At least one of the following DNS records must already exist and be
resolvable, otherwise the binding will fail with errors such as
`A TXT record pointing from asuid.{0} to {1} was not found.`:
- A `CNAME` record for the custom hostname pointing to
`<site-name>.azurewebsites.net` (the module exposes this value via the
`resource_uri` output), **or**
- A `TXT` record at `asuid.<custom-hostname>` whose value is the App Service's
custom domain verification ID. This module exposes that value via the
`custom_domain_verification_id` output.
### Field reference
- `hostname` - (Required) The custom domain hostname to bind.
- `ssl_state` - (Optional) The SSL state. Possible values are `IpBasedEnabled` and `SniEnabled`.
- `thumbprint` - (Optional) The thumbprint of a certificate already uploaded to the App Service. Mutually exclusive with `certificate_key`.
- `certificate_key` - (Optional) The map key of an entry in `var.certificates` whose thumbprint should be used for this binding. Mutually exclusive with `thumbprint`.
DESCRIPTION
nullable = false
validation {
error_message = "Each `custom_domains` entry must set at most one of `thumbprint` or `certificate_key`."
condition = alltrue([for d in var.custom_domains : !(d.thumbprint != null && d.certificate_key != null)])
}
}
variable "daily_memory_time_quota" {
type = number
default = 0
description = "(Optional) The amount of memory in gigabyte-seconds that your application is allowed to consume per day. Setting this value only affects Function Apps under the consumption plan. Defaults to `0`."
}
variable "dapr_config" {
type = object({
app_id = optional(string)
app_port = optional(number)
enable_api_logging = optional(bool)
enabled = optional(bool)
http_max_request_size = optional(number)
http_read_buffer_size = optional(number)
log_level = optional(string)
})
default = null
description = <<DESCRIPTION
(Optional) Dapr configuration for the App Service. Only applicable to apps hosted in Azure Container Apps environments.
- `app_id` - (Optional) The Dapr app identifier.
- `app_port` - (Optional) The port the application is listening on.
- `enable_api_logging` - (Optional) Should API logging be enabled for Dapr?
- `enabled` - (Optional) Is Dapr enabled?
- `http_max_request_size` - (Optional) The maximum size of HTTP request body in MB.
- `http_read_buffer_size` - (Optional) The maximum size of HTTP header read buffer in KB.
- `log_level` - (Optional) The Dapr log level. Possible values are `debug`, `error`, `info`, and `warn`.
DESCRIPTION
validation {
error_message = "The log_level must be one of: `debug`, `error`, `info`, or `warn`."
condition = var.dapr_config == null || try(var.dapr_config.log_level, null) == null || can(index(["debug", "error", "info", "warn"], var.dapr_config.log_level))
}
}
variable "deployment_slots" {
type = map(object({
name = optional(string)
auto_generated_domain_name_label_scope = optional(string)
client_affinity_enabled = optional(bool, false)
client_affinity_partitioning_enabled = optional(bool)
client_affinity_proxy_enabled = optional(bool)
client_certificate_enabled = optional(bool, false)
client_certificate_exclusion_paths = optional(string, null)
client_certificate_mode = optional(string, "Required")
container_size = optional(number)
dapr_config = optional(object({
app_id = optional(string)
app_port = optional(number)
enable_api_logging = optional(bool)
enabled = optional(bool)
http_max_request_size = optional(number)
http_read_buffer_size = optional(number)
log_level = optional(string)
}))
dns_configuration = optional(object({
dns_alt_server = optional(string)
dns_max_cache_timeout = optional(number)
dns_retry_attempt_count = optional(number)
dns_retry_attempt_timeout = optional(number)
dns_servers = optional(list(string))
}))
enabled = optional(bool, true)
end_to_end_encryption_enabled = optional(bool)
ftp_publish_basic_authentication_enabled = optional(bool, false)
hosting_environment_id = optional(string)
host_names_disabled = optional(bool)
https_only = optional(bool, true)
hyper_v = optional(bool)
ip_mode = optional(string)
key_vault_reference_identity = optional(string, null)
managed_environment_id = optional(string)
managed_identities = optional(object({
system_assigned = optional(bool, false)
user_assigned_resource_ids = optional(set(string), [])
}), {})
public_network_access_enabled = optional(bool, false)
redundancy_mode = optional(string)
resource_config = optional(object({
cpu = optional(number)
memory = optional(string)
}))
scm_site_also_stopped = optional(bool)
server_farm_id = optional(string, null)
ssh_enabled = optional(bool)
storage_account_required = optional(bool)
tags = optional(map(string))
virtual_network_subnet_id = optional(string, null)
vnet_route_all_traffic = optional(bool, false)
vnet_application_traffic_enabled = optional(bool, false)
vnet_backup_restore_enabled = optional(bool, false)
vnet_content_share_enabled = optional(bool, false)
vnet_image_pull_enabled = optional(bool, false)
webdeploy_publish_basic_authentication_enabled = optional(bool, false)
workload_profile_name = optional(string)
app_settings = optional(map(string), {})
site_config = optional(object({
always_on = optional(bool, true)
api_definition_url = optional(string)
api_management_api_id = optional(string)
app_command_line = optional(string)
app_scale_limit = optional(number)
auto_heal_enabled = optional(bool)
auto_heal_rules = optional(object({
actions = optional(object({
action_type = string
custom_action = optional(object({
exe = string
parameters = optional(string)
}))
min_process_execution_time = optional(string, "00:00:00")
}))
triggers = optional(object({
private_bytes_in_kb = optional(number)
requests = optional(object({
count = number
time_interval = string
}))
slow_requests = optional(object({
count = number
time_interval = string
time_taken = string
path = optional(string)
}))
slow_requests_with_path = optional(list(object({
count = number
time_interval = string
time_taken = string
path = optional(string)
})), [])
status_codes = optional(list(object({
count = number
time_interval = string
status = number
path = optional(string)
sub_status = optional(number)
win32_status = optional(number)
})), [])
status_codes_range = optional(list(object({
count = number
time_interval = string
status_codes = string
path = optional(string)
})), [])
}))
}))
auto_swap_slot_name = optional(string)
container_registry_managed_identity_client_id = optional(string)
container_registry_use_managed_identity = optional(bool)
cors = optional(object({
allowed_origins = optional(list(string))
support_credentials = optional(bool, false)
}))
default_documents = optional(list(string))
detailed_error_logging_enabled = optional(bool)
document_root = optional(string)
dotnet_framework_version = optional(string)
elastic_instance_minimum = optional(number)
elastic_web_app_scale_limit = optional(number)
experiments = optional(object({
ramp_up_rules = optional(list(object({
action_host_name = optional(string)
change_decision_callback_url = optional(string)
change_interval_in_minutes = optional(number)
change_step = optional(number)
max_reroute_percentage = optional(number)
min_reroute_percentage = optional(number)
name = optional(string)
reroute_percentage = optional(number)
})), [])
}))
ftps_state = optional(string, "FtpsOnly")
handler_mappings = optional(list(object({
arguments = optional(string)
extension = optional(string)
script_processor = optional(string)
})))
health_check_path = optional(string)
http2_enabled = optional(bool, false)
http20_proxy_flag = optional(number)
http_logging_enabled = optional(bool)
ip_restriction = optional(list(object({
action = optional(string, "Allow")
ip_address = optional(string)
name = optional(string)
priority = optional(number, 65000)
service_tag = optional(string)
virtual_network_subnet_id = optional(string)
headers = optional(object({
x_azure_fdid = optional(list(string))
x_fd_health_probe = optional(list(string))
x_forwarded_for = optional(list(string))
x_forwarded_host = optional(list(string))
}))
})), [])
ip_restriction_default_action = optional(string, "Allow")
java_container = optional(string)
java_container_version = optional(string)
java_version = optional(string)
limits = optional(object({
max_disk_size_in_mb = optional(number)
max_memory_in_mb = optional(number)
max_percentage_cpu = optional(number)
}))
linux_fx_version = optional(string)
load_balancing_mode = optional(string, "LeastRequests")
local_mysql_enabled = optional(bool, false)
logs_directory_size_limit = optional(number)
managed_pipeline_mode = optional(string, "Integrated")
metadata = optional(list(object({
name = string
value = string
})))
min_tls_cipher_suite = optional(string)
minimum_tls_version = optional(string, "1.3")
node_version = optional(string)
php_version = optional(string)
powershell_version = optional(string)
pre_warmed_instance_count = optional(number)
python_version = optional(string)
remote_debugging_enabled = optional(bool, false)
remote_debugging_version = optional(string)
request_tracing_enabled = optional(bool)
request_tracing_expiration_time = optional(string)
runtime_scale_monitoring_enabled = optional(bool)
scm_ip_restriction = optional(list(object({
action = optional(string, "Allow")
ip_address = optional(string)
name = optional(string)
priority = optional(number, 65000)
service_tag = optional(string)
virtual_network_subnet_id = optional(string)
headers = optional(object({
x_azure_fdid = optional(list(string))
x_fd_health_probe = optional(list(string))
x_forwarded_for = optional(list(string))
x_forwarded_host = optional(list(string))
}))
})), [])
scm_ip_restriction_default_action = optional(string, "Allow")
scm_minimum_tls_version = optional(string, "1.2")
scm_type = optional(string, "None")
scm_use_main_ip_restriction = optional(bool, false)
tracing_options = optional(string)
use_32_bit_worker = optional(bool, false)
vnet_private_ports_count = optional(number)
vnet_route_all_enabled = optional(bool, false)
website_time_zone = optional(string)
websockets_enabled = optional(bool, false)
windows_fx_version = optional(string)
worker_count = optional(number)
application_insights_connection_string = optional(string)
application_insights_key = optional(string)
application_stack = optional(object({
docker = optional(object({
docker_image_name = optional(string)
docker_registry_url = optional(string)
docker_image_tag = optional(string, "latest")
}))
dotnet = optional(object({
dotnet_version = optional(string)
current_stack = optional(string)
use_custom_runtime = optional(bool, false)
use_dotnet_isolated_runtime = optional(bool, false)
}))
java = optional(object({
java_version = optional(string)
java_container = optional(string)
java_container_version = optional(string)
}))
node = optional(object({
node_version = optional(string)
}))
php = optional(object({
php_version = optional(string)
}))
python = optional(object({
python_version = optional(string)
}))
powershell = optional(object({
powershell_version = optional(string)
}))
}))
virtual_application = optional(list(object({
physical_path = optional(string, "site\\wwwroot")
preload_enabled = optional(bool, false)
virtual_path = optional(string, "/")
virtual_directory = optional(list(object({
physical_path = optional(string)
virtual_path = optional(string)
})), [])
})), [])
}), {})
lock = optional(object({
kind = string
name = optional(string, null)
}), null)
private_endpoints = optional(map(object({
name = optional(string, null)
role_assignments = optional(map(object({
role_definition_id_or_name = string
principal_id = string
description = optional(string, null)
skip_service_principal_aad_check = optional(bool, false)
condition = optional(string, null)
condition_version = optional(string, null)
delegated_managed_identity_resource_id = optional(string, null)
principal_type = optional(string, null)
})), {})
lock = optional(object({
kind = string
name = optional(string, null)
}), null)
tags = optional(map(string), null)
subnet_resource_id = string
private_dns_zone_group_name = optional(string, "default")
private_dns_zone_resource_ids = optional(set(string), [])
application_security_group_associations = optional(map(string), {})
private_service_connection_name = optional(string, null)
network_interface_name = optional(string, null)
location = optional(string, null)
resource_group_name = optional(string, null)
ip_configurations = optional(map(object({
name = string
private_ip_address = string
member_name = optional(string, null)
})), {})
})), {})
role_assignments = optional(map(object({
role_definition_id_or_name = string
principal_id = string
description = optional(string, null)
skip_service_principal_aad_check = optional(bool, false)
condition = optional(string, null)
condition_version = optional(string, null)
delegated_managed_identity_resource_id = optional(string, null)
principal_type = optional(string, null)
})), {})
storage_shares_to_mount = optional(map(object({
account_name = string
mount_path = string
name = string
share_name = string
type = optional(string, "AzureFiles")
})), {})
connection_strings = optional(map(object({
name = optional(string)
type = optional(string)
value = optional(string)
})), {})
zip_deploy_file = optional(string)
zip_deploy_wait_duration = optional(string, "60s")
custom_domains = optional(map(object({
hostname = string
ssl_state = optional(string)
thumbprint = optional(string)
certificate_key = optional(string)
})), {})
}))
default = {}
description = <<DESCRIPTION
A map of deployment slots to create for the App Service.
- `name` - (Optional) The name of the slot.
- `auto_generated_domain_name_label_scope` - (Optional) The scope of the auto-generated domain name label.
- `client_affinity_enabled` - (Optional) Should client affinity be enabled? Defaults to `false`.
- `client_affinity_partitioning_enabled` - (Optional) Should client affinity partitioning (CHIPS) be enabled?
- `client_affinity_proxy_enabled` - (Optional) Should client affinity proxy be enabled?
- `client_certificate_enabled` - (Optional) Should client certificates be enabled? Defaults to `false`.
- `client_certificate_exclusion_paths` - (Optional) Paths to exclude from client certificate authentication.
- `client_certificate_mode` - (Optional) The client certificate mode. Defaults to `Required`.
- `container_size` - (Optional) The size of the function container in MB.
- `dapr_config` - (Optional) Dapr configuration object.
- `dns_configuration` - (Optional) DNS configuration object.
- `enabled` - (Optional) Is the slot enabled? Defaults to `true`.
- `end_to_end_encryption_enabled` - (Optional) Should end-to-end encryption be enabled?
- `ftp_publish_basic_authentication_enabled` - (Optional) Should FTP basic authentication be enabled? Defaults to `false`.
- `hosting_environment_id` - (Optional) The resource ID of the App Service Environment.
- `host_names_disabled` - (Optional) Should public hostnames be disabled?
- `https_only` - (Optional) Should the slot only be accessible over HTTPS? Defaults to `true`.
- `hyper_v` - (Optional) Should the slot run in Hyper-V isolation?
- `ip_mode` - (Optional) The IP mode. Possible values: `IPv4`, `IPv4AndIPv6`, `IPv6`.
- `key_vault_reference_identity` - (Optional) The identity to use for Key Vault references.
- `managed_environment_id` - (Optional) The Azure Container Apps managed environment ID.
- `managed_identities` - (Optional) Controls the Managed Identity configuration on the deployment slot. Each slot has its own independent identity configuration.
- `system_assigned` - (Optional) Specifies if the System Assigned Managed Identity should be enabled. Defaults to `false`.
- `user_assigned_resource_ids` - (Optional) Specifies a set of User Assigned Managed Identity resource IDs to be assigned. Defaults to `[]`.
- `public_network_access_enabled` - (Optional) Should public network access be enabled? Defaults to `false`.
- `redundancy_mode` - (Optional) The site redundancy mode.
- `resource_config` - (Optional) Resource config for Container App environment hosted apps.
- `scm_site_also_stopped` - (Optional) Should the SCM site also be stopped?
- `server_farm_id` - (Optional) The server farm resource ID to use for the slot.
- `ssh_enabled` - (Optional) Should SSH be enabled?
- `storage_account_required` - (Optional) Should a storage account be required?
- `tags` - (Optional) Tags to apply to the slot.
- `virtual_network_subnet_id` - (Optional) The subnet ID for VNet integration.
- `vnet_route_all_traffic` - (Optional) Should all outbound traffic use VNet routing? Defaults to `false`.
- `vnet_application_traffic_enabled` - (Optional) Should application traffic use VNet routing? Defaults to `false`.
- `vnet_backup_restore_enabled` - (Optional) Should backup/restore traffic use VNet routing? Defaults to `false`.
- `vnet_content_share_enabled` - (Optional) Should content share traffic use VNet routing? Defaults to `false`.
- `vnet_image_pull_enabled` - (Optional) Should image pull traffic use VNet routing? Defaults to `false`.
- `webdeploy_publish_basic_authentication_enabled` - (Optional) Should WebDeploy basic authentication be enabled? Defaults to `false`.
- `workload_profile_name` - (Optional) The workload profile name.
- `app_settings` - (Optional) App settings for the slot.
- `site_config` - (Optional) Site configuration for the slot.
- `always_on` - (Optional) Should the slot always be on? Defaults to `true`.
- `api_definition_url` - (Optional) The URL of the API definition.
- `api_management_api_id` - (Optional) The ID of the API Management API.
- `app_command_line` - (Optional) The App command line to launch.
- `app_scale_limit` - (Optional) The number of workers this function app can scale out to.
- `auto_swap_slot_name` - (Optional) The name of the slot to auto swap with.
- `container_registry_managed_identity_client_id` - (Optional) The Client ID of the MSI for Azure Container Registry.
- `container_registry_use_managed_identity` - (Optional) Should connections for Azure Container Registry use MSI.
- `default_documents` - (Optional) Specifies a list of Default Documents.
- `detailed_error_logging_enabled` - (Optional) Should detailed error logging be enabled?
- `document_root` - (Optional) The document root path.
- `elastic_instance_minimum` - (Optional) The number of minimum instances for Elastic Premium plans.
- `elastic_web_app_scale_limit` - (Optional) The maximum number of workers for Elastic scale.
- `ftps_state` - (Optional) State of FTP / FTPS service. Defaults to `FtpsOnly`.
- `handler_mappings` - (Optional) A list of handler mappings (Windows IIS).
- `arguments` - (Optional) The arguments to pass to the script processor.
- `extension` - (Optional) The file extension to handle.
- `script_processor` - (Optional) The path to the script processor executable.
- `health_check_path` - (Optional) The path to be checked for health.
- `http2_enabled` - (Optional) Enable HTTP2 protocol. Defaults to `false`.
- `http_logging_enabled` - (Optional) Should HTTP logging be enabled?
- `ip_restriction_default_action` - (Optional) Default action for IP restrictions. Defaults to `Allow`.
- `limits` - (Optional) Resource limits.
- `max_disk_size_in_mb` - (Optional) The maximum disk size in MB.
- `max_memory_in_mb` - (Optional) The maximum memory in MB.
- `max_percentage_cpu` - (Optional) The maximum CPU percentage.
- `load_balancing_mode` - (Optional) The Site load balancing mode. Defaults to `LeastRequests`.
- `logs_directory_size_limit` - (Optional) The HTTP log directory size limit in MB.
- `managed_pipeline_mode` - (Optional) Managed pipeline mode. Defaults to `Integrated`.
- `metadata` - (Optional) A list of name-value pairs for siteConfig metadata (e.g. `CURRENT_STACK`). Auto-computed from `application_stack` if not specified. User-supplied entries take precedence.