Update template to reflect new worker pool changes.
@@ -104,6 +104,72 @@ module "aws-{{.Config.ClusterName}}" {
{{- end }}
}
+{{ range $index, $pool := .Config.WorkerPools }}
+module "worker-pool-{{ $index }}" {
+ source = "../lokomotive-kubernetes/aws/flatcar-linux/kubernetes/workers"
+
+ providers = {
+ aws = aws.default
+ }
+
+ vpc_id = module.aws-{{ $.Config.ClusterName }}.vpc_id
+ subnet_ids = flatten([module.aws-{{ $.Config.ClusterName }}.subnet_ids])
+ security_groups = module.aws-{{ $.Config.ClusterName }}.worker_security_groups
+ kubeconfig = module.aws-{{ $.Config.ClusterName }}.kubeconfig
+
+ {{- if $.Config.ServiceCIDR }}
+ service_cidr = "{{ $.Config.ServiceCIDR }}"
+ {{- end }}
+
+ {{- if $.Config.ClusterDomainSuffix }}
+ cluster_domain_suffix = "{{ $.Config.ClusterDomainSuffix }}"
+ {{- end }}
+
+ ssh_keys = {{ index (index $.WorkerpoolCfg $index) "ssh_pub_keys" }}
+ name = "{{ $pool.Name }}"
+ worker_count = "{{ $pool.Count}}"
+ os_name = "flatcar"
+ {{- if $pool.InstanceType }}
+ instance_type = "{{ $pool.InstanceType }}"
+ {{- end }}
+
+ {{- if $pool.OSChannel }}
+ os_channel = "{{ $pool.OSChannel }}"
+ {{- end }}
+
+ {{- if $pool.OSVersion }}
+ os_version = "{{ $pool.OSVersion }}"
+ {{- end }}
+
+ {{- if $pool.DiskSize }}
+ disk_size = "{{ $pool.DiskSize }}"
+ {{- end }}
+
+ {{- if $pool.DiskType }}
+ disk_type = "{{ $pool.DiskType }}"
+ {{- end }}
+
+ {{- if $pool.DiskIOPS }}
+ disk_iops = "{{ $pool.DiskIOPS }}"
+ {{- end }}
+
+ {{- if $pool.SpotPrice }}
+ spot_price = "{{ $pool.SpotPrice }}"
+ {{- end }}
+ {{- if $pool.TargetGroups }}
+ target_groups = "{{ index (index $.WorkerpoolCfg $index) "target_groups" }}"
+ {{- end }}
+
+ {{- if ne (index (index $.WorkerpoolCfg $index) "clc_snippets") "null" }}
+ clc_snippets = {{ index (index $.WorkerpoolCfg $index) "clc snippets" }}
+ {{- end }}
+
+ {{- if $pool.Tags }}
+ tags = {{ index (index $.WorkerpoolCfg $index) "tags" }}
+ {{- end }}
+}
+{{- end }}
+
provider "aws" {
version = "2.48.0"
alias = "default"
