@@ -1770,16 +1770,9 @@ resource "tfe_registry_module" "foobar" {
1770
1770
func TestAccTFERegistryModule_agentExecutionModeWithAgentPool (t * testing.T ) {
1771
1771
skipIfEnterprise (t )
1772
1772
1773
- tfeClient , err := getClientUsingEnv ()
1774
- if err != nil {
1775
- t .Fatal (err )
1776
- }
1777
-
1778
- org , orgCleanup := createBusinessOrganization (t , tfeClient )
1779
- t .Cleanup (orgCleanup )
1780
-
1781
1773
registryModule := & tfe.RegistryModule {}
1782
1774
rInt := rand .New (rand .NewSource (time .Now ().UnixNano ())).Int ()
1775
+ orgName := fmt .Sprintf ("tst-terraform-%d" , rInt )
1783
1776
1784
1777
resource .Test (t , resource.TestCase {
1785
1778
PreCheck : func () {
@@ -1789,16 +1782,16 @@ func TestAccTFERegistryModule_agentExecutionModeWithAgentPool(t *testing.T) {
1789
1782
CheckDestroy : testAccCheckTFERegistryModuleDestroy ,
1790
1783
Steps : []resource.TestStep {
1791
1784
{
1792
- Config : testAccTFERegistryModule_agentExecutionModeWithAgentPool (org . Name , rInt ),
1785
+ Config : testAccTFERegistryModule_agentExecutionModeWithAgentPool (orgName , rInt ),
1793
1786
Check : resource .ComposeTestCheckFunc (
1794
1787
testAccCheckTFERegistryModuleExists (
1795
1788
"tfe_registry_module.foobar" ,
1796
1789
tfe.RegistryModuleID {
1797
- Organization : org . Name ,
1790
+ Organization : orgName ,
1798
1791
Name : getRegistryModuleName (),
1799
1792
Provider : getRegistryModuleProvider (),
1800
1793
RegistryName : tfe .PrivateRegistry ,
1801
- Namespace : org . Name ,
1794
+ Namespace : orgName ,
1802
1795
},
1803
1796
registryModule ,
1804
1797
),
@@ -1939,18 +1932,31 @@ resource "tfe_registry_module" "foobar" {
1939
1932
1940
1933
func testAccTFERegistryModule_agentExecutionModeWithAgentPool (organization string , rInt int ) string {
1941
1934
return fmt .Sprintf (`
1935
+ resource "tfe_organization" "foobar" {
1936
+ name = "%s"
1937
+
1938
+ }
1939
+
1940
+ resource "tfe_oauth_client" "foobar" {
1941
+ organization = tfe_organization.foobar.name
1942
+ api_url = "https://api.github.com"
1943
+ http_url = "https://github.com"
1944
+ oauth_token = "%s"
1945
+ service_provider = "github"
1946
+ }
1947
+
1942
1948
resource "tfe_agent_pool" "foobar" {
1943
1949
name = "agent-pool-test-%d"
1944
- organization = "%s"
1950
+ organization = tfe_organization.foobar.name
1945
1951
}
1946
1952
1947
1953
resource "tfe_registry_module" "foobar" {
1948
- organization = "%s"
1954
+ organization = tfe_organization.foobar.name
1949
1955
1950
1956
vcs_repo {
1951
1957
display_identifier = "%s"
1952
1958
identifier = "%s"
1953
- oauth_token_id = "%s"
1959
+ oauth_token_id = tfe_oauth_client.foobar.oauth_token_id
1954
1960
branch = "main"
1955
1961
tags = false
1956
1962
}
@@ -1962,7 +1968,7 @@ resource "tfe_registry_module" "foobar" {
1962
1968
agent_execution_mode = "agent"
1963
1969
agent_pool_id = tfe_agent_pool.foobar.id
1964
1970
}
1965
- }` , rInt , organization , organization , envGithubRegistryModuleIdentifer , envGithubRegistryModuleIdentifer , envGithubToken )
1971
+ }` , organization , envGithubToken , rInt , envGithubRegistryModuleIdentifer , envGithubRegistryModuleIdentifer )
1966
1972
}
1967
1973
1968
1974
func testAccTFERegistryModule_remoteExecutionModeWithoutAgentPool (rInt int ) string {
0 commit comments