diff --git a/client/config.go b/client/config.go index c7142ef..7a6c6e3 100644 --- a/client/config.go +++ b/client/config.go @@ -34,6 +34,7 @@ func GetConfigEmail(d *schema.ResourceData) models.ConfigBodyPost { EmailPassword: d.Get("email_password").(string), EmailFrom: d.Get("email_from").(string), EmailSsl: d.Get("email_ssl").(bool), + EmailInsecure: d.Get("email_insecure").(bool), } } diff --git a/docs/index.md b/docs/index.md index aaeb2b3..07dc4b2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,6 +4,7 @@ The Harbor provider is used to configure an instance of Harbor. The provider nee ## Resources * [Resource: harbor_configuration](resources/configuration.md) * [Resource: harbor_config_system](resources/config_system.md) +* [Resource: harbor_config_email](resources/config_email.md) * [Resource: harbor_interrogation_services](resources/interrogation_services.md) * [Resource: harbor_project_member_group](resources/project_member_group.md) * [Resource: harbor_project_member_user](resources/project_member_user.md) diff --git a/docs/resources/config_email.md b/docs/resources/config_email.md index 0c2d593..52db7b3 100644 --- a/docs/resources/config_email.md +++ b/docs/resources/config_email.md @@ -1,4 +1,4 @@ -# Resource: harbor_config_system +# Resource: harbor_config_email ## Example Usage @@ -17,4 +17,5 @@ The following arguments are supported: * **email_username** - (Optional) The username for the email server * **email_password** - (Optional) The password for the email server * **email_from** - (Required) - The email from address ie, `dont_reply@acme.com` -* **email_ssl** - (Optional) Enable SSL for email server connection \ No newline at end of file +* **email_ssl** - (Optional) Enable SSL for email server connection +* **email_insecure** - (Optional) Verify Certificate for email server connection \ No newline at end of file diff --git a/go.sum b/go.sum index c656a20..664e05b 100644 --- a/go.sum +++ b/go.sum @@ -233,6 +233,7 @@ golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/models/config.go b/models/config.go index dc9e2f0..1e150da 100644 --- a/models/config.go +++ b/models/config.go @@ -3,11 +3,11 @@ package models var PathConfig = "/configurations" type ConfigBodyPost struct { - OidcVerifyCert bool `json:"oidc_verify_cert,omitempty"` + OidcVerifyCert bool `json:"oidc_verify_cert"` EmailIdentity string `json:"email_identity,omitempty"` LdapGroupSearchFilter string `json:"ldap_group_search_filter,omitempty"` AuthMode string `json:"auth_mode,omitempty"` - SelfRegistration bool `json:"self_registration,omitempty"` + SelfRegistration bool `json:"self_registration"` OidcScope string `json:"oidc_scope,omitempty"` LdapSearchDn string `json:"ldap_search_dn,omitempty"` StoragePerProject string `json:"storage_per_project,omitempty"` @@ -17,12 +17,11 @@ type ConfigBodyPost struct { DailyTime int `json:"daily_time,omitempty"` } `json:"parameter,omitempty"` } `json:"scan_all_policy,omitempty"` - VerifyRemoteCert bool `json:"verify_remote_cert,omitempty"` LdapTimeout int `json:"ldap_timeout,omitempty"` LdapBaseDn string `json:"ldap_base_dn,omitempty"` LdapFilter string `json:"ldap_filter,omitempty"` - ReadOnly bool `json:"read_only,omitempty"` - QuotaPerProjectEnable bool `json:"quota_per_project_enable,omitempty"` + ReadOnly bool `json:"read_only"` + QuotaPerProjectEnable bool `json:"quota_per_project_enable"` LdapURL string `json:"ldap_url,omitempty"` OidcName string `json:"oidc_name,omitempty"` ProjectCreationRestriction string `json:"project_creation_restriction,omitempty"` @@ -30,7 +29,7 @@ type ConfigBodyPost struct { OidcClientID string `json:"oidc_client_id,omitempty"` LdapGroupBaseDn string `json:"ldap_group_base_dn,omitempty"` LdapGroupAttributeName string `json:"ldap_group_attribute_name,omitempty"` - EmailInsecure bool `json:"email_insecure,omitempty"` + EmailInsecure bool `json:"email_insecure"` LdapGroupAdminDn string `json:"ldap_group_admin_dn,omitempty"` EmailUsername string `json:"email_username,omitempty"` EmailPassword string `json:"email_password,omitempty"` @@ -41,7 +40,7 @@ type ConfigBodyPost struct { CountPerProject string `json:"count_per_project,omitempty"` TokenExpiration int `json:"token_expiration,omitempty"` LdapGroupSearchScope int `json:"ldap_group_search_scope,omitempty"` - EmailSsl bool `json:"email_ssl,omitempty"` + EmailSsl bool `json:"email_ssl"` EmailPort int `json:"email_port,omitempty"` EmailHost string `json:"email_host,omitempty"` EmailFrom string `json:"email_from,omitempty"` diff --git a/provider/resource_config_email.go b/provider/resource_config_email.go index bcdb6ee..5c590dc 100644 --- a/provider/resource_config_email.go +++ b/provider/resource_config_email.go @@ -32,14 +32,15 @@ func resourceConfigEmail() *schema.Resource { Required: true, }, "email_ssl": { - Type: schema.TypeString, + Type: schema.TypeBool, Optional: true, - Default: "false", + Default: false, }, - // "email_verify_cert": { - // Type: schema.TypeString, - // Optional: true, - // }, + "email_insecure": { + Type: schema.TypeBool, + Optional: true, + Default: false, + }, }, Create: resourceConfigEmailCreate, Read: resourceConfigEmailRead,