@@ -76,10 +76,8 @@ func TestAccTFEOAuthClient_rsaKeys(t *testing.T) {
76
76
}
77
77
78
78
func TestAccTFEOAuthClient_agentPool (t * testing.T ) {
79
- skipUnlessBeta (t );
79
+ skipUnlessBeta (t )
80
80
oc := & tfe.OAuthClient {}
81
- rInt := rand .New (rand .NewSource (time .Now ().UnixNano ())).Int ()
82
-
83
81
resource .Test (t , resource.TestCase {
84
82
PreCheck : func () {
85
83
testAccPreCheck (t )
@@ -91,7 +89,7 @@ func TestAccTFEOAuthClient_agentPool(t *testing.T) {
91
89
CheckDestroy : testAccCheckTFEOAuthClientDestroy ,
92
90
Steps : []resource.TestStep {
93
91
{
94
- Config : testAccTFEOAuthClient_agentPool (rInt ),
92
+ Config : testAccTFEOAuthClient_agentPool (),
95
93
Check : resource .ComposeTestCheckFunc (
96
94
testAccCheckTFEOAuthClientExists ("tfe_oauth_client.foobar" , oc ),
97
95
testAccCheckTFEOAuthClientAttributes (oc ),
@@ -212,24 +210,23 @@ EOT
212
210
}` , rInt )
213
211
}
214
212
215
- func testAccTFEOAuthClient_agentPool (rInt int ) string {
213
+ func testAccTFEOAuthClient_agentPool () string {
216
214
return fmt .Sprintf (`
217
- resource "tfe_organization" "foobar" {
218
- name = "tst-terraform-%d"
219
-
215
+ data "tfe_organization" "foobar" {
216
+ name = "xxx"
220
217
}
221
218
222
- resource "tfe_agent_pool" "foobar" {
223
- name = "agent-pool-test "
224
- organization = tfe_organization.foobar.name
219
+ data "tfe_agent_pool" "foobar" {
220
+ name = "xxx "
221
+ organization = data. tfe_organization.foobar.name
225
222
}
226
223
227
224
resource "tfe_oauth_client" "foobar" {
228
- organization = tfe_organization.foobar.id
229
- api_url = "https://githubenterprise.xxx"
225
+ organization = data. tfe_organization.foobar.name
226
+ api_url = "https://githubenterprise.xxx/api/v3 "
230
227
http_url = "https://githubenterprise.xxx"
231
228
oauth_token = "%s"
232
229
service_provider = "github_enterprise"
233
- agent_pool_id = tfe_agent_pool.foobar.id
234
- }` , rInt , envGithubToken )
230
+ agent_pool_id = data. tfe_agent_pool.foobar.id
231
+ }` , envGithubToken )
235
232
}
0 commit comments