-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
module "ssh" { | ||
source = "../../ssh" | ||
ssh_key_path = var.ssh_key_path | ||
ssh_pubkey_path = var.ssh_pubkey_path | ||
ssh_keys_dir = var.ssh_keys_dir | ||
} | ||
|
||
module "provider" { | ||
source = "../../provider/oracle" | ||
|
||
tenancy_ocid = var.tenancy_ocid | ||
user_ocid = var.user_ocid | ||
private_key_path = var.private_key_path | ||
fingerprint = var.fingerprint | ||
region = var.region | ||
shape = var.oci_shape | ||
ssh_keys = var.oci_ssh_keys | ||
size = var.oci_type | ||
image = var.oci_image | ||
hosts = var.node_count | ||
hostname_format = var.hostname_format | ||
ssh_key_path = module.ssh.private_key #var.ssh_key_path Override to use predefined key | ||
ssh_pubkey_path = module.ssh.public_key #var.ssh_pubkey_path Override to use predefined key | ||
enable_volumes = var.enable_volumes | ||
volume_size = var.volume_size | ||
enable_floatingip = var.enable_floatingip | ||
} | ||
|
||
module "swap" { | ||
source = "../../service/swap" | ||
|
||
node_count = var.node_count | ||
connections = module.provider.public_ips | ||
ssh_key_path = module.ssh.private_key | ||
} | ||
|
||
## Comment out if you do not have a domain ### | ||
module "dns" { | ||
source = "../../dns/digitalocean" | ||
|
||
node_count = var.node_count | ||
token = var.digitalocean_token | ||
domain = var.domain | ||
public_ips = module.provider.public_ips | ||
hostnames = module.provider.hostnames | ||
create_zone = var.create_zone | ||
trform_domain = var.trform_domain | ||
} | ||
|
||
module "wireguard" { | ||
source = "../../security/wireguard" | ||
|
||
node_count = var.node_count | ||
connections = module.provider.public_ips | ||
private_ips = module.provider.private_ips | ||
hostnames = module.provider.hostnames | ||
overlay_cidr = module.k3s.overlay_cidr | ||
service_cidr = var.service_cidr | ||
vpn_iprange = var.vpn_iprange | ||
ssh_key_path = module.ssh.private_key | ||
} | ||
|
||
module "firewall" { | ||
source = "../../security/ufw" | ||
|
||
node_count = var.node_count | ||
connections = module.provider.public_ips | ||
private_interface = module.provider.private_network_interface | ||
vpn_interface = module.wireguard.vpn_interface | ||
vpn_port = module.wireguard.vpn_port | ||
overlay_interface = module.k3s.overlay_interface | ||
overlay_cidr = module.k3s.overlay_cidr | ||
ssh_key_path = module.ssh.private_key | ||
additional_rules = var.additional_rules | ||
} | ||
|
||
module "k3s" { | ||
source = "../../service/k3s" | ||
|
||
node_count = var.node_count | ||
connections = module.provider.public_ips | ||
cluster_name = var.domain | ||
vpn_interface = module.wireguard.vpn_interface #module.provider.private_network_interface | ||
vpn_ips = module.wireguard.vpn_ips #module.provider.private_ips | ||
hostname_format = var.hostname_format | ||
ssh_key_path = module.ssh.private_key | ||
k3s_version = var.k3s_version | ||
cni = var.cni | ||
overlay_cidr = var.overlay_cidr | ||
service_cidr = var.service_cidr | ||
kubeconfig_path = var.kubeconfig_path | ||
private_ips = module.provider.private_ips | ||
private_interface = module.provider.private_network_interface | ||
domain = var.domain | ||
region = module.provider.region | ||
ha_cluster = var.ha_cluster | ||
### Optional Settings Below. You may safely omit them. ### | ||
# Uncomment below if you have specified the DNS module | ||
dns_auth = module.dns.dns_auth | ||
trform_domain = module.dns.trform_domain | ||
create_certs = var.create_certs | ||
ha_nodes = var.ha_nodes | ||
install_app = var.install_app | ||
auth_user = var.auth_user | ||
auth_password = var.auth_password | ||
oidc_config = var.oidc_config | ||
mail_config = var.mail_config | ||
loadbalancer = var.loadbalancer | ||
registry_user = var.registry_user | ||
registry_password = var.registry_password | ||
enable_volumes = var.enable_volumes | ||
floating_ip = module.provider.floating_ip | ||
} | ||
|
||
output "private_key" { | ||
value = abspath(module.ssh.private_key) | ||
} | ||
|
||
output "public_key" { | ||
value = abspath(module.ssh.public_key) | ||
} | ||
|
||
output "ssh-master" { | ||
value = "ssh -i ${abspath(module.ssh.private_key)} -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@${try(module.provider.public_ips[0], "localhost")}" | ||
} | ||
|
||
output "instances" { | ||
value = module.provider.nodes | ||
} | ||
|
||
output "kubeconfig" { | ||
value = module.k3s.kubeconfig | ||
} | ||
|
||
output "test" { | ||
value = "curl -Lkvv test.${var.domain}" | ||
} | ||
|
||
output "default_password" { | ||
value = module.k3s.default_password | ||
} | ||
|
||
output "floating_ip" { | ||
value = try(module.provider.floating_ip.ip_address, "") | ||
} | ||
|
||
/* | ||
output "servers" { | ||
value = module.provider.ovh_servers | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# DNS Settings | ||
# Delete the DNS module in main.tf if you do not have these | ||
create_zone = "true" | ||
domain = <required> | ||
digitalocean_token = <required> | ||
|
||
node_count = 2 | ||
k3s_version = "v1.21.1+k3s1" | ||
cni = "weave" | ||
|
||
# Configure your provider | ||
# https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm | ||
region = <required> | ||
tenancy_ocid = <required> | ||
user_ocid = <required> | ||
private_key_path = <required> | ||
fingerprint = <required> | ||
|
||
enable_volumes = "false" | ||
volume_size = 50 | ||
enable_floatingip = "false" | ||
size = "1c6g" | ||
# Additional apps | ||
install_app = { | ||
kubernetes_dashboard = false, | ||
longhorn = false, | ||
floating-ip = false, | ||
vault = false, | ||
trow = false, | ||
superset = false, | ||
sentry = false, | ||
kube_prometheus = false, | ||
elastic_cloud = false | ||
} | ||
# HA Cluster | ||
#ha_cluster = "true" | ||
# External DNS Management and WildCard Letsencrypt Certs | ||
#trform_domain = "false" | ||
# LetsEncrypt Cert Issuance | ||
#create_certs = "true" |
Oops, something went wrong.