@@ -690,7 +690,41 @@ var schemaNodePool = map[string]*schema.Schema{
690690 },
691691 },
692692 },
693-
693+
694+ " maintenance_policy" : {
695+ Type: schema.TypeList ,
696+ Optional: true,
697+ Description: ` Maintenance policy for this NodePool.` ,
698+ Elem: &schema.Resource {
699+ Schema: map[string]*schema.Schema {
700+ " exclusion_until_end_of_support" : {
701+ Type: schema.TypeList ,
702+ Optional: true,
703+ Description: ` Maintenance exclusion until the end of support.` ,
704+ Elem: &schema.Resource {
705+ Schema: map[string]*schema.Schema {
706+ " enabled" : {
707+ Type: schema.TypeBool ,
708+ Optional: true,
709+ Description: ` Whether to enable the maintenance exclusion until the end of support for this NodePool.` ,
710+ },
711+ " start_time" : {
712+ Type: schema.TypeString ,
713+ Computed: true,
714+ Description: ` Start time of the maintenance exclusion.` ,
715+ },
716+ " end_time" : {
717+ Type: schema.TypeString ,
718+ Computed: true,
719+ Description: ` End time of the maintenance exclusion.` ,
720+ },
721+ },
722+ },
723+ },
724+ },
725+ },
726+ },
727+
694728}
695729
696730type NodePoolInformation struct {
@@ -1311,6 +1345,19 @@ func expandNodePool(d *schema.ResourceData, prefix string) (*container.NodePool,
13111345 }
13121346 }
13131347
1348+ if v, ok := d.GetOk (prefix + " maintenance_policy" ); ok {
1349+ maintenancePolicy := v. ([]interface{})[0]. (map[string]interface{})
1350+ if v, ok := maintenancePolicy[" exclusion_until_end_of_support" ]; ok && len (v. ([]interface{})) > 0 {
1351+ np.MaintenancePolicy = &container.NodePoolMaintenancePolicy {
1352+ ExclusionUntilEndOfSupport: &container.ExclusionUntilEndOfSupport {},
1353+ }
1354+ exclusionUntilEndOfSupport := v. ([]interface{})[0]. (map[string]interface{})
1355+ if v, ok := exclusionUntilEndOfSupport[" enabled" ]; ok {
1356+ np.ExclusionUntilEndOfSupport.Enabled = v. (bool)
1357+ }
1358+ }
1359+ }
1360+
13141361 return np, nil
13151362}
13161363
@@ -1383,6 +1430,30 @@ func flattenNodePoolNodeDrainConfig(ndc *container.NodeDrainConfig) []map[string
13831430 return []map[string]interface{}{nodeDrainConfig}
13841431}
13851432
1433+ func flattenExlusionUntilEndOfSupport(ex *container.ExclusionUntilEndOfSupport ) []map[string]interface{} {
1434+ if ex == nil {
1435+ return nil
1436+ }
1437+ return []map[string]interface{}{
1438+ {
1439+ " enabled" : ex.Enabled ,
1440+ " start_time" : ex.StartTime ,
1441+ " end_time" : ex.EndTime ,
1442+ },
1443+ }
1444+ }
1445+
1446+ func flattenNodePoolMaintenancePolicy(mp *container.NodePoolMaintenancePolicy ) []map[string]interface{} {
1447+ if mp == nil {
1448+ return nil
1449+ }
1450+
1451+ maintenancePolicy := make(map[string]interface{})
1452+
1453+ maintenancePolicy[" exclusion_until_end_of_support" ] = flattenExlusionUntilEndOfSupport(mp.ExclusionUntilEndOfSupport )
1454+ return []map[string]interface{}{maintenancePolicy}
1455+ }
1456+
13861457func flattenNodePool(d *schema.ResourceData , config *transport_tpg.Config , np *container.NodePool , prefix string) (map[string]interface{}, error) {
13871458 userAgent, err := tpgresource.GenerateUserAgentString (d, config.UserAgent )
13881459 if err != nil {
@@ -1491,6 +1562,10 @@ func flattenNodePool(d *schema.ResourceData, config *transport_tpg.Config, np *c
14911562 nodePool[" node_drain_config" ] = flattenNodePoolNodeDrainConfig(np.NodeDrainConfig )
14921563 }
14931564
1565+ if np.MaintenancePolicy != nil {
1566+ nodePool[" maintenance_policy" ] = flattenNodePoolMaintenancePolicy(np.MaintenancePolicy )
1567+ }
1568+
14941569 return nodePool, nil
14951570}
14961571
0 commit comments