Skip to content

Commit 69f5282

Browse files
committed
feat(k8s): add support for security_group_id in pool resource
1 parent b2fba91 commit 69f5282

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

docs/resources/k8s_pool.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ The following arguments are supported:
9696

9797
~> **Important:** Updates to this field will recreate a new resource.
9898

99+
- `security_group_id` - The ID of the security group
100+
101+
~> **Important:** Updates to this field will recreate a new resource.
102+
99103
## Attributes Reference
100104

101105
In addition to all arguments above, the following attributes are exported:

internal/services/k8s/pool.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,13 @@ func ResourcePool() *schema.Resource {
249249
Computed: true,
250250
Description: "The status of the pool",
251251
},
252+
"security_group_id": {
253+
Type: schema.TypeString,
254+
Computed: true,
255+
Optional: true,
256+
ForceNew: true,
257+
Description: "The ID of the security group",
258+
},
252259
},
253260
}
254261
}
@@ -324,6 +331,10 @@ func ResourceK8SPoolCreate(ctx context.Context, d *schema.ResourceData, m any) d
324331
req.RootVolumeSize = &volumeSizeInBytes
325332
}
326333

334+
if securityGroupID, ok := d.GetOk("security_group_id"); ok {
335+
req.SecurityGroupID = types.ExpandStringPtr(locality.ExpandID(securityGroupID.(string)))
336+
}
337+
327338
// check if the cluster is waiting for a pool
328339
cluster, err := k8sAPI.GetCluster(&k8s.GetClusterRequest{
329340
ClusterID: locality.ExpandID(d.Get("cluster_id")),
@@ -422,6 +433,7 @@ func ResourceK8SPoolRead(ctx context.Context, d *schema.ResourceData, m any) dia
422433
_ = d.Set("zone", pool.Zone)
423434
_ = d.Set("upgrade_policy", poolUpgradePolicyFlatten(pool))
424435
_ = d.Set("public_ip_disabled", pool.PublicIPDisabled)
436+
_ = d.Set("security_group_id", pool.SecurityGroupID)
425437

426438
if pool.PlacementGroupID != nil {
427439
_ = d.Set("placement_group_id", zonal.NewID(pool.Zone, *pool.PlacementGroupID).String())

0 commit comments

Comments
 (0)