From 246f1da25861766b0b42a020f3b40bff4bf20f32 Mon Sep 17 00:00:00 2001 From: "Jason C. Nucciarone" Date: Thu, 12 Sep 2024 15:23:11 -0400 Subject: [PATCH] feat: add tf module for slurmrestd Signed-off-by: Jason C. Nucciarone --- charms/slurmrestd/terraform/main.tf | 26 +++++++++++++ charms/slurmrestd/terraform/outputs.tf | 23 ++++++++++++ charms/slurmrestd/terraform/variables.tf | 47 ++++++++++++++++++++++++ charms/slurmrestd/terraform/versions.tf | 22 +++++++++++ 4 files changed, 118 insertions(+) create mode 100644 charms/slurmrestd/terraform/main.tf create mode 100644 charms/slurmrestd/terraform/outputs.tf create mode 100644 charms/slurmrestd/terraform/variables.tf create mode 100644 charms/slurmrestd/terraform/versions.tf diff --git a/charms/slurmrestd/terraform/main.tf b/charms/slurmrestd/terraform/main.tf new file mode 100644 index 0000000..8187af0 --- /dev/null +++ b/charms/slurmrestd/terraform/main.tf @@ -0,0 +1,26 @@ +# Copyright 2024 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +resource "juju_application" "slurmrestd" { + name = var.app_name + model = var.model_name + + charm { + name = "slurmrestd" + channel = var.channel + } + + config = var.config + units = var.units +} diff --git a/charms/slurmrestd/terraform/outputs.tf b/charms/slurmrestd/terraform/outputs.tf new file mode 100644 index 0000000..c41e125 --- /dev/null +++ b/charms/slurmrestd/terraform/outputs.tf @@ -0,0 +1,23 @@ +# Copyright 2024 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +output "app_name" { + value = juju_application.slurmrestd.name +} + +output "provides" { + value = { + slurmctld = "slurmctld" + } +} diff --git a/charms/slurmrestd/terraform/variables.tf b/charms/slurmrestd/terraform/variables.tf new file mode 100644 index 0000000..b06b4c1 --- /dev/null +++ b/charms/slurmrestd/terraform/variables.tf @@ -0,0 +1,47 @@ +# Copyright 2024 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +variable "app_name" { + description = "Name of the slurmrestd application within the Juju model" + type = string +} + +variable "channel" { + description = "Channel to deploy the slurmrestd charm from." + type = string + default = "latest/stable" +} + +variable "config" { + description = "Initial configuration for deployed slurmrestd charm." + type = map(string) + default = {} +} + +variable "model_name" { + description = "Name of model to deploy slurmrestd charm to." + type = string +} + +variable "revision" { + description = "Revision of the slurmrestd charm to deploy." + type = number + default = null +} + +variable "units" { + description = "Number of slurmrestd units to deploy." + type = number + default = 1 +} diff --git a/charms/slurmrestd/terraform/versions.tf b/charms/slurmrestd/terraform/versions.tf new file mode 100644 index 0000000..cc63922 --- /dev/null +++ b/charms/slurmrestd/terraform/versions.tf @@ -0,0 +1,22 @@ +# Copyright 2024 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +terraform { + required_providers { + juju = { + source = "juju/juju" + version = ">= 0.13.0" + } + } +}