-
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
20 changed files
with
176 additions
and
56 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,7 @@ | ||
terraform.tfvars | ||
.terraform | ||
.terraform* | ||
*.tfstate.backup | ||
*.tfstate | ||
.vscode/ | ||
data/ |
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 |
---|---|---|
@@ -1,7 +1,30 @@ | ||
## Create SSH key (or use your own key) | ||
## How to use? | ||
|
||
Copy **terraform.tfvars** from **sample** and fill all variables in **terraform.tfvars** | ||
|
||
``` | ||
cp terraform.tfvars.sample terraform.tfvars | ||
``` | ||
|
||
### Initalize and apply | ||
|
||
These commands will create [k3s](https://k3s.io/) cluster. | ||
|
||
``` | ||
sh create_ssh_key.sh | ||
terraform init | ||
terraform plan | ||
terraform apply | ||
``` | ||
|
||
I will update here. | ||
### DNS module | ||
|
||
if you want to use **cloudflare dns** module. | ||
Please uncomment all lines related to Cloudflare in **dns.tf** and **terraform.tfvars** files. | ||
|
||
### Create SSH key (or you can use your own key) | ||
|
||
This command will create **id_rsa** and **id_rsa.pub** file in **./data** directory. | ||
|
||
``` | ||
sh files/create_ssh_key.sh | ||
``` |
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
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
# module "dns" { | ||
# source = "./dns" | ||
# cloudflare_email = "${var.cloudflare_email}" | ||
# cloudflare_token = "${var.cloudflare_token}" | ||
# cloudflare_zone = "${var.cloudflare_zone}" | ||
|
||
# master = "${scaleway_server.master}" | ||
# agents = "${scaleway_server.agent}" | ||
# prefix = "${var.prefix}" | ||
# instance_agents_count = "${var.instance_agents_count}" | ||
# } | ||
|
||
# # Cloudflare | ||
# variable "cloudflare_email" {} | ||
|
||
# variable "cloudflare_token" {} | ||
|
||
# variable "cloudflare_zone" {} |
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,22 @@ | ||
resource "cloudflare_record" "agent" { | ||
count = "${var.instance_agents_count}" | ||
domain = "${var.cloudflare_zone}" | ||
name = "${var.prefix}-agent-${count.index}" | ||
value = "${element(var.agents.*.public_ip, count.index)}" | ||
type = "A" | ||
ttl = 1 | ||
} | ||
resource "cloudflare_record" "agent_private" { | ||
count = "${var.instance_agents_count}" | ||
domain = "${var.cloudflare_zone}" | ||
name = "${var.prefix}-agent-private-${count.index}" | ||
value = "${element(var.agents.*.private_ip, count.index)}" | ||
type = "A" | ||
ttl = 1 | ||
} | ||
output "agents_zone" { | ||
value = ["${cloudflare_record.agent.*.hostname}"] | ||
} | ||
output "agents_zone_private" { | ||
value = ["${cloudflare_record.agent_private.*.hostname}"] | ||
} |
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,5 @@ | ||
# Configure Cloudflare | ||
provider "cloudflare" { | ||
email = "${var.cloudflare_email}" | ||
token = "${var.cloudflare_token}" | ||
} |
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,22 @@ | ||
resource "cloudflare_record" "master" { | ||
domain = "${var.cloudflare_zone}" | ||
name = "${var.prefix}" | ||
value = "${var.master.public_ip}" | ||
type = "A" | ||
ttl = 1 | ||
} | ||
|
||
resource "cloudflare_record" "master_private" { | ||
domain = "${var.cloudflare_zone}" | ||
name = "${var.prefix}" | ||
value = "${var.master.private_ip}" | ||
type = "A" | ||
ttl = 1 | ||
} | ||
|
||
output "master_zone" { | ||
value = "${cloudflare_record.master.hostname}" | ||
} | ||
output "master_zone_private" { | ||
value = "${cloudflare_record.master_private.hostname}" | ||
} |
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,19 @@ | ||
# Cloudflare | ||
variable "cloudflare_email" {} | ||
|
||
variable "cloudflare_token" {} | ||
|
||
variable "cloudflare_zone" {} | ||
|
||
|
||
variable "master" {} | ||
|
||
variable "agents" {} | ||
variable "instance_agents_count" { | ||
|
||
} | ||
variable "prefix" { | ||
|
||
} | ||
|
||
|
File renamed without changes.
File renamed without changes.
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,6 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
token=$(cat ./data/node-token) | ||
# Trim | ||
token=`echo $token` | ||
echo "{\"token\":\"$token\"}" |
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
resource "scaleway_ssh_key" "k3s" { | ||
key = local.ssh_public | ||
depends_on = ["scaleway_server.master"] | ||
key = "${local.ssh_public}" | ||
} |
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 |
---|---|---|
|
@@ -27,16 +27,20 @@ instance_agents_count = "2" | |
|
||
|
||
|
||
# Email for your Cloudflare account | ||
cloudflare_email = "@@@@gmail.com" | ||
|
||
# Cloudflare token | ||
cloudflare_token = "TOKEN_HERE" | ||
|
||
# Cloudflare zone | ||
cloudflare_zone = "akmsoftware.co.uk" | ||
|
||
#ssh user | ||
ssh_user = "root" | ||
ssh_public_key_file = "./data/id_rsa.pub" | ||
ssh_private_key_file = "./data/id_rsa" | ||
|
||
|
||
|
||
# # If you are going to use dns module you need to fill these variables up. | ||
|
||
# # Email for your Cloudflare account | ||
# cloudflare_email = "[email protected]" | ||
|
||
# # Cloudflare token | ||
# cloudflare_token = "token_here" | ||
|
||
# # Cloudflare zone | ||
# cloudflare_zone = "akmsoftware.co.uk" |
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