@@ -234,6 +234,65 @@ Possible values include: STANDARD, PREMIUM, BASIC_HDD, BASIC_SSD, HIGH_SCALE_SSD
234234 Optional : true ,
235235 Description : `A description of the instance.` ,
236236 },
237+ "directory_services" : {
238+ Type : schema .TypeList ,
239+ Optional : true ,
240+ ForceNew : true ,
241+ Description : `Directory Services configuration.
242+ Should only be set if protocol is "NFS_V4_1".` ,
243+ MaxItems : 1 ,
244+ Elem : & schema.Resource {
245+ Schema : map [string ]* schema.Schema {
246+ "ldap" : {
247+ Type : schema .TypeList ,
248+ Optional : true ,
249+ ForceNew : true ,
250+ Description : `Configuration for LDAP servers.` ,
251+ MaxItems : 1 ,
252+ Elem : & schema.Resource {
253+ Schema : map [string ]* schema.Schema {
254+ "domain" : {
255+ Type : schema .TypeString ,
256+ Required : true ,
257+ ForceNew : true ,
258+ Description : `The LDAP domain name in the format of 'my-domain.com'.` ,
259+ },
260+ "servers" : {
261+ Type : schema .TypeList ,
262+ Required : true ,
263+ ForceNew : true ,
264+ Description : `The servers names are used for specifying the LDAP servers names.
265+ The LDAP servers names can come with two formats:
266+ 1. DNS name, for example: 'ldap.example1.com', 'ldap.example2.com'.
267+ 2. IP address, for example: '10.0.0.1', '10.0.0.2', '10.0.0.3'.
268+ All servers names must be in the same format: either all DNS names or all
269+ IP addresses.` ,
270+ Elem : & schema.Schema {
271+ Type : schema .TypeString ,
272+ },
273+ },
274+ "groups_ou" : {
275+ Type : schema .TypeString ,
276+ Optional : true ,
277+ ForceNew : true ,
278+ Description : `The groups Organizational Unit (OU) is optional. This parameter is a hint
279+ to allow faster lookup in the LDAP namespace. In case that this parameter
280+ is not provided, Filestore instance will query the whole LDAP namespace.` ,
281+ },
282+ "users_ou" : {
283+ Type : schema .TypeString ,
284+ Optional : true ,
285+ ForceNew : true ,
286+ Description : `The users Organizational Unit (OU) is optional. This parameter is a hint
287+ to allow faster lookup in the LDAP namespace. In case that this parameter
288+ is not provided, Filestore instance will query the whole LDAP namespace.` ,
289+ },
290+ },
291+ },
292+ },
293+ },
294+ },
295+ },
237296 "initial_replication" : {
238297 Type : schema .TypeList ,
239298 Optional : true ,
@@ -518,6 +577,12 @@ func resourceFilestoreInstanceCreate(d *schema.ResourceData, meta interface{}) e
518577 } else if v , ok := d .GetOkExists ("tags" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (tagsProp )) && (ok || ! reflect .DeepEqual (v , tagsProp )) {
519578 obj ["tags" ] = tagsProp
520579 }
580+ directoryServicesProp , err := expandFilestoreInstanceDirectoryServices (d .Get ("directory_services" ), d , config )
581+ if err != nil {
582+ return err
583+ } else if v , ok := d .GetOkExists ("directory_services" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (directoryServicesProp )) && (ok || ! reflect .DeepEqual (v , directoryServicesProp )) {
584+ obj ["directoryServices" ] = directoryServicesProp
585+ }
521586 labelsProp , err := expandFilestoreInstanceEffectiveLabels (d .Get ("effective_labels" ), d , config )
522587 if err != nil {
523588 return err
@@ -691,6 +756,9 @@ func resourceFilestoreInstanceRead(d *schema.ResourceData, meta interface{}) err
691756 if err := d .Set ("effective_replication" , flattenFilestoreInstanceEffectiveReplication (res ["replication" ], d , config )); err != nil {
692757 return fmt .Errorf ("Error reading Instance: %s" , err )
693758 }
759+ if err := d .Set ("directory_services" , flattenFilestoreInstanceDirectoryServices (res ["directoryServices" ], d , config )); err != nil {
760+ return fmt .Errorf ("Error reading Instance: %s" , err )
761+ }
694762 if err := d .Set ("terraform_labels" , flattenFilestoreInstanceTerraformLabels (res ["labels" ], d , config )); err != nil {
695763 return fmt .Errorf ("Error reading Instance: %s" , err )
696764 }
@@ -1238,6 +1306,54 @@ func flattenFilestoreInstanceEffectiveReplicationReplicasLastActiveSyncTime(v in
12381306 return v
12391307}
12401308
1309+ func flattenFilestoreInstanceDirectoryServices (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1310+ if v == nil {
1311+ return nil
1312+ }
1313+ original := v .(map [string ]interface {})
1314+ if len (original ) == 0 {
1315+ return nil
1316+ }
1317+ transformed := make (map [string ]interface {})
1318+ transformed ["ldap" ] =
1319+ flattenFilestoreInstanceDirectoryServicesLdap (original ["ldap" ], d , config )
1320+ return []interface {}{transformed }
1321+ }
1322+ func flattenFilestoreInstanceDirectoryServicesLdap (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1323+ if v == nil {
1324+ return nil
1325+ }
1326+ original := v .(map [string ]interface {})
1327+ if len (original ) == 0 {
1328+ return nil
1329+ }
1330+ transformed := make (map [string ]interface {})
1331+ transformed ["domain" ] =
1332+ flattenFilestoreInstanceDirectoryServicesLdapDomain (original ["domain" ], d , config )
1333+ transformed ["servers" ] =
1334+ flattenFilestoreInstanceDirectoryServicesLdapServers (original ["servers" ], d , config )
1335+ transformed ["users_ou" ] =
1336+ flattenFilestoreInstanceDirectoryServicesLdapUsersOu (original ["usersOu" ], d , config )
1337+ transformed ["groups_ou" ] =
1338+ flattenFilestoreInstanceDirectoryServicesLdapGroupsOu (original ["groupsOu" ], d , config )
1339+ return []interface {}{transformed }
1340+ }
1341+ func flattenFilestoreInstanceDirectoryServicesLdapDomain (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1342+ return v
1343+ }
1344+
1345+ func flattenFilestoreInstanceDirectoryServicesLdapServers (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1346+ return v
1347+ }
1348+
1349+ func flattenFilestoreInstanceDirectoryServicesLdapUsersOu (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1350+ return v
1351+ }
1352+
1353+ func flattenFilestoreInstanceDirectoryServicesLdapGroupsOu (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1354+ return v
1355+ }
1356+
12411357func flattenFilestoreInstanceTerraformLabels (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
12421358 if v == nil {
12431359 return v
@@ -1559,6 +1675,81 @@ func expandFilestoreInstanceTags(v interface{}, d tpgresource.TerraformResourceD
15591675 return m , nil
15601676}
15611677
1678+ func expandFilestoreInstanceDirectoryServices (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1679+ l := v .([]interface {})
1680+ if len (l ) == 0 || l [0 ] == nil {
1681+ return nil , nil
1682+ }
1683+ raw := l [0 ]
1684+ original := raw .(map [string ]interface {})
1685+ transformed := make (map [string ]interface {})
1686+
1687+ transformedLdap , err := expandFilestoreInstanceDirectoryServicesLdap (original ["ldap" ], d , config )
1688+ if err != nil {
1689+ return nil , err
1690+ } else if val := reflect .ValueOf (transformedLdap ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1691+ transformed ["ldap" ] = transformedLdap
1692+ }
1693+
1694+ return transformed , nil
1695+ }
1696+
1697+ func expandFilestoreInstanceDirectoryServicesLdap (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1698+ l := v .([]interface {})
1699+ if len (l ) == 0 || l [0 ] == nil {
1700+ return nil , nil
1701+ }
1702+ raw := l [0 ]
1703+ original := raw .(map [string ]interface {})
1704+ transformed := make (map [string ]interface {})
1705+
1706+ transformedDomain , err := expandFilestoreInstanceDirectoryServicesLdapDomain (original ["domain" ], d , config )
1707+ if err != nil {
1708+ return nil , err
1709+ } else if val := reflect .ValueOf (transformedDomain ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1710+ transformed ["domain" ] = transformedDomain
1711+ }
1712+
1713+ transformedServers , err := expandFilestoreInstanceDirectoryServicesLdapServers (original ["servers" ], d , config )
1714+ if err != nil {
1715+ return nil , err
1716+ } else if val := reflect .ValueOf (transformedServers ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1717+ transformed ["servers" ] = transformedServers
1718+ }
1719+
1720+ transformedUsersOu , err := expandFilestoreInstanceDirectoryServicesLdapUsersOu (original ["users_ou" ], d , config )
1721+ if err != nil {
1722+ return nil , err
1723+ } else if val := reflect .ValueOf (transformedUsersOu ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1724+ transformed ["usersOu" ] = transformedUsersOu
1725+ }
1726+
1727+ transformedGroupsOu , err := expandFilestoreInstanceDirectoryServicesLdapGroupsOu (original ["groups_ou" ], d , config )
1728+ if err != nil {
1729+ return nil , err
1730+ } else if val := reflect .ValueOf (transformedGroupsOu ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1731+ transformed ["groupsOu" ] = transformedGroupsOu
1732+ }
1733+
1734+ return transformed , nil
1735+ }
1736+
1737+ func expandFilestoreInstanceDirectoryServicesLdapDomain (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1738+ return v , nil
1739+ }
1740+
1741+ func expandFilestoreInstanceDirectoryServicesLdapServers (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1742+ return v , nil
1743+ }
1744+
1745+ func expandFilestoreInstanceDirectoryServicesLdapUsersOu (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1746+ return v , nil
1747+ }
1748+
1749+ func expandFilestoreInstanceDirectoryServicesLdapGroupsOu (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1750+ return v , nil
1751+ }
1752+
15621753func expandFilestoreInstanceEffectiveLabels (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (map [string ]string , error ) {
15631754 if v == nil {
15641755 return map [string ]string {}, nil
0 commit comments