Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions terraform/seaweedfs/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "juju_application" "seaweedfs" {
config = var.config
constraints = var.constraints
model_uuid = var.model_uuid
name = var.app_name
storage_directives = var.storage_directives
trust = true
units = var.units

charm {
name = "seaweedfs-k8s"
channel = var.channel
revision = var.revision
}
}
16 changes: 16 additions & 0 deletions terraform/seaweedfs/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
output "app_name" {
value = juju_application.seaweedfs.name
description = "The name of the deployed SeaweedFS application"
}

output "provides" {
value = {
s3 = "s3"
}
description = "All Juju integration endpoints where the charm is the provider"
}

output "requires" {
value = {}
description = "All Juju integration endpoints where the charm is the requirer"
}
54 changes: 54 additions & 0 deletions terraform/seaweedfs/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
variable "model_uuid" {
description = "Reference to an existing model resource or data source for the model to deploy to"
type = string
}

variable "app_name" {
description = "Application name for the SeaweedFS deployment"
type = string
default = "seaweedfs"
}

variable "channel" {
description = "Channel that SeaweedFS is deployed from"
type = string
default = "latest/edge"
}

variable "revision" {
description = "Revision number of the SeaweedFS application"
type = number
default = null
}

variable "config" {
description = "Map of SeaweedFS configuration options"
type = map(string)
default = {}
}

# FIXME: Passing an empty constraints value to the Juju Terraform provider currently
# causes the operation to fail due to https://github.com/juju/terraform-provider-juju/issues/344
# Therefore, we set a default value of "arch=amd64" for all applications.

variable "constraints" {
description = "String listing constraints for the SeaweedFS application"
type = string
default = "arch=amd64"
}

variable "storage_directives" {
description = "Map of storage used by SeaweedFS, which defaults to 1 GB, allocated by Juju"
type = map(string)
default = {}
}

variable "units" {
description = "Number of SeaweedFS units"
type = number
default = 1
validation {
condition = var.units >= 1
error_message = "The number of units must be greater than or equal to 1."
}
}
9 changes: 9 additions & 0 deletions terraform/seaweedfs/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.7"
required_providers {
juju = {
source = "juju/juju"
version = "~> 0.19"
}
}
}
Loading