-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add terraform module * improve README * add terraform ignores to .gitignore * update libs * Revert "update libs" This reverts commit 03ff3b8. * avoid checking tester charms --------- Co-authored-by: Jose C. Massón <[email protected]> Co-authored-by: Jose C. Massón <[email protected]>
- Loading branch information
1 parent
5639217
commit 1bb705e
Showing
7 changed files
with
136 additions
and
1 deletion.
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
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,38 @@ | ||
# Terraform module for grafana-agent | ||
|
||
|
||
This is a Terraform module facilitating the deployment of grafana-agent-k8s charm, using the [Terraform juju provider](https://github.com/juju/terraform-provider-juju/). For more information, refer to the provider [documentation](https://registry.terraform.io/providers/juju/juju/latest/docs). | ||
|
||
|
||
## Requirements | ||
This module requires a `juju` model to be available. Refer to the [usage section](#usage) below for more details. | ||
|
||
## API | ||
|
||
### Inputs | ||
The module offers the following configurable inputs: | ||
|
||
| Name | Type | Description | Required | | ||
| - | - | - | - | | ||
| `app_name`| string | Application name | mimir-worker | | ||
| `channel`| string | Channel that the charm is deployed from | latest/edge | | ||
| `config`| map(any) | Map of the charm configuration options | {} | | ||
| `constraints`| string | Constraints for the Juju deployment| "" | | ||
| `model_name`| string | Name of the model that the charm is deployed on | | | ||
| `revision`| number | Revision number of the charm name | null | | ||
| `units`| number | Number of units to deploy | 1 | | ||
|
||
### Outputs | ||
Upon applied, the module exports the following outputs: | ||
|
||
| Name | Description | | ||
| - | - | | ||
| `app_name`| Application name | | ||
| `provides`| Map of `provides` endpoints | | ||
| `requires`| Map of `requires` endpoints | | ||
|
||
## Usage | ||
|
||
Users should ensure that Terraform is aware of the `juju_model` dependency of the charm module. | ||
|
||
To deploy this module with its needed dependency, you can run `terraform apply -var="model_name=<MODEL_NAME>" -auto-approve` |
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,12 @@ | ||
resource "juju_application" "grafana_agent" { | ||
name = var.app_name | ||
model = var.model_name | ||
trust = true | ||
charm { | ||
name = "grafana-agent-k8s" | ||
channel = var.channel | ||
revision = var.revision | ||
} | ||
units = var.units | ||
config = var.config | ||
} |
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,24 @@ | ||
output "app_name" { | ||
value = juju_application.grafana_agent.name | ||
} | ||
|
||
output "requires" { | ||
value = { | ||
certificates = "certificates", | ||
send_remote_write = "send-remote-write", | ||
metrics_endpoint = "metrics-endpoint", | ||
logging_consumer = "logging-consumer", | ||
grafana_dashboards_consumer = "grafana-dashboards-consumer", | ||
grafana_cloud_config = "grafana-cloud-config", | ||
receive_ca_cert = "receive-ca-cert", | ||
tracing = "tracing", | ||
} | ||
} | ||
|
||
output "provides" { | ||
value = { | ||
tracing_provider = "tracing-provider", | ||
logging_provider = "logging-provider", | ||
grafana_dashboards_provider = "grafana-dashboards-provider", | ||
} | ||
} |
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,42 @@ | ||
variable "app_name" { | ||
description = "Application name" | ||
type = string | ||
} | ||
|
||
variable "channel" { | ||
description = "Charm channel" | ||
type = string | ||
default = "latest/stable" | ||
} | ||
|
||
variable "config" { | ||
description = "Config options as in the ones we pass in juju config" | ||
type = map(string) | ||
default = {} | ||
} | ||
|
||
# We use constraints to set AntiAffinity in K8s | ||
# https://discourse.charmhub.io/t/pod-priority-and-affinity-in-juju-charms/4091/13?u=jose | ||
variable "constraints" { | ||
description = "Constraints to be applied" | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "model_name" { | ||
description = "Model name" | ||
type = string | ||
} | ||
|
||
variable "revision" { | ||
description = "Charm revision" | ||
type = number | ||
nullable = true | ||
default = null | ||
} | ||
|
||
variable "units" { | ||
description = "Number of units" | ||
type = number | ||
default = 1 | ||
} |
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,9 @@ | ||
terraform { | ||
required_version = ">= 1.5" | ||
required_providers { | ||
juju = { | ||
source = "juju/juju" | ||
version = "~> 0.14" | ||
} | ||
} | ||
} |