@@ -6,7 +6,7 @@ data "aws_vpc" "default" {
6
6
data "aws_subnets" "available" {
7
7
filter {
8
8
name = " vpc-id"
9
- values = [data . aws_vpc . default . id ]
9
+ values = [data . aws_vpc . default . id ]
10
10
}
11
11
}
12
12
@@ -49,22 +49,53 @@ data "cloudinit_config" "k3s_server" {
49
49
part {
50
50
filename = " init.cfg"
51
51
content_type = " text/cloud-config"
52
- content = templatefile (" ${ path . module } /files/cloud-config-base.yaml" , { ssh_keys = var.ssh_keys })
52
+ content = templatefile (" ${ path . module } /files/cloud-config-base.yaml" ,
53
+ {
54
+ ssh_keys = var.ssh_keys
55
+ })
53
56
}
54
57
55
58
part {
56
59
content_type = " text/x-shellscript"
57
- content = templatefile (" ${ path . module } /files/k3s-install.sh" , { install_k3s_version = local.install_k3s_version, k3s_exec = local.server_k3s_exec, k3s_cluster_secret = local.k3s_cluster_secret, is_k3s_server = true , k3s_url = aws_lb.server- lb.dns_name, k3s_datastore_endpoint = local.k3s_datastore_endpoint, k3s_datastore_cafile = local.k3s_datastore_cafile, k3s_disable_agent = local.k3s_disable_agent, k3s_tls_san = local.k3s_tls_san, k3s_deploy_traefik = local.k3s_deploy_traefik })
60
+ content = templatefile (" ${ path . module } /files/k3s-install.sh" ,
61
+ {
62
+ install_k3s_version = local.install_k3s_version,
63
+ k3s_exec = local.server_k3s_exec,
64
+ k3s_cluster_secret = local.k3s_cluster_secret,
65
+ is_k3s_server = true ,
66
+ k3s_url = aws_lb.server- lb.dns_name,
67
+ k3s_datastore_endpoint = local.k3s_datastore_endpoint,
68
+ k3s_datastore_cafile = local.k3s_datastore_cafile,
69
+ k3s_disable_agent = local.k3s_disable_agent,
70
+ k3s_tls_san = local.k3s_tls_san,
71
+ k3s_deploy_traefik = local.k3s_deploy_traefik
72
+ })
58
73
}
59
74
60
75
part {
61
76
content_type = " text/x-shellscript"
62
- content = templatefile (" ${ path . module } /files/rancher-install.sh" , { certmanager_version = local.certmanager_version, letsencrypt_email = local.letsencrypt_email, letsencrypt_environment = local.letsencrypt_environment, rancher_version = local.rancher_version, rancher_hostname = " ${ local . subdomain } .${ local . domain } " , install_rancher = local.install_rancher, install_certmanager = local.install_certmanager, rancher_password = local.rancher_password })
77
+ content = templatefile (
78
+ " ${ path . module } /files/rancher-install.sh" ,
79
+ { certmanager_version = local.certmanager_version,
80
+ letsencrypt_email = local.letsencrypt_email,
81
+ letsencrypt_environment = local.letsencrypt_environment,
82
+ rancher_version = local.rancher_version,
83
+ rancher_hostname = " ${ local . subdomain } .${ local . domain } " ,
84
+ install_rancher = local.install_rancher,
85
+ install_certmanager = local.install_certmanager,
86
+ rancher_password = local.rancher_password,
87
+ features = local.rancher_features
88
+ })
63
89
}
64
90
65
91
part {
66
92
content_type = " text/x-shellscript"
67
- content = templatefile (" ${ path . module } /files/register-to-rancher.sh" , { is_k3s_server = true , install_rancher = local.install_rancher, registration_command = local.registration_command })
93
+ content = templatefile (" ${ path . module } /files/register-to-rancher.sh" ,
94
+ {
95
+ is_k3s_server = true ,
96
+ install_rancher = local.install_rancher,
97
+ registration_command = local.registration_command
98
+ })
68
99
}
69
100
}
70
101
@@ -76,11 +107,26 @@ data "cloudinit_config" "k3s_agent" {
76
107
part {
77
108
filename = " init.cfg"
78
109
content_type = " text/cloud-config"
79
- content = templatefile (" ${ path . module } /files/cloud-config-base.yaml" , { ssh_keys = var.ssh_keys })
110
+ content = templatefile (" ${ path . module } /files/cloud-config-base.yaml" ,
111
+ {
112
+ ssh_keys = var.ssh_keys
113
+ })
80
114
}
81
115
82
116
part {
83
117
content_type = " text/x-shellscript"
84
- content = templatefile (" ${ path . module } /files/k3s-install.sh" , { install_k3s_version = local.install_k3s_version, k3s_exec = local.agent_k3s_exec, k3s_cluster_secret = local.k3s_cluster_secret, is_k3s_server = false , k3s_url = aws_lb.server- lb.dns_name, k3s_datastore_endpoint = local.k3s_datastore_endpoint, k3s_datastore_cafile = local.k3s_datastore_cafile, k3s_disable_agent = local.k3s_disable_agent, k3s_tls_san = local.k3s_tls_san, k3s_deploy_traefik = local.k3s_deploy_traefik })
118
+ content = templatefile (" ${ path . module } /files/k3s-install.sh" ,
119
+ {
120
+ install_k3s_version = local.install_k3s_version,
121
+ k3s_exec = local.agent_k3s_exec,
122
+ k3s_cluster_secret = local.k3s_cluster_secret,
123
+ is_k3s_server = false ,
124
+ k3s_url = aws_lb.server- lb.dns_name,
125
+ k3s_datastore_endpoint = local.k3s_datastore_endpoint,
126
+ k3s_datastore_cafile = local.k3s_datastore_cafile,
127
+ k3s_disable_agent = local.k3s_disable_agent,
128
+ k3s_tls_san = local.k3s_tls_san,
129
+ k3s_deploy_traefik = local.k3s_deploy_traefik
130
+ })
85
131
}
86
132
}
0 commit comments