Skip to content

Commit 7b360aa

Browse files
authored
Feature/agent pools (#2603)
1 parent 4eada45 commit 7b360aa

17 files changed

Lines changed: 1844 additions & 3 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
page_title: "Data Source: okta_agent_pool_update"
3+
description: |-
4+
Retrieves an Okta Agent Pool Update. Agent pool updates allow you to schedule and manage updates for agent pools.
5+
---
6+
7+
# Data Source: okta_agent_pool_update
8+
9+
Retrieves an Okta Agent Pool Update. Agent pool updates allow you to schedule and manage updates for agent pools.
10+
11+
## Example Usage
12+
13+
```terraform
14+
data "okta_agent_pool_update" "example" {
15+
id = "<update_id>"
16+
pool_id = "<pool_id>"
17+
}
18+
```
19+
20+
<!-- schema generated by tfplugindocs -->
21+
## Schema
22+
23+
### Required
24+
25+
- `id` (String) The unique identifier of the agent pool update.
26+
- `pool_id` (String) The unique identifier of the agent pool.
27+
28+
### Read-Only
29+
30+
- `agent_type` (String) Agent types that are being monitored (e.g. AD, LDAP, IWA, RADIUS, MFA, OPP, RUM, Radius).
31+
- `agents` (Set of Object) The agents associated with the agent pool update. (see [below for nested schema](#nestedblock--agents))
32+
- `enabled` (Boolean) Indicates if auto-update is enabled for the agent pool.
33+
- `name` (String) The name of the agent pool update.
34+
- `notify_admin` (Boolean) Indicates if the admin is notified about the update.
35+
- `reason` (String) Reason for the update.
36+
- `schedule` (Object) The schedule configuration for the agent pool update. (see [below for nested schema](#nestedblock--schedule))
37+
- `sort_order` (Number) Specifies the sort order.
38+
- `status` (String) Overall state for the auto-update job from the admin perspective (e.g., Cancelled, Failed, InProgress, Paused, Scheduled, Success).
39+
- `target_version` (String) The agent version to update to.
40+
41+
<a id="nestedblock--agents"></a>
42+
### Nested Schema for `agents`
43+
44+
Read-Only:
45+
46+
- `id` (String) The unique identifier of the agent.
47+
- `is_hidden` (Boolean) Determines if an agent is hidden from the Admin Console.
48+
- `is_latest_gaed_version` (Boolean) Determines if the agent is on the latest generally available version.
49+
- `last_connection` (Number) Timestamp when the agent last connected to Okta.
50+
- `name` (String) The name of the agent.
51+
- `operational_status` (String) Operational status of a given agent (e.g., DEGRADED, DISRUPTED, INACTIVE, OPERATIONAL).
52+
- `pool_id` (String) Pool ID.
53+
- `type` (String) Agent types that are being monitored.
54+
- `update_message` (String) Status message of the agent.
55+
- `update_status` (String) Status for one agent regarding the status to auto-update that agent.
56+
- `version` (String) Agent version number.
57+
58+
<a id="nestedblock--schedule"></a>
59+
### Nested Schema for `schedule`
60+
61+
Read-Only:
62+
63+
- `cron` (String) The schedule of the update in cron format.
64+
- `delay` (Number) Delay in days.
65+
- `duration` (Number) Duration in minutes.
66+
- `last_updated` (String) Timestamp when the update finished.
67+
- `timezone` (String) Timezone of where the scheduled job takes place.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
page_title: "Resource: okta_agent_pool_update"
3+
description: |-
4+
Manages an Okta Agent Pool Update. Agent pool updates allow you to schedule and manage updates for agent pools.
5+
---
6+
7+
# Resource: okta_agent_pool_update
8+
9+
Manages an Okta Agent Pool Update. Agent pool updates allow you to schedule and manage updates for agent pools.
10+
11+
## Example Usage
12+
13+
```terraform
14+
resource "okta_agent_pool_update" "example" {
15+
name = "scheduled_update"
16+
agent_type = "AD"
17+
notify_admins = true
18+
pool_id = "0oaspf3cfatE1nDO31d7"
19+
20+
agents {
21+
id = "a53slzqkptH2xEJ1r1d7"
22+
pool_id = "0oaspf3cfatE1nDO31d7"
23+
}
24+
25+
schedule {
26+
cron = "0 3 * * MON"
27+
timezone = "America/Los_Angeles"
28+
delay = 0
29+
duration = 1020
30+
}
31+
}
32+
```
33+
34+
<!-- schema generated by tfplugindocs -->
35+
## Schema
36+
37+
### Required
38+
39+
- `pool_id` (String) The unique identifier of the agent pool to update.
40+
41+
### Optional
42+
43+
- `agent_type` (String) Agent types that are being monitored (e.g., AD, IWA, LDAP, MFA, OPP, RUM, Radius).
44+
- `agents` (Block List) The agents associated with the agent pool update. (see [below for nested schema](#nestedblock--agents))
45+
- `description` (String) The description of the agent pool update.
46+
- `enabled` (Boolean) Whether auto-update is enabled for the agent pool.
47+
- `name` (String) The name of the agent pool update.
48+
- `notify_admins` (Boolean) Whether to notify admins about the update.
49+
- `notify_on_completion` (Boolean) Whether to send notifications when the update completes.
50+
- `reason` (String) Reason for the update.
51+
- `schedule` (Block, Optional) The schedule configuration for the agent pool update. (see [below for nested schema](#nestedblock--schedule))
52+
- `sort_order` (Number) Specifies the sort order.
53+
- `target_version` (String) The agent version to update to.
54+
55+
### Read-Only
56+
57+
- `id` (String) The unique identifier of the agent pool update.
58+
- `status` (String) The status of the agent pool update (e.g., Scheduled, InProgress, Completed, Failed).
59+
60+
<a id="nestedblock--agents"></a>
61+
### Nested Schema for `agents`
62+
63+
Optional:
64+
65+
- `id` (String) The unique identifier of the agent.
66+
- `pool_id` (String) Pool ID.
67+
68+
Read-Only:
69+
70+
- `is_hidden` (Boolean) Determines if an agent is hidden from the Admin Console.
71+
- `is_latest_gaed_version` (Boolean) Determines if the agent is on the latest generally available version.
72+
- `last_connection` (Number) Timestamp when the agent last connected to Okta.
73+
- `name` (String) The name of the agent.
74+
- `operational_status` (String) Operational status of a given agent (e.g., OPERATIONAL, DEGRADED, DISRUPTED).
75+
- `type` (String) Agent types that are being monitored.
76+
- `update_message` (String) Status message of the agent.
77+
- `update_status` (String) Status for one agent regarding the status to auto-update that agent.
78+
- `version` (String) Agent version number.
79+
80+
<a id="nestedblock--schedule"></a>
81+
### Nested Schema for `schedule`
82+
83+
Optional:
84+
85+
- `cron` (String) The schedule of the update in cron format.
86+
- `delay` (Number) Delay in days.
87+
- `duration` (Number) Duration in minutes.
88+
- `timezone` (String) Timezone of where the scheduled job takes place.
89+
90+
Read-Only:
91+
92+
- `last_updated` (String) Timestamp when the update finished (only for a successful or failed update, not for a cancelled update). Null is returned if the job hasn't finished once yet.
93+
94+
## Import
95+
96+
Import is supported using the following syntax:
97+
98+
```shell
99+
terraform import okta_agent_pool_update.example <pool_id>/<update_id>
100+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
resource "okta_agent_pool_update" "test" {
2+
name = "update_schedule_test"
3+
agent_type = "AD"
4+
notify_admins = true
5+
pool_id = "0oaspf3cfatE1nDO31d7"
6+
agents {
7+
id = "a53slzqkptH2xEJ1r1d7"
8+
pool_id = "0oaspf3cfatE1nDO31d7" # this is required in schema
9+
}
10+
11+
schedule {
12+
cron = "0 3 * * WED"
13+
timezone = "Asia/Calcutta"
14+
delay = 0
15+
duration = 1020
16+
}
17+
}
18+
19+
data "okta_agent_pool_update" "example" {
20+
id = okta_agent_pool_update.test.id
21+
pool_id = "0oaspf3cfatE1nDO31d7"
22+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resource "okta_agent_pool_update" "example" {
2+
name = "schedule_test"
3+
agent_type = "AD"
4+
notify_admins = true
5+
pool_id = "0oaspf3cfatE1nDO31d7"
6+
agents {
7+
id = "a53slzqkptH2xEJ1r1d7"
8+
pool_id = "0oaspf3cfatE1nDO31d7" # this is required in schema
9+
}
10+
11+
schedule {
12+
cron = "0 3 * * WED"
13+
timezone = "Asia/Calcutta"
14+
delay = 0
15+
duration = 1020
16+
}
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
resource "okta_agent_pool_update" "example" {
2+
name = "schedule_test"
3+
agent_type = "AD"
4+
notify_admins = true
5+
pool_id = "0oaspf3cfatE1nDO31d7"
6+
agents {
7+
id = "a53slzqkptH2xEJ1r1d7"
8+
pool_id = "0oaspf3cfatE1nDO31d7" # this is required in schema
9+
}
10+
11+
schedule {
12+
cron = "0 3 * * MON"
13+
timezone = "Asia/Calcutta"
14+
delay = 0
15+
duration = 1020
16+
}
17+
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ require (
2929
github.com/okta/okta-governance-sdk-golang v1.0.1
3030
github.com/okta/okta-sdk-golang/v4 v4.1.2
3131
github.com/okta/okta-sdk-golang/v5 v5.0.6
32-
github.com/okta/okta-sdk-golang/v6 v6.0.1
32+
github.com/okta/okta-sdk-golang/v6 v6.0.2
3333
github.com/patrickmn/go-cache v2.1.0+incompatible
3434
github.com/stretchr/testify v1.11.1
3535
gopkg.in/dnaeon/go-vcr.v4 v4.0.6

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ github.com/okta/okta-sdk-golang/v4 v4.1.2 h1:gSycAYWGrvYeXBW8HakMZnNu/ptMuTvTQ/z
228228
github.com/okta/okta-sdk-golang/v4 v4.1.2/go.mod h1:01oiHDXvZQHlZo1Uw084VDYwXIqJe19z34b53PBZpUY=
229229
github.com/okta/okta-sdk-golang/v5 v5.0.6 h1:p7ptDMB1KxQ/7xSh+6FhMSybwl+ubTV4f1oL4N0Bu6U=
230230
github.com/okta/okta-sdk-golang/v5 v5.0.6/go.mod h1:T/vmECtJX33YPZSVD+sorebd8LLhe38Bi/VrFTjgVX0=
231-
github.com/okta/okta-sdk-golang/v6 v6.0.1 h1:i49fQkgTTSgVrXmLepwQy5wf99q9m8xMZ7b/DamyTcI=
232-
github.com/okta/okta-sdk-golang/v6 v6.0.1/go.mod h1:EzV8yrIDarJfL8lAwUmfcuVQmaXe7gbhWyzKoCSb/WU=
231+
github.com/okta/okta-sdk-golang/v6 v6.0.2 h1:eaKjSSjlS5YnuG7jX4P4BFZLfIriZuq4ro/QVirq+oI=
232+
github.com/okta/okta-sdk-golang/v6 v6.0.2/go.mod h1:EzV8yrIDarJfL8lAwUmfcuVQmaXe7gbhWyzKoCSb/WU=
233233
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
234234
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
235235
github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4=

okta/resources/resources.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const (
55
OktaIDaaSAdminRoleCustom = "okta_admin_role_custom"
66
OktaIDaaSAdminRoleCustomAssignments = "okta_admin_role_custom_assignments"
77
OktaIDaaSAdminRoleTargets = "okta_admin_role_targets"
8+
OktaIDaaSAgentPoolUpdate = "okta_agent_pool_update"
89
OktaIDaaSApp = "okta_app"
910
OktaIDaaSApps = "okta_apps"
1011
OktaIDaaSAppAutoLogin = "okta_app_auto_login"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package idaas_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
7+
"github.com/okta/terraform-provider-okta/okta/acctest"
8+
"github.com/okta/terraform-provider-okta/okta/resources"
9+
)
10+
11+
func TestAccDataSourceOktaAgentPool_read(t *testing.T) {
12+
mgr := newFixtureManager("data-sources", resources.OktaIDaaSAgentPoolUpdate, t.Name())
13+
config := mgr.GetFixtures("datasource.tf", t)
14+
15+
acctest.OktaResourceTest(t, resource.TestCase{
16+
PreCheck: acctest.AccPreCheck(t),
17+
ErrorCheck: testAccErrorChecks(t),
18+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactoriesForTestAcc(t),
19+
Steps: []resource.TestStep{
20+
{
21+
Config: config,
22+
Check: resource.ComposeTestCheckFunc(
23+
resource.TestCheckResourceAttrSet("data.okta_agent_pool_update.example", "id"),
24+
resource.TestCheckResourceAttrSet("data.okta_agent_pool_update.example", "pool_id"),
25+
resource.TestCheckResourceAttr("data.okta_agent_pool_update.example", "name", "update_schedule_test"),
26+
resource.TestCheckResourceAttr("data.okta_agent_pool_update.example", "agent_type", "AD"),
27+
resource.TestCheckResourceAttr("data.okta_agent_pool_update.example", "enabled", "false"),
28+
resource.TestCheckResourceAttr("data.okta_agent_pool_update.example", "notify_admin", "true"),
29+
resource.TestCheckResourceAttr("data.okta_agent_pool_update.example", "status", "Scheduled"),
30+
resource.TestCheckTypeSetElemNestedAttrs(
31+
"data.okta_agent_pool_update.example",
32+
"agents.*",
33+
map[string]string{
34+
"operational_status": "OPERATIONAL",
35+
"type": "AD",
36+
},
37+
),
38+
),
39+
},
40+
},
41+
})
42+
}

0 commit comments

Comments
 (0)