diff --git a/client/config.go b/client/config.go index b70a575..6884ba2 100644 --- a/client/config.go +++ b/client/config.go @@ -38,6 +38,7 @@ func GetConfigSystem(d *schema.ResourceData) models.ConfigBodySystemPost { AuditLogForwardEndpoint: d.Get("audit_log_forward_endpoint").(string), SkipAuditLogDatabase: d.Get("skip_audit_log_database").(bool), BannerMessage: bannerMessage, + NotificationEnable: d.Get("notification_enable").(bool), } log.Printf("[DEBUG] %+v\n ", body) return body diff --git a/docs/resources/config_system.md b/docs/resources/config_system.md index 0b69493..1e56a04 100644 --- a/docs/resources/config_system.md +++ b/docs/resources/config_system.md @@ -18,6 +18,7 @@ resource "harbor_config_system" "main" { robot_token_expiration = 30 robot_name_prefix = "harbor@" storage_per_project = 100 + notification_enable = true } ``` @@ -33,6 +34,7 @@ resource "harbor_config_system" "main" { - `storage_per_project` (Number) Default quota space per project in GIB. Default is -1 (unlimited). - `audit_log_forward_endpoint` (String) The endpoint to forward audit logs to. - `skip_audit_log_database` (Boolean) Whether or not to skip audit log database. +- `notification_enable` (Boolean) Whether or not webhook/notification functionality is enabled globally. When `false`, all project-level webhook policies are silently ignored. Defaults to `true`. - `banner_message` (Block Set) (see [below for nested schema](#nestedblock--banner_message)) diff --git a/models/config.go b/models/config.go index c9f9318..e8f99ce 100644 --- a/models/config.go +++ b/models/config.go @@ -54,6 +54,7 @@ type ConfigBodySystemPost struct { AuditLogForwardEndpoint string `json:"audit_log_forward_endpoint,omitempty"` SkipAuditLogDatabase bool `json:"skip_audit_log_database"` BannerMessage string `json:"banner_message"` + NotificationEnable bool `json:"notification_enable"` } type ConfigBodyResponse struct { @@ -227,6 +228,10 @@ type ConfigBodyResponse struct { Editable bool `json:"editable,omitempty"` Value string `json:"value,omitempty"` } `json:"banner_message,omitempty"` + NotificationEnable struct { + Editable bool `json:"editable,omitempty"` + Value bool `json:"value,omitempty"` + } `json:"notification_enable,omitempty"` } type BannerMessage struct { diff --git a/provider/resource_config_system.go b/provider/resource_config_system.go index 4820df9..4e2c790 100644 --- a/provider/resource_config_system.go +++ b/provider/resource_config_system.go @@ -97,6 +97,11 @@ func resourceConfigSystem() *schema.Resource { }, }, }, + "notification_enable": { + Type: schema.TypeBool, + Optional: true, + Default: true, + }, }, Create: resourceConfigSystemCreate, Read: resourceConfigSystemRead, @@ -173,6 +178,7 @@ func resourceConfigSystemRead(d *schema.ResourceData, m interface{}) error { d.Set("storage_per_project", storage) d.Set("audit_log_forward_endpoint", jsonData.AuditLogForwardEndpoint.Value) d.Set("skip_audit_log_database", jsonData.SkipAuditLogDatabase.Value) + d.Set("notification_enable", jsonData.NotificationEnable.Value) d.SetId("configuration/system") return nil