mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 09:39:09 +00:00
temp tf
This commit is contained in:
parent
a5e2fdc7a7
commit
ec505739c8
31 changed files with 1394 additions and 0 deletions
56
terraform/app/discord.tf
Normal file
56
terraform/app/discord.tf
Normal file
|
@ -0,0 +1,56 @@
|
|||
locals {
|
||||
discord_labels = {
|
||||
"app.kubernetes.io/name" = "discord"
|
||||
"app.kubernetes.io/part-of" = "roleypoly"
|
||||
"roleypoly/environment" = var.environment_tag
|
||||
}
|
||||
}
|
||||
|
||||
resource "kubernetes_deployment" "discord" {
|
||||
metadata {
|
||||
name = "discord"
|
||||
namespace = local.ns
|
||||
labels = local.discord_labels
|
||||
}
|
||||
|
||||
spec {
|
||||
replicas = 1
|
||||
|
||||
selector {
|
||||
match_labels = local.discord_labels
|
||||
}
|
||||
|
||||
template {
|
||||
metadata {
|
||||
labels = local.discord_labels
|
||||
}
|
||||
|
||||
spec {
|
||||
container {
|
||||
image = "roleypoly/discord:${local.tags.discord}"
|
||||
name = "discord"
|
||||
|
||||
liveness_probe {
|
||||
http_get {
|
||||
path = "/"
|
||||
port = 16777
|
||||
}
|
||||
|
||||
initial_delay_seconds = 3
|
||||
period_seconds = 3
|
||||
}
|
||||
|
||||
readiness_probe {
|
||||
http_get {
|
||||
path = "/"
|
||||
port = 16777
|
||||
}
|
||||
|
||||
initial_delay_seconds = 3
|
||||
period_seconds = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
terraform/app/provision.tf
Normal file
26
terraform/app/provision.tf
Normal file
|
@ -0,0 +1,26 @@
|
|||
terraform {
|
||||
required_version = ">=0.12.6"
|
||||
|
||||
backend "remote" {
|
||||
organization = "Roleypoly"
|
||||
|
||||
workspaces {
|
||||
prefix = "roleypoly-app-"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "k8s_endpoint" { type = string }
|
||||
variable "k8s_token" { type = string }
|
||||
variable "k8s_cert" { type = string }
|
||||
variable "k8s_namespace" { type = string }
|
||||
provider "kubernetes" {
|
||||
load_config_file = false
|
||||
token = var.k8s_token
|
||||
host = var.k8s_endpoint
|
||||
cluster_ca_certificate = var.k8s_cert
|
||||
}
|
||||
|
||||
locals {
|
||||
ns = var.k8s_namespace
|
||||
}
|
6
terraform/app/tags.auto.tfvars.json
Normal file
6
terraform/app/tags.auto.tfvars.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"deployment_env": {
|
||||
"production": {},
|
||||
"staging": {}
|
||||
}
|
||||
}
|
12
terraform/app/variables.tf
Normal file
12
terraform/app/variables.tf
Normal file
|
@ -0,0 +1,12 @@
|
|||
variable "deployment_env" {
|
||||
type = map(map(string))
|
||||
}
|
||||
|
||||
variable "environment_tag" {
|
||||
type = string
|
||||
description = "One of: production, staging, test"
|
||||
}
|
||||
|
||||
locals {
|
||||
tags = var.deployment_env[var.environment_tag]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue