diff --git a/solutions/project/main.tf b/solutions/project/main.tf index 624621a..cc4e1e2 100644 --- a/solutions/project/main.tf +++ b/solutions/project/main.tf @@ -91,6 +91,7 @@ module "build" { resource "terraform_data" "run_build" { depends_on = [module.build] + count = length(local.updated_builds) > 0 ? 1 : 0 provisioner "local-exec" { interpreter = ["/bin/bash", "-c"] diff --git a/tests/pr_test.go b/tests/pr_test.go index d4403a0..509a03b 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -190,9 +190,10 @@ func TestUpgradeCEProjectDA(t *testing.T) { t.Parallel() options := testhelper.TestOptionsDefault(&testhelper.TestOptions{ - Testing: t, - TerraformDir: projectSolutionsDir, - Prefix: "ce-da", + Testing: t, + TerraformDir: projectSolutionsDir, + Prefix: "ce-da", + CheckApplyResultForUpgrade: true, }) options.TerraformVars = map[string]interface{}{ @@ -365,3 +366,25 @@ func writeTfvarsFile(t *testing.T, path string, vars map[string]interface{}) err } return err } + +// test edge case when only empty project is created +func TestCEProjectDABasic(t *testing.T) { + t.Parallel() + + options := testhelper.TestOptionsDefault(&testhelper.TestOptions{ + Testing: t, + TerraformDir: projectSolutionsDir, + Prefix: "ce-da-empty", + }) + + options.TerraformVars = map[string]interface{}{ + "existing_resource_group_name": resourceGroup, + "provider_visibility": "public", + "prefix": options.Prefix, + "project_name": "proj-test", + } + + output, err := options.RunTestConsistency() + assert.Nil(t, err, "This should not have errored") + assert.NotNil(t, output, "Expected some output") +}