Skip to content

Commit

Permalink
ci: #REMOVEME main.tf test module
Browse files Browse the repository at this point in the history
  • Loading branch information
shipperizer committed Nov 15, 2024
1 parent cba4340 commit 61af9f7
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions hack/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
terraform {
required_providers {
juju = {
source = "juju/juju"
version = "> 0.14.0"
}
}

required_version = ">= 1.5.0"
}

variable "model" {
type = string
}
variable "name" {
type = string
}
variable "hydra_enabled" {
type = bool
}
variable "psql_enabled" {
type = bool
}


### HYDRA dependent ###
data "juju_application" "hydra" {
count = var.hydra_enabled ? 1 : 0

model = var.model
name = var.name
}


resource "juju_offer" "oauth_offer" {
count = var.hydra_enabled ? 1 : 0

name = "oauth-offer"
model = data.juju_application.hydra[0].model
application_name = data.juju_application.hydra[0].name
endpoint = "oauth"
}

resource "juju_integration" "hydra_database" {
count = var.hydra_enabled && var.psql_enabled ? 1 : 0

model = data.juju_application.hydra[0].model

application {
name = juju_application.postgresql[0].name
endpoint = "database"
}

application {
name = data.juju_application.hydra[0].name
endpoint = "pg-database"
}
}


########################

resource "juju_application" "postgresql" {
count = var.psql_enabled ? 1 : 0

model = var.model
trust = true

charm {
name = "postgresql-k8s"
channel = "14/stable"
base = "[email protected]"
}

config = {
plugin_pg_trgm_enable = true
plugin_uuid_ossp_enable = true
plugin_btree_gin_enable = true
}
}

0 comments on commit 61af9f7

Please sign in to comment.