Skip to content

feat(dspm): expose configuration properties for AWS/Azure DSPM Cloud Accounts#1820

Merged
kirklandnuts merged 2 commits intomainfrom
feat/dspm-config
Mar 16, 2026
Merged

feat(dspm): expose configuration properties for AWS/Azure DSPM Cloud Accounts#1820
kirklandnuts merged 2 commits intomainfrom
feat/dspm-config

Conversation

@kirklandnuts
Copy link
Contributor

@kirklandnuts kirklandnuts commented Mar 12, 2026

Summary

This PR exposes props used to configure various parameters for DSPM integrations:

  • ScanIntervalHours: how frequently the DSPM integration will scan, in hours
  • MaxDownloadBytes: max size of files to scan, in bytes
  • DatastoreFilters: optionally include/exclude specific datastores when scanning

These changes are required to enable users to configure their DSPM integrations directly using Terraform (rather than having to configure via the UI). For additional context, see lacework/terraform-azure-dspm#8 and lacework/terraform-aws-dspm#8.

How did you test this change?

See testing description for lacework/terraform-azure-dspm#8 and lacework/terraform-aws-dspm#8.

Issue

https://lacework.atlassian.net/browse/AWLS2-960

Comment on lines +175 to +210
// RequestEncoderDecoderWithToken performs an HTTP request using a server token
// for authentication instead of the client's API key token. Used for endpoints
// authenticated via ServerTokenProps (e.g., POST /api/v2/dspm/status).
func (c *Client) RequestEncoderDecoderWithToken(method, path, token string, data, v interface{}) error {
body, err := jsonReader(data)
if err != nil {
return err
}

apiPath, err := url.Parse(c.apiPath(path))
if err != nil {
return err
}

u := c.baseURL.ResolveReference(apiPath)
request, err := http.NewRequest(method, u.String(), body)
if err != nil {
return err
}

request.Header.Set("Authorization", token)
request.Header.Set("Content-Type", "application/json")
request.Header.Set("Accept", "application/json")

for k, v := range c.headers {
request.Header.Set(k, v)
}

res, err := c.DoDecoder(request, v)
if err != nil {
return err
}
defer res.Body.Close()
return nil
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed because we want to update the status of a DSPM integration depending on the configuration values via the POST /api/v2/dspm/status API. This API is authenticated via server token rather than access token (created using API key) - unless I'm mistaken, we've yet to call any server token authenticated APIs from go-sdk.

@PengyuanZhao Having said that, I wanted to check with you if this looks alright to you, or if I'm missing anything.

@wilderj If we conclude that we don't want to make any server token authenticated calls from go-sdk, then we'll need to modify api-server to expose another API that's authenticated via access token (or add it as an auth method on the existing API, if that's possible).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works!

@kirklandnuts kirklandnuts merged commit 4ee67a2 into main Mar 16, 2026
13 checks passed
@kirklandnuts kirklandnuts deleted the feat/dspm-config branch March 16, 2026 16:45
This was referenced Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants