From 72b1a29ff77638a1c93a00f67aff643dc7ed3f9d Mon Sep 17 00:00:00 2001 From: Dainius Date: Mon, 18 Nov 2024 10:27:17 +0200 Subject: [PATCH] Improve docs and validation wording for `vcd_tm_org` resource (#1351) --- .changes/v4.0.0/1345-features.md | 2 +- .gitignore | 3 +++ GNUmakefile | 4 ++++ scripts/runtest.sh | 3 +++ vcd/resource_vcd_tm_org.go | 2 +- website/docs/r/tm_org.html.markdown | 3 ++- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.changes/v4.0.0/1345-features.md b/.changes/v4.0.0/1345-features.md index d1ce5218c..6cb9cec99 100644 --- a/.changes/v4.0.0/1345-features.md +++ b/.changes/v4.0.0/1345-features.md @@ -1,2 +1,2 @@ -* **New Resource:** `vcd_tm_org` to manage TM Organizations [GH-1345] +* **New Resource:** `vcd_tm_org` to manage TM Organizations [GH-1345, GH-1351] * **New Data Source:** `vcd_tm_org` to read TM Organizations [GH-1345] diff --git a/.gitignore b/.gitignore index 894c27906..c196a06ee 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ website/node_modules *.test *.iml +# Ignore test coverage files +*.cover + vcd/vcd_test_config*.json vcd/go-vcloud-director.log vcd/test-artifacts diff --git a/GNUmakefile b/GNUmakefile index 2598c4fd7..a10044514 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -139,6 +139,10 @@ testextnetwork: fmtcheck # Runs the acceptance test for tm testtm: fmtcheck @sh -c "'$(CURDIR)/scripts/runtest.sh' tm" +# Runs the acceptance test for tm with coverage +testtm-coverage: fmtcheck + @sh -c "'$(CURDIR)/scripts/runtest.sh' tm-coverage" + testtm-binary-prepare: install cd vcd && go test -tags tm -vcd-add-provider -vcd-short -v . diff --git a/scripts/runtest.sh b/scripts/runtest.sh index 7a7ca197c..2218a311e 100755 --- a/scripts/runtest.sh +++ b/scripts/runtest.sh @@ -406,6 +406,9 @@ case $wanted in tm) acceptance_test tm ;; + tm-coverage) + acceptance_test tm "-coverprofile=tm.cover" + ;; network) acceptance_test network ;; diff --git a/vcd/resource_vcd_tm_org.go b/vcd/resource_vcd_tm_org.go index 78850e58c..8200e1d8e 100644 --- a/vcd/resource_vcd_tm_org.go +++ b/vcd/resource_vcd_tm_org.go @@ -184,7 +184,7 @@ func validateRenameOrgDisabled(d *schema.ResourceData, oldCfg *govcd.TmOrg, newC if d.HasChange("name") && // this condition is a negative xor - it will be matched if Org is not transitioning from or to disabled state ((!newCfg.IsEnabled && !oldCfg.TmOrg.IsEnabled) || newCfg.IsEnabled && oldCfg.TmOrg.IsEnabled) { - return fmt.Errorf("%s must be disabled (is_enabled=false) to change name", labelTmOrg) + return fmt.Errorf("%s must be disabled (is_enabled=false) to change name because it changes tenant login URL", labelTmOrg) } return nil diff --git a/website/docs/r/tm_org.html.markdown b/website/docs/r/tm_org.html.markdown index 260d0afd0..96c6fc5e2 100644 --- a/website/docs/r/tm_org.html.markdown +++ b/website/docs/r/tm_org.html.markdown @@ -38,7 +38,8 @@ resource "vcd_tm_org" "test" { The following arguments are supported: * `name` - (Required) A name for Organization with which users log in to it as it will be used in - the URL + the URL. The Org must be disabled to or transition from previous disabled state + (`is_enabled=false`) to change a name because it changes tenant login URL * `display_name` - (Required) A human readable name for Organization * `description` - (Optional) An optional description for Organization * `is_enabled` - (Optional) Defines if Organization is enabled. Default `true`. **Note:**