Undelete initial_node_count.

This was just deprecated recently, don't remove it.
This commit is contained in:
Paddy 2017-09-28 15:40:24 -07:00
parent a76fa3bd6a
commit 19b2a3550a

View File

@ -244,11 +244,11 @@ func resourceContainerCluster() *schema.Resource {
Elem: &schema.Resource{ Elem: &schema.Resource{
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"initial_node_count": { "initial_node_count": {
Type: schema.TypeInt, Type: schema.TypeInt,
Optional: true, Optional: true,
ForceNew: true, ForceNew: true,
Computed: true, Computed: true,
Removed: "Use node_count instead", Deprecated: "Use node_count instead",
}, },
"node_count": { "node_count": {
@ -391,7 +391,16 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
for i := 0; i < nodePoolsCount; i++ { for i := 0; i < nodePoolsCount; i++ {
prefix := fmt.Sprintf("node_pool.%d", i) prefix := fmt.Sprintf("node_pool.%d", i)
nodeCount := d.GetOk(prefix + ".node_count") nodeCount := 0
if initialNodeCount, ok := d.GetOk(prefix + ".initial_node_count"); ok {
nodeCount = initialNodeCount.(int)
}
if nc, ok := d.GetOk(prefix + ".node_count"); ok {
if nodeCount != 0 {
return fmt.Errorf("Cannot set both initial_node_count and node_count on node pool %d", i)
}
nodeCount = nc.(int)
}
if nodeCount == 0 { if nodeCount == 0 {
return fmt.Errorf("Node pool %d cannot be set with 0 node count", i) return fmt.Errorf("Node pool %d cannot be set with 0 node count", i)
} }
@ -748,10 +757,11 @@ func flattenClusterNodePools(d *schema.ResourceData, config *Config, c []*contai
size += int(igm.TargetSize) size += int(igm.TargetSize)
} }
nodePool := map[string]interface{}{ nodePool := map[string]interface{}{
"name": np.Name, "name": np.Name,
"name_prefix": d.Get(fmt.Sprintf("node_pool.%d.name_prefix", i)), "name_prefix": d.Get(fmt.Sprintf("node_pool.%d.name_prefix", i)),
"node_count": size / len(np.InstanceGroupUrls), "initial_node_count": np.InitialNodeCount,
"node_config": flattenNodeConfig(np.Config), "node_count": size / len(np.InstanceGroupUrls),
"node_config": flattenNodeConfig(np.Config),
} }
nodePools = append(nodePools, nodePool) nodePools = append(nodePools, nodePool)
} }