Skip to content

Latest commit

 

History

History
executable file
·
68 lines (59 loc) · 1.59 KB

README.md

File metadata and controls

executable file
·
68 lines (59 loc) · 1.59 KB

Flux install module

Terraform module to install FluxCD V2

Dependencies

Create ssh keypair and add and add to your git repo and keep it in a safe place.

export MY_CLUSTER="your-cluster-name"
ssh-keygen -t ed25519 -C $MY_CLUSTER -f identity

Import known hosts from your git provider GitHub

export MY_PROJECT_PATH="your/project/path"
ssh-keyscan -H github.com >> $MY_PROJECT_PATH/known_hosts

GitLab

export MY_PROJECT_PATH="your/project/path"
ssh-keyscan -H gitlab.com >> $MY_PROJECT_PATH/known_hosts

BitBucket

export MY_PROJECT_PATH="your/project/path"
ssh-keyscan -H bitbucket.org >> $MY_PROJECT_PATH/known_hosts

Usage

Basic usage of the module as follows:

module "flux-install" {
  source            = "rafaelperoco/flux-install/flux"
  version           = "0.1.4"
  target_path       = var.target_path
  flux_manifests    = var.flux_manifests
  gitrepository     = var.gitrepository
  gitrepo_url       = var.gitrepo_url
  gitbranch         = var.gitbranch
  interval          = var.interval
  identity_file     = var.identity_file
  identity_pub_file = var.identity_pub_file
  known_hosts_file  = var.known_hosts_file
}

terraform.tfvars

target_path = "cluster"
flux_manifests = "cluster"
identity_file = "identity"
identity_pub_file = "identity.pub"
known_hosts_file = "known_hosts"
gitrepo_url = "ssh://[email protected]/your-username/my-cluster-with-flux.git"
gitrepository = "my-cluster-with-flux"
interval = "1m0s"
gitbranch = "main"

providers.tf

provider "kubernetes" {
  config_path = "~/.kube/config"
}