@@ -4,6 +4,22 @@ import (
44 "github.com/hashicorp/terraform-plugin-sdk/helper/schema"
55)
66
7+ var DefaultPasswordPolicy = PasswordPolicy {
8+ MinLength : 8 ,
9+ MaxLength : 128 ,
10+ MustContainLowercase : true ,
11+ MustContainUppercase : true ,
12+ MustContainDigits : true ,
13+ MustContainSpecialChars : true ,
14+ MaxPasswordAgeInDays : 365 ,
15+ MinUniquePasswords : 10 ,
16+ AccountLockoutThreshold : 6 ,
17+ FailedLoginResetDurationInMins : 10 ,
18+ AccountLockoutDurationInMins : 30 ,
19+ RequireMfa : false ,
20+ RememberMfa : true ,
21+ }
22+
723func resourceSumologicPasswordPolicy () * schema.Resource {
824 return & schema.Resource {
925 Create : resourceSumologicPasswordPolicyCreate ,
@@ -15,67 +31,67 @@ func resourceSumologicPasswordPolicy() *schema.Resource {
1531 "min_length" : {
1632 Type : schema .TypeInt ,
1733 Optional : true ,
18- Default : 8 ,
34+ Default : DefaultPasswordPolicy . MinLength ,
1935 },
2036 "max_length" : {
2137 Type : schema .TypeInt ,
2238 Optional : true ,
23- Default : 128 ,
39+ Default : DefaultPasswordPolicy . MaxLength ,
2440 },
2541 "must_contain_lowercase" : {
2642 Type : schema .TypeBool ,
2743 Optional : true ,
28- Default : true ,
44+ Default : DefaultPasswordPolicy . MustContainLowercase ,
2945 },
3046 "must_contain_uppercase" : {
3147 Type : schema .TypeBool ,
3248 Optional : true ,
33- Default : true ,
49+ Default : DefaultPasswordPolicy . MustContainUppercase ,
3450 },
3551 "must_contain_digits" : {
3652 Type : schema .TypeBool ,
3753 Optional : true ,
38- Default : true ,
54+ Default : DefaultPasswordPolicy . MustContainDigits ,
3955 },
4056 "must_contain_special_chars" : {
4157 Type : schema .TypeBool ,
4258 Optional : true ,
43- Default : true ,
59+ Default : DefaultPasswordPolicy . MustContainSpecialChars ,
4460 },
4561 "max_password_age_in_days" : {
4662 Type : schema .TypeInt ,
4763 Optional : true ,
48- Default : 365 ,
64+ Default : DefaultPasswordPolicy . MaxPasswordAgeInDays ,
4965 },
5066 "min_unique_passwords" : {
5167 Type : schema .TypeInt ,
5268 Optional : true ,
53- Default : 10 ,
69+ Default : DefaultPasswordPolicy . MinUniquePasswords ,
5470 },
5571 "account_lockout_threshold" : {
5672 Type : schema .TypeInt ,
5773 Optional : true ,
58- Default : 6 ,
74+ Default : DefaultPasswordPolicy . AccountLockoutThreshold ,
5975 },
6076 "failed_login_reset_duration_in_mins" : {
6177 Type : schema .TypeInt ,
6278 Optional : true ,
63- Default : 10 ,
79+ Default : DefaultPasswordPolicy . FailedLoginResetDurationInMins ,
6480 },
6581 "account_lockout_duration_in_mins" : {
6682 Type : schema .TypeInt ,
6783 Optional : true ,
68- Default : 30 ,
84+ Default : DefaultPasswordPolicy . AccountLockoutDurationInMins ,
6985 },
7086 "require_mfa" : {
7187 Type : schema .TypeBool ,
7288 Optional : true ,
73- Default : false ,
89+ Default : DefaultPasswordPolicy . RequireMfa ,
7490 },
7591 "remember_mfa" : {
7692 Type : schema .TypeBool ,
7793 Optional : true ,
78- Default : true ,
94+ Default : DefaultPasswordPolicy . RememberMfa ,
7995 },
8096 },
8197 }
@@ -106,7 +122,7 @@ func resourceSumologicPasswordPolicyCreate(d *schema.ResourceData, meta interfac
106122
107123func resourceSumologicPasswordPolicyDelete (d * schema.ResourceData , meta interface {}) error {
108124 c := meta .(* Client )
109- return c .DeletePasswordPolicy ()
125+ return c .ResetPasswordPolicy ()
110126}
111127
112128func resourceSumologicPasswordPolicyUpdate (d * schema.ResourceData , meta interface {}) error {
0 commit comments