Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions mmv1/third_party/tgc_next/pkg/services/container/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2556,8 +2556,15 @@ func flattenEphemeralStorageLocalSsdConfig(v interface{}) []map[string]interface
return nil
}

// Default localSsdCount to 0 if missing. The field is required in the schema,
// but the API may not return it if the value is 0.
localSsdCount := c["localSsdCount"]
if localSsdCount == nil {
localSsdCount = 0
}

transformed := map[string]interface{}{
"local_ssd_count": c["localSsdCount"],
"local_ssd_count": localSsdCount,
"data_cache_count": c["dataCacheCount"],
}

Expand Down Expand Up @@ -3300,8 +3307,15 @@ func flattenFastSocket(v interface{}) []map[string]interface{} {
if !ok {
return nil
}
// Default enabled to false if missing. The field is required in the schema,
// but the API may not return it if the value is false.
enabled, ok := c["enabled"].(bool)
if !ok {
enabled = false
}

transformed := map[string]interface{}{
"enabled": c["enabled"],
"enabled": enabled,
}

return []map[string]interface{}{transformed}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,17 @@ func flattenNodeNetworkConfig(c interface{}, d *schema.ResourceData, prefix stri
// "create_pod_range": d.Get(prefix + "network_config.0.create_pod_range"), // API doesn't return this value so we set the old one. Field is ForceNew + Required
"pod_ipv4_cidr_block": config["podIpv4CidrBlock"],
"pod_range": config["podRange"],
"enable_private_nodes": config["enablePrivateNodes"],
"pod_cidr_overprovision_config": flattenPodCidrOverprovisionConfig(config["podCidrOverprovisionConfig"]),
"network_performance_config": flattenNodeNetworkPerformanceConfig(config["networkPerformanceConfig"]),
"additional_node_network_configs": flattenAdditionalNodeNetworkConfig(config["additionalNodeNetworkConfigs"]),
"additional_pod_network_configs": flattenAdditionalPodNetworkConfig(config["additionalPodNetworkConfigs"]),
}

// enable_private_nodes = false and the field not in HCL behaves the same, as this field is in ForceSendFields and the false value is included in the API request when it is not specified in config.
// Only convert the field enable_private_nodes when its value is true in CAI asset.
if v, ok := config["enablePrivateNodes"].(bool); ok && v {
transformed["enable_private_nodes"] = v
}
return []map[string]interface{}{transformed}
}
return nil
Expand Down
Loading