-
Notifications
You must be signed in to change notification settings - Fork 0
chore(terraform): add terraform module (charmkeeper) #78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| name: Terraform modules tests | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| paths: | ||
| - 'terraform/**' | ||
|
|
||
| jobs: | ||
| terraform-tests: | ||
| uses: canonical/operator-workflows/.github/workflows/terraform_modules_test.yaml@main | ||
| secrets: inherit | ||
| with: | ||
| #k8s-controller: true | ||
| lxd-controller: true | ||
| terraform-directories: '["terraform"]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| rule "terraform_required_version" { | ||
| enabled = true | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # IRC Bridge Terraform Module | ||
|
|
||
| This Terraform module deploys the [irc-bridge](https://charmhub.io/irc-bridge) charm on a Juju model. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```hcl | ||
| module "irc-bridge" { | ||
| source = "git::https://github.com/canonical/irc-bridge-operator//terraform" | ||
| model_uuid = juju_model.my_model.uuid | ||
| } | ||
| ``` | ||
|
|
||
| ## Integrations | ||
|
|
||
| The irc-bridge charm requires the following integrations: | ||
|
|
||
| - `database`: PostgreSQL database (interface: `postgresql_client`) | ||
| - `matrix-auth`: Matrix authentication (interface: `matrix_auth`) | ||
| - `ingress`: Ingress for the bridge (interface: `ingress`) | ||
| - `ingress-media`: Ingress for media (interface: `ingress`) | ||
|
|
||
| ## Requirements | ||
|
|
||
| | Name | Version | | ||
| |------|---------| | ||
| | terraform | ~> 1.12 | | ||
| | juju | ~> 1.0 | | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Name | Description | Type | Default | Required | | ||
| |------|-------------|------|---------|----------| | ||
| | app\_name | Name of the application in the Juju model. | `string` | `"irc-bridge"` | no | | ||
| | base | The operating system on which to deploy. | `string` | `"ubuntu@22.04"` | no | | ||
| | channel | The channel to use when deploying a charm. | `string` | `"latest/stable"` | no | | ||
| | config | Application config. | `map(string)` | `{}` | no | | ||
| | constraints | Juju constraints to apply for this application. | `string` | `""` | no | | ||
| | model\_uuid | UUID of the Juju model where the application will be deployed. | `string` | n/a | yes | | ||
| | revision | Revision number of the charm. | `number` | `null` | no | | ||
| | units | Number of units to deploy. | `number` | `1` | no | | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Name | Description | | ||
| |------|-------------| | ||
| | app\_name | Name of the deployed application. | | ||
| | requires | Map of required relation endpoints. | | ||
| | provides | Map of provided relation endpoints. | | ||
| | endpoints | Map of all relation endpoints. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| resource "juju_application" "irc-bridge" { | ||
| name = var.app_name | ||
| model_uuid = var.model_uuid | ||
|
|
||
| charm { | ||
| name = "irc-bridge" | ||
| base = var.base | ||
| channel = var.channel | ||
| revision = var.revision | ||
| } | ||
|
|
||
| config = var.config | ||
| constraints = var.constraints | ||
| units = var.units | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| output "app_name" { | ||
| description = "Name of the deployed application." | ||
| value = juju_application.irc-bridge.name | ||
| } | ||
|
|
||
| output "requires" { | ||
| value = { | ||
| database = "database" | ||
| matrix_auth = "matrix-auth" | ||
| ingress = "ingress" | ||
| ingress_media = "ingress-media" | ||
| } | ||
| } | ||
|
|
||
| output "provides" { | ||
| value = {} | ||
| } | ||
|
|
||
| output "endpoints" { | ||
| value = { | ||
| database = "database" | ||
| matrix_auth = "matrix-auth" | ||
| ingress = "ingress" | ||
| ingress_media = "ingress-media" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| rule "terraform_required_version" { | ||
|
seb4stien marked this conversation as resolved.
|
||
| enabled = true | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| run "setup_tests" { | ||
| module { | ||
| source = "./tests/setup" | ||
| } | ||
| } | ||
|
|
||
| run "basic_deploy" { | ||
| variables { | ||
| model_uuid = run.setup_tests.model_uuid | ||
| channel = "latest/edge" | ||
| # renovate: depName="irc-bridge" | ||
| revision = 43 | ||
| } | ||
|
|
||
| assert { | ||
| condition = output.app_name == "irc-bridge" | ||
| error_message = "irc-bridge app_name did not match expected" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| terraform { | ||
| required_version = "~> 1.12" | ||
| required_providers { | ||
| juju = { | ||
| version = "~> 1.0" | ||
| source = "juju/juju" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "juju" {} | ||
|
|
||
| resource "juju_model" "test_model" { | ||
| name = "tf-testing-${formatdate("YYYYMMDDhhmmss", timestamp())}" | ||
| } | ||
|
|
||
| output "model_uuid" { | ||
| value = juju_model.test_model.uuid | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| variable "app_name" { | ||
| description = "Name of the application in the Juju model." | ||
| type = string | ||
| default = "irc-bridge" | ||
| } | ||
|
|
||
| variable "base" { | ||
| description = "The operating system on which to deploy." | ||
| type = string | ||
| default = "ubuntu@22.04" | ||
| } | ||
|
|
||
| variable "channel" { | ||
| description = "The channel to use when deploying a charm." | ||
| type = string | ||
| default = "latest/stable" | ||
| } | ||
|
|
||
| variable "config" { | ||
| description = "Application config. Details about available options can be found at https://charmhub.io/irc-bridge/configurations." | ||
| type = map(string) | ||
| default = {} | ||
| } | ||
|
|
||
| variable "constraints" { | ||
| description = "Juju constraints to apply for this application." | ||
| type = string | ||
| default = "" | ||
| } | ||
|
|
||
| variable "model_uuid" { | ||
| description = "UUID of the Juju model where the application will be deployed." | ||
| type = string | ||
| } | ||
|
|
||
| variable "revision" { | ||
| description = "Revision number of the charm." | ||
| type = number | ||
| default = null | ||
| } | ||
|
|
||
| variable "units" { | ||
| description = "Number of units to deploy." | ||
| type = number | ||
| default = 1 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # See LICENSE file for licensing details. | ||
|
|
||
| terraform { | ||
| required_version = "~> 1.12" | ||
| required_providers { | ||
| juju = { | ||
| source = "juju/juju" | ||
| version = "~> 1.0" | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.