-
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
1 parent
dc7cfe8
commit a061d24
Showing
6 changed files
with
72 additions
and
1 deletion.
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
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,2 @@ | ||
# Terraform DigitalOcean Traefik Module | ||
A Terraform module to provision Traefik (v2.x) on a Kubernetes cluster via the [helm terraform provider](https://registry.terraform.io/providers/hashicorp/helm/latest). |
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,21 @@ | ||
# Install traefik helm_chart | ||
resource "helm_release" "traefik" { | ||
namespace = var.namespace | ||
name = "traefik-v${replace(var.traefik_chart_version, ".", "-")}" | ||
repository = "https://helm.traefik.io/traefik" | ||
chart = "traefik" | ||
version = var.traefik_chart_version | ||
|
||
# If default_values == "" then apply default values from the chart if its anything else | ||
# then apply values file using the values_file input variable | ||
values = [var.default_values == "" ? var.default_values : file("${path.root}/${var.values_file}")] | ||
|
||
set { | ||
name = "deployment.replicas" | ||
value = var.replica_count | ||
} | ||
|
||
depends_on = [ | ||
kubernetes_namespace.traefik_namespace | ||
] | ||
} |
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 @@ | ||
# Create traefik namespace | ||
resource "kubernetes_namespace" "traefik_namespace" { | ||
metadata { | ||
name = var.namespace | ||
} | ||
} |
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,29 @@ | ||
variable "namespace" { | ||
description = "Namespace to install traefik chart into" | ||
type = string | ||
default = "traefik" | ||
} | ||
|
||
variable "traefik_chart_version" { | ||
description = "Version of Traefik chart to install" | ||
type = string | ||
default = "10.7.1" # See https://artifacthub.io/packages/helm/traefik/traefik for latest version(s) | ||
} | ||
|
||
variable "replica_count" { | ||
description = "Number of replica pods to create" | ||
type = number | ||
default = 1 | ||
} | ||
|
||
variable "default_values" { | ||
description = "Specifies whether to use the traefik default values.yaml, or if set to anything else then to use your own custom values" | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "values_file" { | ||
description = "The name of the traefik helmchart values file to use" | ||
type = string | ||
default = "values.yaml" | ||
} |
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,13 @@ | ||
terraform { | ||
required_providers { | ||
kubernetes = { | ||
source = "hashicorp/kubernetes" | ||
version = ">= 2.0.0" | ||
} | ||
helm = { | ||
source = "hashicorp/helm" | ||
version = ">= 2.0.1" | ||
} | ||
} | ||
required_version = ">= 0.15" | ||
} |