Skip to content

Commit

Permalink
DPE-5627 CC006 compliance (#737)
Browse files Browse the repository at this point in the history
* tf module on charm

* default arch constraint
  • Loading branch information
paulomach authored Oct 15, 2024
1 parent 30af27d commit cbbe97c
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
21 changes: 21 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "juju_application" "k8s_postgresql" {
name = var.app_name
model = var.juju_model_name
trust = true

charm {
name = "postgresql-k8s"
channel = var.channel
revision = var.revision
base = var.base
}

storage_directives = {
pgdata = var.storage_size
}

units = var.units
constraints = var.constraints
config = var.config
resources = var.resources
}
20 changes: 20 additions & 0 deletions terraform/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
output "application_name" {
value = juju_application.k8s_postgresql.name
}


output "provides" {
value = {
database = "database",
metrics_endpoint = "metrics-endpoint",
grafana_dashboard = "grafana-dashboard"
}
}

output "requires" {
value = {
logging = "logging"
certificates = "certificates"
s3_parameters = "s3-parameters"
}
}
58 changes: 58 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
variable "juju_model_name" {
description = "Juju model name"
type = string
}

variable "app_name" {
description = "Name of the application in the Juju model."
type = string
default = "postgresql-k8s"
}

variable "channel" {
description = "Charm channel to use when deploying"
type = string
default = "14/stable"
}

variable "revision" {
description = "Revision number to deploy charm"
type = number
default = null
}

variable "base" {
description = "Application base"
type = string
default = "[email protected]"
}

variable "units" {
description = "Number of units to deploy"
type = number
default = 1
}

variable "constraints" {
description = "Juju constraints to apply for this application."
type = string
default = "arch=amd64"
}

variable "storage_size" {
description = "Storage size"
type = string
default = "10G"
}

variable "config" {
description = "Application configuration. Details at https://charmhub.io/postgresql-k8s/configurations"
type = map(string)
default = {}
}

variable "resources" {
description = "Resources to use with the application"
type = map(string)
default = {}
}
9 changes: 9 additions & 0 deletions terraform/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.6.6"
required_providers {
juju = {
source = "juju/juju"
version = ">= 0.14.0"
}
}
}

0 comments on commit cbbe97c

Please sign in to comment.