1+ module "configuration" {
2+ source = " ../../common/configuration"
3+
4+ configuration = var. configuration
5+ base_key = var. configuration_base_key
6+ }
7+
8+ locals {
9+ # current workspace config
10+ cfg = module. configuration . merged [terraform . workspace ]
11+ }
12+
113data "aws_region" "current" {
214}
315
416module "cluster_metadata" {
517 source = " ../../common/metadata"
618
7- name_prefix = local. name_prefix
8- base_domain = local. base_domain
19+ name_prefix = local. cfg [ " name_prefix" ]
20+ base_domain = local. cfg [ " base_domain" ]
921
1022 provider_name = " aws"
1123 provider_region = data. aws_region . current . name
@@ -18,49 +30,63 @@ module "cluster" {
1830 metadata_fqdn = module. cluster_metadata . fqdn
1931 metadata_labels = module. cluster_metadata . labels
2032
21- availability_zones = local. cluster_availability_zones
22-
23- vpc_cidr = local. cluster_vpc_cidr
24- vpc_control_subnet_newbits = local. cluster_vpc_control_subnet_newbits
25- vpc_dns_hostnames = local. cluster_vpc_dns_hostnames
26- vpc_dns_support = local. cluster_vpc_dns_support
27- vpc_node_subnet_newbits = local. cluster_vpc_node_subnet_newbits
28- vpc_node_subnet_number_offset = local. cluster_vpc_node_subnet_number_offset
29- vpc_legacy_node_subnets = local. cluster_vpc_legacy_node_subnets
30- vpc_subnet_map_public_ip = local. cluster_vpc_subnet_map_public_ip
31-
32- instance_types = local. cluster_instance_types
33- desired_capacity = local. cluster_desired_capacity
34- max_size = local. cluster_max_size
35- min_size = local. cluster_min_size
36- cluster_version = local. cluster_version
37-
38- metadata_options = local. metadata_options
39-
40- root_device_encrypted = local. worker_root_device_encrypted
41- root_device_volume_size = local. worker_root_device_volume_size
42-
43- additional_node_tags = local. cluster_additional_node_tags
44-
45- aws_auth_map_roles = local. cluster_aws_auth_map_roles
46- aws_auth_map_users = local. cluster_aws_auth_map_users
47- aws_auth_map_accounts = local. cluster_aws_auth_map_accounts
48-
49- disable_default_ingress = local. disable_default_ingress
50-
51- enabled_cluster_log_types = local. enabled_cluster_log_types
52-
53- disable_openid_connect_provider = local. disable_openid_connect_provider
54-
55- cluster_endpoint_private_access = local. cluster_endpoint_private_access
56- cluster_endpoint_public_access = local. cluster_endpoint_public_access
57- cluster_public_access_cidrs = local. cluster_public_access_cidrs
58- cluster_service_cidr = local. cluster_service_cidr
59-
60- cluster_encryption_key_arn = local. cluster_encryption_key_arn
61-
62- worker_ami_type = local. worker_ami_type
63- worker_ami_release_version = local. worker_ami_release_version
33+ availability_zones = local. cfg [" cluster_availability_zones" ] != null ? local. cfg [" cluster_availability_zones" ] : []
34+
35+ vpc_cidr = local. cfg [" cluster_vpc_cidr" ] != null ? local. cfg [" cluster_vpc_cidr" ] : " 10.0.0.0/16"
36+ vpc_control_subnet_newbits = local. cfg [" cluster_vpc_control_subnet_newbits" ] != null ? local. cfg [" cluster_vpc_control_subnet_newbits" ] : local. cfg [" cluster_vpc_subnet_newbits" ] != null ? local. cfg [" cluster_vpc_subnet_newbits" ] : " 8"
37+ vpc_dns_hostnames = local. cfg [" cluster_vpc_dns_hostnames" ] != null ? local. cfg [" cluster_vpc_dns_hostnames" ] : false
38+ vpc_dns_support = local. cfg [" cluster_vpc_dns_support" ] != null ? local. cfg [" cluster_vpc_dns_support" ] : true
39+ vpc_node_subnet_newbits = local. cfg [" cluster_vpc_node_subnet_newbits" ] != null ? local. cfg [" cluster_vpc_node_subnet_newbits" ] : " 4"
40+ vpc_node_subnet_number_offset = local. cfg [" cluster_vpc_node_subnet_number_offset" ] != null ? local. cfg [" cluster_vpc_node_subnet_number_offset" ] : " 1"
41+ vpc_legacy_node_subnets = local. cfg [" cluster_vpc_legacy_node_subnets" ] != null ? local. cfg [" cluster_vpc_legacy_node_subnets" ] : false
42+ vpc_subnet_map_public_ip = local. cfg [" cluster_vpc_subnet_map_public_ip" ] != null ? local. cfg [" cluster_vpc_subnet_map_public_ip" ] : true
43+
44+ instance_types = local. cfg [" cluster_instance_types" ] != null ? toset (local. cfg [" cluster_instance_types" ]) : (local. cfg [" cluster_instance_type" ] != null ? toset ([local . cfg [" cluster_instance_type" ]]) : toset ([]))
45+ desired_capacity = local. cfg [" cluster_desired_capacity" ]
46+ max_size = local. cfg [" cluster_max_size" ]
47+ min_size = local. cfg [" cluster_min_size" ]
48+ cluster_version = local. cfg [" cluster_version" ]
49+
50+ metadata_options = (
51+ local. cfg [" metadata_options_http_endpoint" ] != null ||
52+ local. cfg [" metadata_options_http_tokens" ] != null ||
53+ local. cfg [" metadata_options_http_put_response_hop_limit" ] != null ||
54+ local. cfg [" metadata_options_http_protocol_ipv6" ] != null ||
55+ local. cfg [" metadata_options_instance_metadata_tags" ] != null
56+ ? {
57+ http_endpoint = local.cfg[" metadata_options_http_endpoint" ]
58+ http_tokens = local.cfg[" metadata_options_http_tokens" ]
59+ http_put_response_hop_limit = local.cfg[" metadata_options_http_put_response_hop_limit" ]
60+ http_protocol_ipv6 = local.cfg[" metadata_options_http_protocol_ipv6" ]
61+ instance_metadata_tags = local.cfg[" metadata_options_instance_metadata_tags" ]
62+ }
63+ : null
64+ )
65+
66+ root_device_encrypted = local. cfg [" worker_root_device_encrypted" ]
67+ root_device_volume_size = local. cfg [" worker_root_device_volume_size" ]
68+
69+ additional_node_tags = local. cfg [" cluster_additional_node_tags" ] != null ? local. cfg [" cluster_additional_node_tags" ] : {}
70+
71+ aws_auth_map_roles = local. cfg [" cluster_aws_auth_map_roles" ] != null ? local. cfg [" cluster_aws_auth_map_roles" ] : " "
72+ aws_auth_map_users = local. cfg [" cluster_aws_auth_map_users" ] != null ? local. cfg [" cluster_aws_auth_map_users" ] : " "
73+ aws_auth_map_accounts = local. cfg [" cluster_aws_auth_map_accounts" ] != null ? local. cfg [" cluster_aws_auth_map_accounts" ] : " "
74+
75+ disable_default_ingress = local. cfg [" disable_default_ingress" ] != null ? local. cfg [" disable_default_ingress" ] : false
76+
77+ enabled_cluster_log_types = local. cfg [" enabled_cluster_log_types" ] != null ? local. cfg [" enabled_cluster_log_types" ] : [" api" , " audit" , " authenticator" , " controllerManager" , " scheduler" ]
78+
79+ disable_openid_connect_provider = local. cfg [" disable_openid_connect_provider" ] != null ? local. cfg [" disable_openid_connect_provider" ] : false
80+
81+ cluster_endpoint_private_access = local. cfg [" cluster_endpoint_private_access" ] != null ? local. cfg [" cluster_endpoint_private_access" ] : false
82+ cluster_endpoint_public_access = local. cfg [" cluster_endpoint_public_access" ] != null ? local. cfg [" cluster_endpoint_public_access" ] : true
83+ cluster_public_access_cidrs = local. cfg [" cluster_public_access_cidrs" ]
84+ cluster_service_cidr = local. cfg [" cluster_service_cidr" ]
85+
86+ cluster_encryption_key_arn = local. cfg [" cluster_encryption_key_arn" ]
87+
88+ worker_ami_type = local. cfg [" worker_ami_type" ]
89+ worker_ami_release_version = local. cfg [" worker_ami_release_version" ]
6490
6591 # cluster module configuration is still map(string)
6692 # once module_variable_optional_attrs isn't experimental anymore
0 commit comments