|
4 | 4 | package tfe
|
5 | 5 |
|
6 | 6 | import (
|
| 7 | + "context" |
7 | 8 | "fmt"
|
8 | 9 | "math/rand"
|
9 | 10 | "regexp"
|
@@ -48,6 +49,27 @@ func TestAccTFEAdminOrganizationSettings_basic(t *testing.T) {
|
48 | 49 | Config: testConfigTFEAdminOrganizationSettings_conflict(rInt1, rInt2),
|
49 | 50 | ExpectError: regexp.MustCompile(`global_module_sharing cannot be true if module_sharing_consumer_organizations are set`),
|
50 | 51 | },
|
| 52 | + { |
| 53 | + PreConfig: deleteOrganization(fmt.Sprintf("tst-terraform-%d", rInt1)), |
| 54 | + Config: testConfigTFEAdminOrganizationSettings_basic(rInt1, rInt2, rInt3), |
| 55 | + Check: resource.ComposeAggregateTestCheckFunc( |
| 56 | + // organization attribute */ |
| 57 | + resource.TestCheckResourceAttr( |
| 58 | + "tfe_admin_organization_settings.settings", "organization", fmt.Sprintf("tst-terraform-%d", rInt1)), |
| 59 | + resource.TestCheckResourceAttr( |
| 60 | + "tfe_admin_organization_settings.settings", "global_module_sharing", "false"), |
| 61 | + resource.TestCheckResourceAttr( |
| 62 | + "tfe_admin_organization_settings.settings", "access_beta_tools", "true"), |
| 63 | + |
| 64 | + // module_consumers attribute |
| 65 | + resource.TestCheckResourceAttr( |
| 66 | + "tfe_admin_organization_settings.settings", "module_sharing_consumer_organizations.#", "2"), |
| 67 | + resource.TestCheckResourceAttrSet( |
| 68 | + "tfe_admin_organization_settings.settings", "module_sharing_consumer_organizations.0"), |
| 69 | + resource.TestCheckResourceAttrSet( |
| 70 | + "tfe_admin_organization_settings.settings", "module_sharing_consumer_organizations.1"), |
| 71 | + ), |
| 72 | + }, |
51 | 73 | },
|
52 | 74 | })
|
53 | 75 | }
|
@@ -96,3 +118,10 @@ resource "tfe_admin_organization_settings" "settings" {
|
96 | 118 | module_sharing_consumer_organizations = [tfe_organization.foo.id]
|
97 | 119 | }`, rInt1, rInt2)
|
98 | 120 | }
|
| 121 | + |
| 122 | +func deleteOrganization(name string) func() { |
| 123 | + return func() { |
| 124 | + client := testAccProvider.Meta().(ConfiguredClient).Client |
| 125 | + client.Organizations.Delete(context.Background(), name) |
| 126 | + } |
| 127 | +} |
0 commit comments