diff --git a/sysdig/internal/client/v2/model.go b/sysdig/internal/client/v2/model.go index c3602081..5ff906a2 100644 --- a/sysdig/internal/client/v2/model.go +++ b/sysdig/internal/client/v2/model.go @@ -691,7 +691,6 @@ type PostureZoneRequest struct { Description string `json:"description"` PolicyIDs []string `json:"policyIds"` Scopes []PostureZoneScope `json:"scopes"` - Username string `json:"username"` } type PostureZoneResponse struct { diff --git a/sysdig/resource_sysdig_secure_posture_zone.go b/sysdig/resource_sysdig_secure_posture_zone.go index 0c1e86b6..9c039f20 100644 --- a/sysdig/resource_sysdig_secure_posture_zone.go +++ b/sysdig/resource_sysdig_secure_posture_zone.go @@ -2,11 +2,12 @@ package sysdig import ( "context" + "strconv" + "time" + v2 "github.com/draios/terraform-provider-sysdig/sysdig/internal/client/v2" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "strconv" - "time" ) func resourceSysdigSecurePostureZone() *schema.Resource { @@ -105,16 +106,6 @@ func getPostureZoneClient(c SysdigClients) (v2.PostureZoneInterface, error) { } func resourceCreateOrUpdatePostureZone(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { - commonClient, err := meta.(SysdigClients).commonClientV2() - if err != nil { - return diag.FromErr(err) - } - - identityCtx, err := commonClient.GetIdentityContext(ctx) - if err != nil { - return diag.FromErr(err) - } - policiesData := d.Get(SchemaPolicyIDsKey).([]interface{}) policies := make([]string, len(policiesData)) for i, p := range policiesData { @@ -134,18 +125,12 @@ func resourceCreateOrUpdatePostureZone(ctx context.Context, d *schema.ResourceDa } } - username := identityCtx.Username - if identityCtx.ServiceAccountID != 0 { - username = identityCtx.ServiceAccountName - } - req := &v2.PostureZoneRequest{ ID: d.Id(), Name: d.Get(SchemaNameKey).(string), Description: d.Get(SchemaDescriptionKey).(string), PolicyIDs: policies, Scopes: scopes, - Username: username, } zoneClient, err := getPostureZoneClient(meta.(SysdigClients))