-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '6/edge' into tls_fixes
- Loading branch information
Showing
11 changed files
with
395 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -16,16 +16,7 @@ on: | |
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install tox | ||
# TODO: Consider replacing with custom image on self-hosted runner OR pinning version | ||
run: python3 -m pip install tox | ||
- name: Run linters | ||
run: tox run -e lint | ||
uses: canonical/data-platform-workflows/.github/workflows/[email protected] | ||
|
||
unit-test: | ||
name: Unit tests | ||
|
@@ -39,6 +30,7 @@ jobs: | |
run: python3 -m pip install tox | ||
- name: Run tests | ||
run: tox run -e unit | ||
|
||
lib-check: | ||
name: Check libraries | ||
runs-on: ubuntu-latest | ||
|
@@ -54,6 +46,36 @@ jobs: | |
credentials: "${{ secrets.CHARMHUB_TOKEN }}" # FIXME: current token will expire in 2023-07-04 | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
check-terraform: | ||
name: Check Terraform | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./terraform | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v3 | ||
|
||
- name: Initialize Terraform Module | ||
run: terraform init | ||
|
||
- name: Validate Terraform Module | ||
run: terraform validate -no-color | ||
|
||
- name: Validate terraform fmt | ||
run: | | ||
set +e | ||
terraform fmt -recursive -check -diff | ||
FMT_STATUS="$?" | ||
if [[ "$FMT_STATUS" -ne 0 ]]; then | ||
echo "❌ terraform fmt failed" >> "$GITHUB_STEP_SUMMARY" | ||
fi | ||
exit "$FMT_STATUS" | ||
build: | ||
strategy: | ||
matrix: | ||
|
This file contains 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 |
---|---|---|
@@ -1,8 +1,54 @@ | ||
venv/ | ||
build/ | ||
*.charm | ||
.tox/ | ||
*.idea | ||
.vscode/ | ||
.coverage | ||
.tox/ | ||
venv/ | ||
build/ | ||
|
||
# Python | ||
**/venv/** | ||
*.pyc | ||
.python-version | ||
.mypy_cache/ | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# Charmcraft | ||
*.charm | ||
|
||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
crash.*.log | ||
|
||
# Exclude all .tfvars files, which are likely to contain sensitive data, such as | ||
# password, private keys, and other secrets. These should not be part of version | ||
# control as they are data points which are potentially sensitive and subject | ||
# to change depending on the environment. | ||
*.tfvars | ||
*.tfvars.json | ||
|
||
# Ignore override files as they are usually used to override resources locally and so | ||
# are not checked in | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
|
||
# Include override files you do wish to add to version control using negated pattern | ||
# !example_override.tf | ||
|
||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan | ||
# example: *tfplan* | ||
|
||
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc | ||
.terraform.lock.hcl | ||
|
This file contains 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 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 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 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,58 @@ | ||
# MongoDB Operator Terraform module | ||
|
||
This folder contains a base [Terraform][Terraform] module for the `mongodb` charm. | ||
|
||
The module uses the [Terraform Juju provider][Terraform Juju provider] to model the charm deployment onto any Kubernetes environment managed by [Juju][Juju]. | ||
|
||
The base module is not intended to be deployed in separation (it is possible though), but should rather serve as a building block for higher level modules. | ||
|
||
## Module structure | ||
|
||
- **main.tf** - Defines the Juju application to be deployed. | ||
- **variables.tf** - Allows customization of the deployment such as Juju model name, channel or application name and charm configuration. | ||
- **output.tf** - Responsible for integrating the module with other Terraform modules, primarily by defining potential integration endpoints (charm integrations), but also by exposing the application name. | ||
- **terraform.tf** - Defines the Terraform provider. | ||
|
||
## Using mongodb base module in higher level modules | ||
|
||
If you want to use `mongodb-operator` base module as part of your Terraform module, import it like shown below. | ||
|
||
```text | ||
module "mongodb-operator" { | ||
source = "git::https://github.com/canonical/mongodb-operator.git/terraform" | ||
model_name = "juju_model_name" | ||
(Customize configuration variables here if needed) | ||
} | ||
``` | ||
|
||
Please see the link to customize the Grafana configuration variables if needed. | ||
|
||
- [MongoDB configuration options][MongoDB configuration options] | ||
|
||
Create the integrations, for instance: | ||
|
||
```text | ||
resource "juju_integration" "amf-db" { | ||
model = var.model_name | ||
application { | ||
name = module.amf.app_name | ||
endpoint = module.amf.database_endpoint | ||
} | ||
application { | ||
name = module.mongodb.app_name | ||
endpoint = module.mongodb.database_endpoint | ||
} | ||
} | ||
``` | ||
|
||
Please check the available [integration pairs][integration pairs]. | ||
|
||
[Terraform]: https://www.terraform.io/ | ||
[Juju]: https://juju.is | ||
[Terraform Juju provider]: https://registry.terraform.io/providers/juju/juju/latest | ||
[MongoDB configuration options]: https://charmhub.io/mongodb/configure?channel=6/edge | ||
[integration pairs]: https://charmhub.io/mongodb/integrations?channel=6/edge |
This file contains 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,16 @@ | ||
# Copyright 2024 Canonical Ltd. | ||
# See LICENSE file for licensing details. | ||
|
||
resource "juju_application" "mongodb" { | ||
name = var.app_name | ||
model = var.model_name | ||
|
||
charm { | ||
name = "mongodb" | ||
channel = var.channel | ||
base = "[email protected]" | ||
} | ||
config = var.config | ||
units = 1 | ||
trust = true | ||
} |
Oops, something went wrong.