Init
This commit is contained in:
commit
c3bc6ab806
40 changed files with 1069 additions and 0 deletions
24
redis/README.md
Normal file
24
redis/README.md
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Terraform module to deploy Redis instance
|
||||
|
||||
## Example for main.tf
|
||||
|
||||
```tf
|
||||
locals {
|
||||
stackit_project_id = "fb06b3bf-70b6-45bf-b1a4-e84708b26f92"
|
||||
region = "eu01"
|
||||
env = "dev"
|
||||
}
|
||||
|
||||
module "redis" {
|
||||
source = "git::https://stackit-hackathon-2025.git.qa.onstackit.cloud/commerce-platform/hackdays-common-infra-poc//terraform/modules/redis"
|
||||
stackit_project_id = local.stackit_project_id
|
||||
redis_name = "test-redis"
|
||||
redis_version = "7"
|
||||
redis_plan_name = "stackit-redis-1.4.10-single"
|
||||
|
||||
redis_parameters = {
|
||||
enable_monitoring = false
|
||||
down_after_milliseconds = 30000
|
||||
}
|
||||
}
|
||||
```
|
||||
29
redis/outputs.tf
Normal file
29
redis/outputs.tf
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
output "redis_id" {
|
||||
value = stackit_redis_instance.this.id
|
||||
description = "Redis instance ID"
|
||||
}
|
||||
|
||||
output "redis_host" {
|
||||
value = stackit_redis_instance.this.dashboard_url
|
||||
description = "Redis dashboard URL (may contain connection info)"
|
||||
}
|
||||
|
||||
output "redis_username" {
|
||||
value = stackit_redis_credential.this.username
|
||||
description = "Redis username"
|
||||
}
|
||||
|
||||
output "redis_password" {
|
||||
value = stackit_redis_credential.this.password
|
||||
description = "Redis password"
|
||||
}
|
||||
|
||||
output "redis_port" {
|
||||
value = stackit_redis_credential.this.port
|
||||
description = "Redis port"
|
||||
}
|
||||
|
||||
output "redis_uri" {
|
||||
value = stackit_redis_credential.this.uri
|
||||
description = "Redis URI"
|
||||
}
|
||||
9
redis/providers.tf
Normal file
9
redis/providers.tf
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
terraform {
|
||||
required_providers {
|
||||
stackit = {
|
||||
source = "stackitcloud/stackit"
|
||||
version = "~> 0.50.0"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
24
redis/redis.tf
Normal file
24
redis/redis.tf
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// Redis instance
|
||||
|
||||
resource "stackit_redis_instance" "this" {
|
||||
project_id = var.stackit_project_id
|
||||
name = var.redis_name
|
||||
version = var.redis_version
|
||||
plan_name = var.redis_plan_name
|
||||
|
||||
parameters = merge(
|
||||
{
|
||||
enable_monitoring = var.redis_parameters.enable_monitoring
|
||||
down_after_milliseconds = var.redis_parameters.down_after_milliseconds
|
||||
},
|
||||
var.redis_parameters.sgw_acl != null ? { sgw_acl = var.redis_parameters.sgw_acl } : {},
|
||||
var.redis_parameters.syslog != null ? { syslog = var.redis_parameters.syslog } : {}
|
||||
)
|
||||
}
|
||||
|
||||
// Redis Credentials
|
||||
resource "stackit_redis_credential" "this" {
|
||||
project_id = var.stackit_project_id
|
||||
instance_id = stackit_redis_instance.this.instance_id
|
||||
}
|
||||
|
||||
29
redis/variables.tf
Normal file
29
redis/variables.tf
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
variable "stackit_project_id" {
|
||||
type = string
|
||||
description = "STACKIT project ID"
|
||||
}
|
||||
|
||||
variable "redis_name" {
|
||||
type = string
|
||||
description = "Redis instance name"
|
||||
}
|
||||
|
||||
variable "redis_version" {
|
||||
type = string
|
||||
description = "Redis version (e.g. 7)"
|
||||
}
|
||||
|
||||
variable "redis_plan_name" {
|
||||
type = string
|
||||
description = "Redis plan name (e.g. stackit-redis-1.4.10-single)"
|
||||
}
|
||||
|
||||
variable "redis_parameters" {
|
||||
description = "Optional advanced Redis parameters"
|
||||
type = object({
|
||||
sgw_acl = optional(string)
|
||||
enable_monitoring = bool
|
||||
down_after_milliseconds = number
|
||||
syslog = optional(list(string))
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue