From 3616a5e0ac28e35576dba0ce902ef95826355b3d Mon Sep 17 00:00:00 2001 From: Ryan Ahearn Date: Mon, 17 Jun 2024 22:39:23 -0400 Subject: [PATCH] Add test to verify service instance name matches supplied name value --- s3/tests/creation.tftest.hcl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/s3/tests/creation.tftest.hcl b/s3/tests/creation.tftest.hcl index 3cc8dc0..6a4b516 100644 --- a/s3/tests/creation.tftest.hcl +++ b/s3/tests/creation.tftest.hcl @@ -10,7 +10,7 @@ variables { name = "terraform-cloudgov-s3-test" } -run "test_creation" { +run "test_bucket_creation" { assert { condition = can(regex("^\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}$", output.bucket_id)) error_message = "Bucket ID should be a GUID" @@ -22,7 +22,12 @@ run "test_creation" { } assert { - condition = cloudfoundry_service_instance.bucket.service_plan == data.cloudfoundry_service.s3.service_plans["basic-sandbox"] - error_message = "Service Plan should be 'basic-sandbox'" + condition = cloudfoundry_service_instance.bucket.service_plan == data.cloudfoundry_service.s3.service_plans[var.s3_plan_name] + error_message = "Service Plan should match the s3_plan_name variable" + } + + assert { + condition = cloudfoundry_service_instance.bucket.name == var.name + error_message = "Service instance name should match the name variable" } }