Skip to content
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

feat(all): add base and constraints config options to charm tf modules #61

Merged
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ version
_build
.charmhub.secret
cover
.terraform
.terraform.lock.hcl
*.tfstate*
50 changes: 50 additions & 0 deletions charms/sackd/terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Terraform module for sackd

This is a Terraform module facilitating the deployment of the sackd charm using
the [Juju Terraform provider](https://github.com/juju/terraform-provider-juju).
For more information, refer to the
[documentation](https://registry.terraform.io/providers/juju/juju/latest/docs)
for the Juju Terraform provider.

## Requirements

This module requires a Juju model to be available. Refer to the [usage](#usage)
section for more details.

## API

### Inputs

This module offers the following configurable units:

| Name | Type | Description | Default | Required |
|---------------|-------------|----------------------------------------------------------|--------------|:--------:|
| `app_name` | string | Application name | sackd | |
| `base` | string | Base version to use for deployed machine | ubuntu@24.04 | |
| `channel` | string | Channel that charm is deployed from | latest/edge | |
| `config` | map(string) | Map of charm configuration options to pass at deployment | {} | |
| `constraints` | string | Constraints for the charm deployment | "arch=amd64" | |
| `model_name` | string | Name of the model to deploy the charm to | | Y |
| `revision` | number | Revision number of charm to deploy | null | |
| `units` | number | Number of units to deploy | 1 | |

### Outputs

After applying, the module exports the following outputs:

| Name | Description |
|------------|-----------------------------|
| `app_name` | Application name |
| `provides` | Map of `provides` endpoints |

## Usage

Users should ensure that Terraform is aware of the Juju model dependency of the
charm module.

To deploy this module with its required dependency, you can run
the following command:

```shell
terraform apply -var="model_name=<MODEL_NAME>" -auto-approve
```
8 changes: 5 additions & 3 deletions charms/sackd/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2024-2025 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,10 +18,12 @@ resource "juju_application" "sackd" {

charm {
name = "sackd"
base = var.base
channel = var.channel
revision = var.revision
}

config = var.config
units = var.units
config = var.config
constraints = var.constraints
units = var.units
}
28 changes: 21 additions & 7 deletions charms/sackd/terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2024-2025 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,35 +13,49 @@
# limitations under the License.

variable "app_name" {
description = "Name of the sackd application within the Juju model."
description = "Application name"
type = string
default = "sackd"
}

variable "base" {
description = "Charm base"
type = string
default = "ubuntu@24.04"
}

variable "channel" {
description = "Channel to deploy the sackd charm from."
description = "Charm channel"
type = string
default = "latest/edge"
}

variable "config" {
description = "Initial configuration for deployed sackd charm."
description = "Charm configuration"
type = map(string)
default = {}
}

variable "constraints" {
description = "Deployment constraints"
type = string
default = "arch=amd64"
}

variable "model_name" {
description = "Name of model to deploy sackd charm to."
description = "Model name"
type = string
}

variable "revision" {
description = "Revision of the sackd charm to deploy."
description = "Charm revision"
type = number
nullable = true
default = null
}

variable "units" {
description = "Number of sackd units to deploy."
description = "Number of units"
type = number
default = 1
}
50 changes: 50 additions & 0 deletions charms/slurmctld/terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Terraform module for slurmctld

This is a Terraform module facilitating the deployment of the slurmctld charm using
the [Juju Terraform provider](https://github.com/juju/terraform-provider-juju).
For more information, refer to the
[documentation](https://registry.terraform.io/providers/juju/juju/latest/docs)
for the Juju Terraform provider.

## Requirements

This module requires a Juju model to be available. Refer to the [usage](#usage)
section for more details.

## API

### Inputs

This module offers the following configurable units:

| Name | Type | Description | Default | Required |
|---------------|-------------|----------------------------------------------------------|--------------|:--------:|
| `app_name` | string | Application name | slurmctld | |
| `base` | string | Base version to use for deployed machine | ubuntu@24.04 | |
| `channel` | string | Channel that charm is deployed from | latest/edge | |
| `config` | map(string) | Map of charm configuration options to pass at deployment | {} | |
| `constraints` | string | Constraints for the charm deployment | "arch=amd64" | |
| `model_name` | string | Name of the model to deploy the charm to | | Y |
| `revision` | number | Revision number of charm to deploy | null | |
| `units` | number | Number of units to deploy | 1 | |

### Outputs

After applying, the module exports the following outputs:

| Name | Description |
|------------|-----------------------------|
| `app_name` | Application name |
| `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 required dependency, you can run
the following command:

```shell
terraform apply -var="model_name=<MODEL_NAME>" -auto-approve
```
8 changes: 5 additions & 3 deletions charms/slurmctld/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2024-2025 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,10 +18,12 @@ resource "juju_application" "slurmctld" {

charm {
name = "slurmctld"
base = var.base
channel = var.channel
revision = var.revision
}

config = var.config
units = var.units
config = var.config
constraints = var.constraints
units = var.units
}
28 changes: 21 additions & 7 deletions charms/slurmctld/terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2024-2025 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,35 +13,49 @@
# limitations under the License.

variable "app_name" {
description = "Name of the slurmctld application within the Juju model."
description = "Application name"
type = string
default = "slurmctld"
}

variable "base" {
description = "Charm base"
type = string
default = "ubuntu@24.04"
}

variable "channel" {
description = "Channel to deploy the slurmctld charm from."
description = "Charm channel"
type = string
default = "latest/edge"
}

variable "config" {
description = "Initial configuration for deployed slurmctld charm."
description = "Charm configuration"
type = map(string)
default = {}
}

variable "constraints" {
description = "Deployment constraints"
type = string
default = "arch=amd64"
}

variable "model_name" {
description = "Name of model to deploy slurmctld charm to."
description = "Model name"
type = string
}

variable "revision" {
description = "Revision of the slurmctld charm to deploy."
description = "Charm revision"
type = number
nullable = true
default = null
}

variable "units" {
description = "Number of slurmctld units to deploy."
description = "Number of units"
type = number
default = 1
}
50 changes: 50 additions & 0 deletions charms/slurmd/terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Terraform module for slurmd

This is a Terraform module facilitating the deployment of the slurmd charm using
the [Juju Terraform provider](https://github.com/juju/terraform-provider-juju).
For more information, refer to the
[documentation](https://registry.terraform.io/providers/juju/juju/latest/docs)
for the Juju Terraform provider.

## Requirements

This module requires a Juju model to be available. Refer to the [usage](#usage)
section for more details.

## API

### Inputs

This module offers the following configurable units:

| Name | Type | Description | Default | Required |
|---------------|-------------|----------------------------------------------------------|--------------|:--------:|
| `app_name` | string | Application name | slurmd | |
| `base` | string | Base version to use for deployed machine | ubuntu@24.04 | |
| `channel` | string | Channel that charm is deployed from | latest/edge | |
| `config` | map(string) | Map of charm configuration options to pass at deployment | {} | |
| `constraints` | string | Constraints for the charm deployment | "arch=amd64" | |
| `model_name` | string | Name of the model to deploy the charm to | | Y |
| `revision` | number | Revision number of charm to deploy | null | |
| `units` | number | Number of units to deploy | 1 | |

### Outputs

After applying, the module exports the following outputs:

| Name | Description |
|------------|-----------------------------|
| `app_name` | Application name |
| `provides` | Map of `provides` endpoints |

## Usage

Users should ensure that Terraform is aware of the Juju model dependency of the
charm module.

To deploy this module with its required dependency, you can run
the following command:

```shell
terraform apply -var="model_name=<MODEL_NAME>" -auto-approve
```
8 changes: 5 additions & 3 deletions charms/slurmd/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Canonical Ltd.
# Copyright 2024-2025 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,10 +18,12 @@ resource "juju_application" "slurmd" {

charm {
name = "slurmd"
base = var.base
channel = var.channel
revision = var.revision
}

config = var.config
units = var.units
config = var.config
constraints = var.constraints
units = var.units
}
Loading