forked from databricks/terraform-provider-databricks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
databricks_enhanced_security_monitoring_workspace_setting
re…
…source for ESC (Enhanced Compliance and Security) settings (databricks#3563) * Add support for ESC (Enhanced Compliance and Security) settings Added automatic_cluster_update and enhanced_security_monitoring settings. Will add compliance_security_profile in a follow up PR. * fmt * remove doc * update * updates * updates * updates:
- Loading branch information
1 parent
81a8969
commit bd32bf3
Showing
4 changed files
with
416 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
subcategory: "Settings" | ||
--- | ||
|
||
# databricks_enhanced_security_monitoring_workspace_setting Resource | ||
|
||
-> **Note** This resource could be only used with workspace-level provider! | ||
|
||
The `databricks_enhanced_security_monitoring_workspace_setting` resource allows you to control whether enhanced security monitoring | ||
is enabled for the current workspace. If the compliance security profile is enabled, this is automatically enabled. By default, | ||
it is disabled. However, if the compliance security profile is enabled, this is automatically enabled. If the compliance security | ||
profile is disabled, you can enable or disable this setting and it is not permanent. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
resource "databricks_enhanced_security_monitoring_workspace_setting" "this" { | ||
enhanced_security_monitoring_workspace { | ||
is_enabled = true | ||
} | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The resource supports the following arguments: | ||
|
||
* `is_enabled` - (Required) Enable the Enhanced Security Monitoring on the workspace | ||
|
||
## Import | ||
|
||
This resource can be imported by predefined name `global`: | ||
|
||
```bash | ||
terraform import databricks_enhanced_security_monitoring_workspace_setting.this global | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package settings | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
|
||
"github.com/databricks/databricks-sdk-go" | ||
"github.com/databricks/databricks-sdk-go/service/settings" | ||
) | ||
|
||
// Enhanced Security Monitoring setting | ||
var enhancedSecurityMonitoringFieldMask = strings.Join([]string{ | ||
"enhanced_security_monitoring_workspace.is_enabled", | ||
}, ",") | ||
var enhancedSecurityMonitoringSetting = workspaceSetting[settings.EnhancedSecurityMonitoringSetting]{ | ||
settingStruct: settings.EnhancedSecurityMonitoringSetting{}, | ||
readFunc: func(ctx context.Context, w *databricks.WorkspaceClient, etag string) (*settings.EnhancedSecurityMonitoringSetting, error) { | ||
return w.Settings.EnhancedSecurityMonitoring().Get(ctx, settings.GetEnhancedSecurityMonitoringSettingRequest{ | ||
Etag: etag, | ||
}) | ||
}, | ||
updateFunc: func(ctx context.Context, w *databricks.WorkspaceClient, t settings.EnhancedSecurityMonitoringSetting) (string, error) { | ||
t.SettingName = "default" | ||
res, err := w.Settings.EnhancedSecurityMonitoring().Update(ctx, settings.UpdateEnhancedSecurityMonitoringSettingRequest{ | ||
AllowMissing: true, | ||
Setting: t, | ||
FieldMask: enhancedSecurityMonitoringFieldMask, | ||
}) | ||
if err != nil { | ||
return "", err | ||
} | ||
return res.Etag, err | ||
}, | ||
deleteFunc: func(ctx context.Context, w *databricks.WorkspaceClient, etag string) (string, error) { | ||
res, err := w.Settings.EnhancedSecurityMonitoring().Update(ctx, settings.UpdateEnhancedSecurityMonitoringSettingRequest{ | ||
AllowMissing: true, | ||
Setting: settings.EnhancedSecurityMonitoringSetting{ | ||
Etag: etag, | ||
SettingName: "default", | ||
EnhancedSecurityMonitoringWorkspace: settings.EnhancedSecurityMonitoring{ | ||
IsEnabled: false, | ||
}, | ||
}, | ||
FieldMask: enhancedSecurityMonitoringFieldMask, | ||
}) | ||
if err != nil { | ||
return "", err | ||
} | ||
return res.Etag, err | ||
}, | ||
} |
Oops, something went wrong.