Skip to content

Commit

Permalink
style: apply auto format
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-roux-404 committed Jul 6, 2024
1 parent 3137489 commit 495c2d4
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 43 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ make bootstrap
For native linux simply run build command directly :

```bash
nix build .#nixosConfigurations.aarch64-darwin.default
nix build .#nixosConfigurations.default
```

> Supported systems are `aarch64-linux`, `x86_64-linux`, `aarch64-darwin` and `x86_64-darwin`.
Expand All @@ -54,13 +54,18 @@ sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

### Terraform local setup

Bootrap local vm :
```bash
make init
```

Boostrap local vm and tailscale :

```bash
terraform -chdir=tf-root-libvirt init
terraform -chdir=tf-root-libvirt apply -auto-approve
make tf-root-vm ARGS=-var-file=$PWD/.dev.tfvars
```

> See below to fill variables, adapt variables to a non production environment.
Setup k8s modules :

```bash
Expand Down Expand Up @@ -134,6 +139,8 @@ make tf-root-contabo ARGS=-var-file=$PWD/.prod.tfvars
make . ARGS=-var-file=.prod.tfvars
```

> **Note :** You can also use `make trust-ca` to trust internal CA on your system.
## Cheat Sheet

## Nix
Expand Down
2 changes: 1 addition & 1 deletion docs/1-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ sudo security add-trusted-cert -d -r trustAsRoot -k /Library/Keychains/System.ke
Setup waypoint inside cluster before getting token :

```bash
Run KUBECONFIG=/etc/rancher/k3s/k3s.yaml waypoint login -from-kubernetes"
Run KUBECONFIG=/etc/rancher/k3s/k3s.yaml waypoint login -from-kubernetes
```

Setup waypoint login context outside cluster :
Expand Down
36 changes: 18 additions & 18 deletions tf-root-vm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ module "contabo_vm" {

locals {
contabo_hosts = { for vm in module.contabo_vm : vm.name => {
id = vm.id
ip = vm.ip
}
id = vm.id
ip = vm.ip
}
}
machines_hosts = merge(
{ for vm in module.libvirt_vm : vm.name => {
id = vm.id
Expand All @@ -46,10 +46,10 @@ locals {
}

module "tailscale" {
source = "./tf-modules-cloud/tailscale"
tailscale_trusted_device = var.tailscale_trusted_device
trusted_ssh_user = var.ssh_connection.user
tailscale_tailnet = var.tailscale_tailnet
source = "./tf-modules-cloud/tailscale"
tailscale_trusted_device = var.tailscale_trusted_device
trusted_ssh_user = var.ssh_connection.user
tailscale_tailnet = var.tailscale_tailnet
}

resource "random_password" "admin_password" {
Expand All @@ -59,19 +59,19 @@ resource "random_password" "admin_password" {
}

module "deploy" {
source = "./tf-modules-nix/deploy"
for_each = local.machines_hosts
node_hostname = each.key
dex_client_id = var.dex_client_id
vm_ip = each.value.ip
ssh_connection = local.ssh_connection
nixos_options = {
source = "./tf-modules-nix/deploy"
for_each = local.machines_hosts
node_hostname = each.key
dex_client_id = var.dex_client_id
vm_ip = each.value.ip
ssh_connection = local.ssh_connection
nixos_options = {
"networking.hostName" = each.key
}
nixos_secrets = {
"tailscale" = "${module.tailscale.key}"
"password" = "${random_password.admin_password.bcrypt_hash}"
"tailscale_oauth_client_id" = var.tailscale_oauth_client.id
"tailscale" = "${module.tailscale.key}"
"password" = "${random_password.admin_password.bcrypt_hash}"
"tailscale_oauth_client_id" = var.tailscale_oauth_client.id
"tailscale_oauth_client_secret" = var.tailscale_oauth_client.secret
}
}
Expand Down Expand Up @@ -123,6 +123,6 @@ output "up_k3s_endpoint" {
}

output "password" {
value = random_password.admin_password.result
value = random_password.admin_password.result
sensitive = true
}
2 changes: 1 addition & 1 deletion tf-root-vm/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ provider "tailscale" {
oauth_client_id = var.tailscale_oauth_client.id
oauth_client_secret = var.tailscale_oauth_client.secret
tailnet = var.tailscale_tailnet
scopes = ["all"]
scopes = ["all"]
}

5 changes: 0 additions & 5 deletions tf-root-vm/tf-modules-cloud/libvirt/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ variable "vm_size" {
default = 8092
}

variable "debug" {
type = bool
default = false
}

variable "darwin" {
type = bool
default = true
Expand Down
4 changes: 0 additions & 4 deletions tf-root-vm/tf-modules-nix/deploy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,3 @@ variable "nix_flake" {
error_message = "Empty flake attribute paths not supported"
}
}

variable "nix_deploy_debug" {
default = false
}
20 changes: 10 additions & 10 deletions tf-root-vm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ variable "vm_provider" {
### Gandi domain provider

variable "gandi_token" {
type = string
type = string
nullable = true
}

variable "paas_base_domain" {
type = string
type = string
default = "k3s.test"
}

Expand All @@ -29,9 +29,9 @@ variable "contabo_credentials" {
}

variable "contabo_instance" {
type = string
type = string
nullable = true
default = null
default = null
}

variable "image_version" {
Expand All @@ -43,9 +43,9 @@ variable "image_url_format" {
}

variable "admin_password" {
type = string
type = string
sensitive = true
default = "$6$zizou$reVO3q7LFsUq.GT5P5pYFFcpxCo7eTRT5yJTD.gVoOy/FSzHEtXdofvZ7E04Rej.jiQHKaWJB0Qob5FHov1WU/"
default = "$6$zizou$reVO3q7LFsUq.GT5P5pYFFcpxCo7eTRT5yJTD.gVoOy/FSzHEtXdofvZ7E04Rej.jiQHKaWJB0Qob5FHov1WU/"
}

variable "ssh_connection" {
Expand Down Expand Up @@ -74,17 +74,17 @@ variable "tailscale_oauth_client" {
}

variable "tailscale_tailnet" {
type = string
type = string
description = "Like tailxxxxx.ts.net"
nullable = true
nullable = true
}

variable "tailscale_trusted_device" {
type = string
}

variable "dex_client_id" {
type = string
type = string
sensitive = true
default = "dex-k3s-paas"
default = "dex-k3s-paas"
}

0 comments on commit 495c2d4

Please sign in to comment.