50 lines
1.3 KiB
HCL
50 lines
1.3 KiB
HCL
terraform {
|
|
required_version = ">= 1.0.4, < 2.0.0"
|
|
|
|
required_providers {
|
|
kubernetes = {
|
|
source = "hashicorp/kubernetes"
|
|
version = ">= 2.20.0"
|
|
}
|
|
}
|
|
|
|
backend "s3" {
|
|
endpoint = "http://s3.localdomain"
|
|
key = "projects/go-kafka.tfstate"
|
|
bucket = "terraform"
|
|
region = "FR"
|
|
skip_credentials_validation = true
|
|
skip_region_validation = true
|
|
skip_metadata_api_check = true
|
|
shared_credentials_file = "~/.aws/credentials"
|
|
force_path_style = true
|
|
}
|
|
}
|
|
|
|
provider "kubernetes" {
|
|
config_paths = [
|
|
"~/.kube/1-kind.kubeconfig",
|
|
"~/.kube/config.kubeconfig"
|
|
]
|
|
|
|
config_context = terraform.workspace == "default" ? "antoine@kubernetes" : terraform.workspace
|
|
}
|
|
|
|
data "kubernetes_namespace_v1" "streaming_namespace" {
|
|
metadata {
|
|
name = "streaming"
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_namespace_v1" "application_namespace" {
|
|
metadata {
|
|
name = "some-application"
|
|
}
|
|
}
|
|
|
|
module "kafka" {
|
|
source = "./kafka"
|
|
namespace = data.kubernetes_namespace_v1.streaming_namespace.metadata.0.name
|
|
user-auth-type = terraform.workspace == "default" ? "scram-sha-512" : "tls"
|
|
cluster-name = terraform.workspace == "default" ? "dev" : "cluster-development"
|
|
} |