Skip to content

Commit 329f101

Browse files
Fix exclude username from zone request (#394)
1 parent dd7b79c commit 329f101

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

sysdig/internal/client/v2/model.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,6 @@ type PostureZoneRequest struct {
691691
Description string `json:"description"`
692692
PolicyIDs []string `json:"policyIds"`
693693
Scopes []PostureZoneScope `json:"scopes"`
694-
Username string `json:"username"`
695694
}
696695

697696
type PostureZoneResponse struct {

sysdig/resource_sysdig_secure_posture_zone.go

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package sysdig
22

33
import (
44
"context"
5+
"strconv"
6+
"time"
7+
58
v2 "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2"
69
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
710
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
8-
"strconv"
9-
"time"
1011
)
1112

1213
func resourceSysdigSecurePostureZone() *schema.Resource {
@@ -105,16 +106,6 @@ func getPostureZoneClient(c SysdigClients) (v2.PostureZoneInterface, error) {
105106
}
106107

107108
func resourceCreateOrUpdatePostureZone(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
108-
commonClient, err := meta.(SysdigClients).commonClientV2()
109-
if err != nil {
110-
return diag.FromErr(err)
111-
}
112-
113-
identityCtx, err := commonClient.GetIdentityContext(ctx)
114-
if err != nil {
115-
return diag.FromErr(err)
116-
}
117-
118109
policiesData := d.Get(SchemaPolicyIDsKey).([]interface{})
119110
policies := make([]string, len(policiesData))
120111
for i, p := range policiesData {
@@ -134,18 +125,12 @@ func resourceCreateOrUpdatePostureZone(ctx context.Context, d *schema.ResourceDa
134125
}
135126
}
136127

137-
username := identityCtx.Username
138-
if identityCtx.ServiceAccountID != 0 {
139-
username = identityCtx.ServiceAccountName
140-
}
141-
142128
req := &v2.PostureZoneRequest{
143129
ID: d.Id(),
144130
Name: d.Get(SchemaNameKey).(string),
145131
Description: d.Get(SchemaDescriptionKey).(string),
146132
PolicyIDs: policies,
147133
Scopes: scopes,
148-
Username: username,
149134
}
150135

151136
zoneClient, err := getPostureZoneClient(meta.(SysdigClients))

0 commit comments

Comments
 (0)