Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
caruccio committed Nov 4, 2021
0 parents commit 226eae3
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
test: fmt init validate

i init:
terraform init

v validate:
terraform validate

f fmt:
terraform fmt -recursive

Empty file added README.md
Empty file.
13 changes: 13 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
locals {
kubeconfig = abspath(pathexpand(var.kubeconfig_filename))
suffix = random_string.suffix.result
secret = random_string.secret.result

# git_clone = <<EOF
# if ! [ -d kubespray ]; then
# git clone --recurse-submodules $GIT_REPO $GIT_WORK_TREE
# fi
# cd $GIT_WORK_TREE
# git checkout -b $GIT_BRANCH
# EOF
}
11 changes: 11 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module "internet" {
source = "github.com/getupcloud/terraform-module-internet?ref=main"
}

module "flux" {
source = "github.com/getupcloud/terraform-module-flux?ref=main"

git_repo = var.flux_git_repo
manifests_path = "./clusters/${var.name}/eks/manifests"
wait = var.flux_wait
}
40 changes: 40 additions & 0 deletions providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
terraform {
required_providers {
cronitor = {
source = "nauxliu/cronitor"
version = "~> 1"
}

shell = {
source = "scottwinkler/shell"
version = "~> 1"
}

kubectl = {
source = "gavinbunney/kubectl"
version = "~> 1"
}

random = {
version = "~> 2"
}

kubernetes = {
version = "~> 2.3.2"
}
}
}

provider "shell" {
enable_parallelism = true
interpreter = ["/bin/bash", "-c"]
}

provider "kubectl" {
config_path = var.kubeconfig_filename
apply_retry_count = 2
}

provider "kubernetes" {
config_path = var.kubeconfig_filename
}
12 changes: 12 additions & 0 deletions random.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "random_string" "suffix" {
length = 16
special = false
upper = false
}

resource "random_string" "secret" {
length = 128
special = false
upper = true
number = true
}
57 changes: 57 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
variable "name" {
description = "Cluster name"
type = string
}

#variable "git_repo" {
# description = "Kubespray git repository"
# type = string
# default = "https://github.com/kubernetes-sigs/kubespray.git"
#}

#variable "git_branch" {
# description = "Kubespray branch name"
# type = string
# default = "release-2.17"
#}

variable "kubeconfig_filename" {
description = "Kubeconfig path"
default = "~/.kube/config"
type = string
}

variable "get_kubeconfig_command" {
description = "Command to create/update kubeconfig"
default = "true"
}

variable "flux_git_repo" {
description = "GitRepository URL."
type = string
default = ""
}

variable "flux_wait" {
description = "Wait for all manifests to apply"
type = bool
default = true
}

variable "manifests_path" {
description = "Manifests dir inside GitRepository"
type = string
default = ""
}

variable "cronitor_api_key" {
description = "Wait for all manifests to apply"
type = string
default = null
}

variable "cronitor_pagerduty_key" {
description = "Wait for all manifests to apply"
type = string
default = null
}

0 comments on commit 226eae3

Please sign in to comment.