Skip to content

Commit

Permalink
fixup! 561c229
Browse files Browse the repository at this point in the history
  • Loading branch information
shipperizer committed Nov 5, 2024
1 parent 561c229 commit 7028348
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions hack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,66 @@ variable "model" {
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.model
application_name = data.juju_application.hydra.name
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 7028348

Please sign in to comment.