From ca69a5405fb93cb12bf9edabff24063e05e79c98 Mon Sep 17 00:00:00 2001 From: Michael Thamm Date: Fri, 17 Apr 2026 17:57:00 -0400 Subject: [PATCH] fix: Remove the TF channel input validation --- .../tests/channel_validation.tftest.hcl | 38 ----------------- terraform/cos-lite/variables.tf | 6 --- .../cos/tests/channel_validation.tftest.hcl | 41 ------------------- terraform/cos/variables.tf | 6 --- 4 files changed, 91 deletions(-) delete mode 100644 terraform/cos-lite/tests/channel_validation.tftest.hcl delete mode 100644 terraform/cos/tests/channel_validation.tftest.hcl diff --git a/terraform/cos-lite/tests/channel_validation.tftest.hcl b/terraform/cos-lite/tests/channel_validation.tftest.hcl deleted file mode 100644 index 5f38c6a9..00000000 --- a/terraform/cos-lite/tests/channel_validation.tftest.hcl +++ /dev/null @@ -1,38 +0,0 @@ -mock_provider "juju" {} - -variables { - model_uuid = "00000000-0000-0000-0000-000000000000" -} - -# ---Happy path--- - -run "valid_channel_stable" { - command = plan - variables { channel = "dev/stable" } -} - -run "valid_channel_candidate" { - command = plan - variables { channel = "dev/candidate" } -} - -run "valid_channel_beta" { - command = plan - variables { channel = "dev/beta" } -} - -run "valid_channel_edge" { - command = plan - variables { channel = "dev/edge" } -} - -# ---Failure path--- -# NOTE: Invalid risks (e.g. "dev/risk") are validated by the Juju provider at the -# resource level inside child modules. Terraform test's expect_failures cannot -# reference resources inside child modules, so we cannot assert on that here. - -run "invalid_channel_track_2" { - command = plan - variables { channel = "2/stable" } - expect_failures = [var.channel] -} diff --git a/terraform/cos-lite/variables.tf b/terraform/cos-lite/variables.tf index 0a2ffaef..5421f6c6 100644 --- a/terraform/cos-lite/variables.tf +++ b/terraform/cos-lite/variables.tf @@ -14,12 +14,6 @@ variable "channel" { description = "Channel that the applications are (unless overwritten by individual channels) deployed from" type = string default = "dev/edge" - - validation { - # the TF Juju provider correctly identifies invalid risks; no need to validate it - condition = startswith(var.channel, "dev/") - error_message = "The track of the channel must be 'dev/'. e.g. 'dev/edge'." - } } variable "model_uuid" { diff --git a/terraform/cos/tests/channel_validation.tftest.hcl b/terraform/cos/tests/channel_validation.tftest.hcl deleted file mode 100644 index c2fdf469..00000000 --- a/terraform/cos/tests/channel_validation.tftest.hcl +++ /dev/null @@ -1,41 +0,0 @@ -mock_provider "juju" {} - -variables { - model_uuid = "00000000-0000-0000-0000-000000000000" - s3_endpoint = "foo" - s3_access_key = "foo" - s3_secret_key = "foo" -} - -# ---Happy path--- - -run "valid_channel_stable" { - command = plan - variables { channel = "dev/stable" } -} - -run "valid_channel_candidate" { - command = plan - variables { channel = "dev/candidate" } -} - -run "valid_channel_beta" { - command = plan - variables { channel = "dev/beta" } -} - -run "valid_channel_edge" { - command = plan - variables { channel = "dev/edge" } -} - -# ---Failure path--- -# NOTE: Invalid risks (e.g. "dev/risk") are validated by the Juju provider at the -# resource level inside child modules. Terraform test's expect_failures cannot -# reference resources inside child modules, so we cannot assert on that here. - -run "invalid_channel_track_2" { - command = plan - variables { channel = "2/stable" } - expect_failures = [var.channel] -} diff --git a/terraform/cos/variables.tf b/terraform/cos/variables.tf index 4a2057ef..2c45184d 100644 --- a/terraform/cos/variables.tf +++ b/terraform/cos/variables.tf @@ -14,12 +14,6 @@ variable "channel" { description = "Channel that the applications are (unless overwritten by individual channels) deployed from" type = string default = "dev/edge" - - validation { - # the TF Juju provider correctly identifies invalid risks; no need to validate it - condition = startswith(var.channel, "dev/") - error_message = "The track of the channel must be 'dev/'. e.g. 'dev/edge'." - } } variable "model_uuid" {