Skip to content

Commit

Permalink
Merge pull request #402 from hemanthnakkina/ubuntu-pro
Browse files Browse the repository at this point in the history
Deploy Ubuntu pro on machine model
  • Loading branch information
gboutry authored Jan 9, 2025
2 parents 491a0d0 + aeeef1e commit 6379629
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
8 changes: 2 additions & 6 deletions sunbeam-python/sunbeam/features/pro/etc/deploy-pro/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@ terraform {

provider "juju" {}

data "juju_model" "controller" {
name = "controller"
}

resource "juju_application" "ubuntu_pro" {
count = var.token != "" ? 1 : 0
name = "ubuntu-pro"
model = data.juju_model.controller.name
model = var.machine-model
units = 0

charm {
Expand All @@ -49,7 +45,7 @@ resource "juju_application" "ubuntu_pro" {

resource "juju_integration" "juju_info" {
count = var.token != "" ? 1 : 0
model = data.juju_model.controller.name
model = var.machine-model

application {
name = "sunbeam-machine"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ variable "ubuntu-advantage-channel" {
default = "latest/edge"
}

variable "machine-model" {
description = "Name of model to deploy ubuntu-pro into."
type = string
}

variable "token" {
description = "Ubuntu Pro token to use to attach support subscriptions"
type = string
Expand Down
2 changes: 1 addition & 1 deletion sunbeam-python/sunbeam/features/pro/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def is_skip(self, status: Status | None = None) -> Result:

def run(self, status: Status | None = None) -> Result:
"""Apply terraform configuration to deploy ubuntu-pro."""
extra_tfvars = {"token": self.token}
extra_tfvars = {"machine-model": self.model, "token": self.token}
try:
self.tfhelper.update_tfvars_and_apply_tf(
self.client,
Expand Down
2 changes: 1 addition & 1 deletion sunbeam-python/tests/unit/sunbeam/features/test_pro.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def test_enable(self):
self.client,
self.manifest,
tfvar_config=None,
override_tfvars={"token": self.token},
override_tfvars={"machine-model": self.model, "token": self.token},
)
self.jhelper.wait_application_ready.assert_called_once()
assert result.result_type == ResultType.COMPLETED
Expand Down

0 comments on commit 6379629

Please sign in to comment.