11resource "azurerm_kubernetes_cluster" "main" {
2- dynamic "default_node_pool" {
3- for_each = var. enable_auto_scaling == true ? [] : [" default_node_pool_manually_scaled" ]
4-
5- content {
6- name = var. agents_pool_name
7- vm_size = var. agents_size
8- enable_auto_scaling = var. enable_auto_scaling
9- enable_host_encryption = var. enable_host_encryption
10- enable_node_public_ip = var. enable_node_public_ip
11- fips_enabled = var. default_node_pool_fips_enabled
12- max_count = null
13- max_pods = var. agents_max_pods
14- min_count = null
15- node_count = var. agents_count
16- node_labels = var. agents_labels
17- node_taints = var. agents_taints
18- only_critical_addons_enabled = var. only_critical_addons_enabled
19- orchestrator_version = var. orchestrator_version
20- os_disk_size_gb = var. os_disk_size_gb
21- os_disk_type = var. os_disk_type
22- os_sku = var. os_sku
23- pod_subnet_id = var. pod_subnet_id
24- proximity_placement_group_id = var. agents_proximity_placement_group_id
25- scale_down_mode = var. scale_down_mode
26- snapshot_id = var. snapshot_id
27- tags = merge (var. tags , var. agents_tags )
28- temporary_name_for_rotation = var. temporary_name_for_rotation
29- type = var. agents_type
30- ultra_ssd_enabled = var. ultra_ssd_enabled
31- vnet_subnet_id = var. vnet_subnet_id
32- zones = var. agents_availability_zones
33-
34- dynamic "kubelet_config" {
35- for_each = var. agents_pool_kubelet_configs
36-
37- content {
38- allowed_unsafe_sysctls = kubelet_config. value . allowed_unsafe_sysctls
39- container_log_max_line = kubelet_config. value . container_log_max_line
40- container_log_max_size_mb = kubelet_config. value . container_log_max_size_mb
41- cpu_cfs_quota_enabled = kubelet_config. value . cpu_cfs_quota_enabled
42- cpu_cfs_quota_period = kubelet_config. value . cpu_cfs_quota_period
43- cpu_manager_policy = kubelet_config. value . cpu_manager_policy
44- image_gc_high_threshold = kubelet_config. value . image_gc_high_threshold
45- image_gc_low_threshold = kubelet_config. value . image_gc_low_threshold
46- pod_max_pid = kubelet_config. value . pod_max_pid
47- topology_manager_policy = kubelet_config. value . topology_manager_policy
48- }
49- }
50- dynamic "linux_os_config" {
51- for_each = var. agents_pool_linux_os_configs
52-
53- content {
54- swap_file_size_mb = linux_os_config. value . swap_file_size_mb
55- transparent_huge_page_defrag = linux_os_config. value . transparent_huge_page_defrag
56- transparent_huge_page_enabled = linux_os_config. value . transparent_huge_page_enabled
57-
58- dynamic "sysctl_config" {
59- for_each = linux_os_config. value . sysctl_configs == null ? [] : linux_os_config. value . sysctl_configs
60-
61- content {
62- fs_aio_max_nr = sysctl_config. value . fs_aio_max_nr
63- fs_file_max = sysctl_config. value . fs_file_max
64- fs_inotify_max_user_watches = sysctl_config. value . fs_inotify_max_user_watches
65- fs_nr_open = sysctl_config. value . fs_nr_open
66- kernel_threads_max = sysctl_config. value . kernel_threads_max
67- net_core_netdev_max_backlog = sysctl_config. value . net_core_netdev_max_backlog
68- net_core_optmem_max = sysctl_config. value . net_core_optmem_max
69- net_core_rmem_default = sysctl_config. value . net_core_rmem_default
70- net_core_rmem_max = sysctl_config. value . net_core_rmem_max
71- net_core_somaxconn = sysctl_config. value . net_core_somaxconn
72- net_core_wmem_default = sysctl_config. value . net_core_wmem_default
73- net_core_wmem_max = sysctl_config. value . net_core_wmem_max
74- net_ipv4_ip_local_port_range_max = sysctl_config. value . net_ipv4_ip_local_port_range_max
75- net_ipv4_ip_local_port_range_min = sysctl_config. value . net_ipv4_ip_local_port_range_min
76- net_ipv4_neigh_default_gc_thresh1 = sysctl_config. value . net_ipv4_neigh_default_gc_thresh1
77- net_ipv4_neigh_default_gc_thresh2 = sysctl_config. value . net_ipv4_neigh_default_gc_thresh2
78- net_ipv4_neigh_default_gc_thresh3 = sysctl_config. value . net_ipv4_neigh_default_gc_thresh3
79- net_ipv4_tcp_fin_timeout = sysctl_config. value . net_ipv4_tcp_fin_timeout
80- net_ipv4_tcp_keepalive_intvl = sysctl_config. value . net_ipv4_tcp_keepalive_intvl
81- net_ipv4_tcp_keepalive_probes = sysctl_config. value . net_ipv4_tcp_keepalive_probes
82- net_ipv4_tcp_keepalive_time = sysctl_config. value . net_ipv4_tcp_keepalive_time
83- net_ipv4_tcp_max_syn_backlog = sysctl_config. value . net_ipv4_tcp_max_syn_backlog
84- net_ipv4_tcp_max_tw_buckets = sysctl_config. value . net_ipv4_tcp_max_tw_buckets
85- net_ipv4_tcp_tw_reuse = sysctl_config. value . net_ipv4_tcp_tw_reuse
86- net_netfilter_nf_conntrack_buckets = sysctl_config. value . net_netfilter_nf_conntrack_buckets
87- net_netfilter_nf_conntrack_max = sysctl_config. value . net_netfilter_nf_conntrack_max
88- vm_max_map_count = sysctl_config. value . vm_max_map_count
89- vm_swappiness = sysctl_config. value . vm_swappiness
90- vm_vfs_cache_pressure = sysctl_config. value . vm_vfs_cache_pressure
91- }
92- }
93- }
94- }
95- dynamic "upgrade_settings" {
96- for_each = var. agents_pool_max_surge == null ? [] : [" upgrade_settings" ]
97-
98- content {
99- max_surge = var. agents_pool_max_surge
100- drain_timeout_in_minutes = var. agents_pool_drain_timeout_in_minutes
101- node_soak_duration_in_minutes = var. agents_pool_node_soak_duration_in_minutes
102- }
103- }
104- }
105- }
106- dynamic "default_node_pool" {
107- for_each = var. enable_auto_scaling == true ? [" default_node_pool_auto_scaled" ] : []
108-
109- content {
110- name = var. agents_pool_name
111- vm_size = var. agents_size
112- enable_auto_scaling = var. enable_auto_scaling
113- enable_host_encryption = var. enable_host_encryption
114- enable_node_public_ip = var. enable_node_public_ip
115- fips_enabled = var. default_node_pool_fips_enabled
116- max_count = var. agents_max_count
117- max_pods = var. agents_max_pods
118- min_count = var. agents_min_count
119- node_labels = var. agents_labels
120- node_taints = var. agents_taints
121- only_critical_addons_enabled = var. only_critical_addons_enabled
122- orchestrator_version = var. orchestrator_version
123- os_disk_size_gb = var. os_disk_size_gb
124- os_disk_type = var. os_disk_type
125- os_sku = var. os_sku
126- pod_subnet_id = var. pod_subnet_id
127- proximity_placement_group_id = var. agents_proximity_placement_group_id
128- scale_down_mode = var. scale_down_mode
129- snapshot_id = var. snapshot_id
130- tags = merge (var. tags , var. agents_tags )
131- temporary_name_for_rotation = var. temporary_name_for_rotation
132- type = var. agents_type
133- ultra_ssd_enabled = var. ultra_ssd_enabled
134- vnet_subnet_id = var. vnet_subnet_id
135- zones = var. agents_availability_zones
136-
137- dynamic "kubelet_config" {
138- for_each = var. agents_pool_kubelet_configs
139-
140- content {
141- allowed_unsafe_sysctls = kubelet_config. value . allowed_unsafe_sysctls
142- container_log_max_line = kubelet_config. value . container_log_max_line
143- container_log_max_size_mb = kubelet_config. value . container_log_max_size_mb
144- cpu_cfs_quota_enabled = kubelet_config. value . cpu_cfs_quota_enabled
145- cpu_cfs_quota_period = kubelet_config. value . cpu_cfs_quota_period
146- cpu_manager_policy = kubelet_config. value . cpu_manager_policy
147- image_gc_high_threshold = kubelet_config. value . image_gc_high_threshold
148- image_gc_low_threshold = kubelet_config. value . image_gc_low_threshold
149- pod_max_pid = kubelet_config. value . pod_max_pid
150- topology_manager_policy = kubelet_config. value . topology_manager_policy
151- }
152- }
153- dynamic "linux_os_config" {
154- for_each = var. agents_pool_linux_os_configs
155-
156- content {
157- swap_file_size_mb = linux_os_config. value . swap_file_size_mb
158- transparent_huge_page_defrag = linux_os_config. value . transparent_huge_page_defrag
159- transparent_huge_page_enabled = linux_os_config. value . transparent_huge_page_enabled
160-
161- dynamic "sysctl_config" {
162- for_each = linux_os_config. value . sysctl_configs == null ? [] : linux_os_config. value . sysctl_configs
163-
164- content {
165- fs_aio_max_nr = sysctl_config. value . fs_aio_max_nr
166- fs_file_max = sysctl_config. value . fs_file_max
167- fs_inotify_max_user_watches = sysctl_config. value . fs_inotify_max_user_watches
168- fs_nr_open = sysctl_config. value . fs_nr_open
169- kernel_threads_max = sysctl_config. value . kernel_threads_max
170- net_core_netdev_max_backlog = sysctl_config. value . net_core_netdev_max_backlog
171- net_core_optmem_max = sysctl_config. value . net_core_optmem_max
172- net_core_rmem_default = sysctl_config. value . net_core_rmem_default
173- net_core_rmem_max = sysctl_config. value . net_core_rmem_max
174- net_core_somaxconn = sysctl_config. value . net_core_somaxconn
175- net_core_wmem_default = sysctl_config. value . net_core_wmem_default
176- net_core_wmem_max = sysctl_config. value . net_core_wmem_max
177- net_ipv4_ip_local_port_range_max = sysctl_config. value . net_ipv4_ip_local_port_range_max
178- net_ipv4_ip_local_port_range_min = sysctl_config. value . net_ipv4_ip_local_port_range_min
179- net_ipv4_neigh_default_gc_thresh1 = sysctl_config. value . net_ipv4_neigh_default_gc_thresh1
180- net_ipv4_neigh_default_gc_thresh2 = sysctl_config. value . net_ipv4_neigh_default_gc_thresh2
181- net_ipv4_neigh_default_gc_thresh3 = sysctl_config. value . net_ipv4_neigh_default_gc_thresh3
182- net_ipv4_tcp_fin_timeout = sysctl_config. value . net_ipv4_tcp_fin_timeout
183- net_ipv4_tcp_keepalive_intvl = sysctl_config. value . net_ipv4_tcp_keepalive_intvl
184- net_ipv4_tcp_keepalive_probes = sysctl_config. value . net_ipv4_tcp_keepalive_probes
185- net_ipv4_tcp_keepalive_time = sysctl_config. value . net_ipv4_tcp_keepalive_time
186- net_ipv4_tcp_max_syn_backlog = sysctl_config. value . net_ipv4_tcp_max_syn_backlog
187- net_ipv4_tcp_max_tw_buckets = sysctl_config. value . net_ipv4_tcp_max_tw_buckets
188- net_ipv4_tcp_tw_reuse = sysctl_config. value . net_ipv4_tcp_tw_reuse
189- net_netfilter_nf_conntrack_buckets = sysctl_config. value . net_netfilter_nf_conntrack_buckets
190- net_netfilter_nf_conntrack_max = sysctl_config. value . net_netfilter_nf_conntrack_max
191- vm_max_map_count = sysctl_config. value . vm_max_map_count
192- vm_swappiness = sysctl_config. value . vm_swappiness
193- vm_vfs_cache_pressure = sysctl_config. value . vm_vfs_cache_pressure
194- }
195- }
196- }
197- }
198- dynamic "upgrade_settings" {
199- for_each = var. agents_pool_max_surge == null ? [] : [" upgrade_settings" ]
200-
201- content {
202- max_surge = var. agents_pool_max_surge
203- drain_timeout_in_minutes = var. agents_pool_drain_timeout_in_minutes
204- node_soak_duration_in_minutes = var. agents_pool_node_soak_duration_in_minutes
205- }
206- }
207- }
208- }
209- network_profile {
210- network_plugin = var. network_plugin
211- dns_service_ip = var. net_profile_dns_service_ip
212- ebpf_data_plane = var. ebpf_data_plane
213- load_balancer_sku = var. load_balancer_sku
214- network_plugin_mode = var. network_plugin_mode
215- network_policy = var. network_policy
216- outbound_type = var. net_profile_outbound_type
217- pod_cidr = var. net_profile_pod_cidr
218- service_cidr = var. net_profile_service_cidr
219-
220- dynamic "load_balancer_profile" {
221- for_each = var. load_balancer_profile_enabled && var. load_balancer_sku == " standard" ? [
222- " load_balancer_profile"
223- ] : []
224-
225- content {
226- idle_timeout_in_minutes = var. load_balancer_profile_idle_timeout_in_minutes
227- managed_outbound_ip_count = var. load_balancer_profile_managed_outbound_ip_count
228- managed_outbound_ipv6_count = var. load_balancer_profile_managed_outbound_ipv6_count
229- outbound_ip_address_ids = var. load_balancer_profile_outbound_ip_address_ids
230- outbound_ip_prefix_ids = var. load_balancer_profile_outbound_ip_prefix_ids
231- outbound_ports_allocated = var. load_balancer_profile_outbound_ports_allocated
232- }
233- }
234- }
235-
236- lifecycle {
237- ignore_changes = [
238- http_application_routing_enabled ,
239- http_proxy_config [0 ]. no_proxy ,
240- kubernetes_version ,
241- public_network_access_enabled ,
242- # we might have a random suffix in cluster's name so we have to ignore it here, but we've traced user supplied cluster name by `null_resource.kubernetes_cluster_name_keeper` so when the name is changed we'll recreate this resource.
243- name ,
244- ]
245- }
2+ automatic_channel_upgrade = var. automatic_channel_upgrade
3+ node_os_channel_upgrade = var. node_os_channel_upgrade
2464}
0 commit comments