Skip to content

Commit 769416c

Browse files
committed
Add agent_pool_id to OAuth client resource
This change adds the agent_pool_id field to the read and update functions, which is used to associate a VCS Provider with an AgentPool for PrivateVCS support.
1 parent 5fd2184 commit 769416c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/provider/resource_tfe_oauth_client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ func resourceTFEOAuthClientRead(d *schema.ResourceData, meta interface{}) error
204204
d.Set("http_url", oc.HTTPURL)
205205
d.Set("service_provider", string(oc.ServiceProvider))
206206
d.Set("organization_scoped", oc.OrganizationScoped)
207+
d.Set("agent_pool_id", oc.AgentPool.ID)
207208

208209
switch len(oc.OAuthTokens) {
209210
case 0:
@@ -239,6 +240,9 @@ func resourceTFEOAuthClientUpdate(d *schema.ResourceData, meta interface{}) erro
239240
options := tfe.OAuthClientUpdateOptions{
240241
OrganizationScoped: tfe.Bool(d.Get("organization_scoped").(bool)),
241242
}
243+
if v, ok := d.GetOk("agent_pool_id"); ok && v.(string) != "" {
244+
options.AgentPool = &tfe.AgentPool{ID: *tfe.String(v.(string))}
245+
}
242246

243247
log.Printf("[DEBUG] Update OAuth client %s", d.Id())
244248
_, err := config.Client.OAuthClients.Update(ctx, d.Id(), options)

0 commit comments

Comments
 (0)