@@ -155,37 +155,37 @@ func addPermsSchema(s map[string]*schema.Schema) map[string]*schema.Schema {
155155 s ["security_manage_global_2fa" ] = & schema.Schema {
156156 Type : schema .TypeBool ,
157157 Optional : true ,
158- Default : false ,
158+ Default : true ,
159159 DiffSuppressFunc : suppressPermissionDiff ,
160160 }
161161 s ["security_manage_active_directory" ] = & schema.Schema {
162162 Type : schema .TypeBool ,
163163 Optional : true ,
164- Computed : true ,
164+ Default : true ,
165165 DiffSuppressFunc : suppressPermissionDiff ,
166166 }
167167 s ["dhcp_manage_dhcp" ] = & schema.Schema {
168168 Type : schema .TypeBool ,
169169 Optional : true ,
170- Computed : true ,
170+ Default : true ,
171171 DiffSuppressFunc : suppressPermissionDiff ,
172172 }
173173 s ["dhcp_view_dhcp" ] = & schema.Schema {
174174 Type : schema .TypeBool ,
175175 Optional : true ,
176- Computed : true ,
176+ Default : true ,
177177 DiffSuppressFunc : suppressPermissionDiff ,
178178 }
179179 s ["ipam_manage_ipam" ] = & schema.Schema {
180180 Type : schema .TypeBool ,
181181 Optional : true ,
182- Computed : true ,
182+ Default : true ,
183183 DiffSuppressFunc : suppressPermissionDiff ,
184184 }
185185 s ["ipam_view_ipam" ] = & schema.Schema {
186186 Type : schema .TypeBool ,
187187 Optional : true ,
188- Computed : true ,
188+ Default : true ,
189189 DiffSuppressFunc : suppressPermissionDiff ,
190190 }
191191 return s
@@ -354,28 +354,28 @@ func resourceDataToPermissions(d *schema.ResourceData) account.PermissionsMap {
354354 if v , ok := d .GetOk ("security_manage_active_directory" ); ok {
355355 p .Security .ManageActiveDirectory = v .(bool )
356356 }
357- if v , ok := d .GetOk ("dhcp_manage_dhcp" ); ok {
358- if p .DHCP == nil {
357+ for _ , thing := range []string {"dhcp_manage_dhcp" , "dhcp_view_dhcp" } {
358+ _ , ok := d .GetOkExists (thing )
359+ if d .HasChange (thing ) || ok {
359360 p .DHCP = & account.PermissionsDHCP {}
360361 }
362+ }
363+ if v , ok := d .GetOk ("dhcp_manage_dhcp" ); ok {
361364 p .DHCP .ManageDHCP = v .(bool )
362365 }
363366 if v , ok := d .GetOk ("dhcp_view_dhcp" ); ok {
364- if p .DHCP == nil {
365- p .DHCP = & account.PermissionsDHCP {}
366- }
367367 p .DHCP .ViewDHCP = v .(bool )
368368 }
369- if v , ok := d .GetOk ("ipam_manage_ipam" ); ok {
370- if p .IPAM == nil {
369+ for _ , thing := range []string {"ipam_manage_ipam" , "ipam_view_ipam" } {
370+ _ , ok := d .GetOkExists (thing )
371+ if d .HasChange (thing ) || ok {
371372 p .IPAM = & account.PermissionsIPAM {}
372373 }
374+ }
375+ if v , ok := d .GetOk ("ipam_manage_ipam" ); ok {
373376 p .IPAM .ManageIPAM = v .(bool )
374377 }
375378 if v , ok := d .GetOk ("ipam_view_ipam" ); ok {
376- if p .IPAM == nil {
377- p .IPAM = & account.PermissionsIPAM {}
378- }
379379 p .IPAM .ViewIPAM = v .(bool )
380380 }
381381 return p
0 commit comments