Skip to content

Commit

Permalink
Add nil check for skuProperties...
Browse files Browse the repository at this point in the history
  • Loading branch information
WodansSon committed Oct 11, 2023
1 parent 41449d4 commit 7867f0a
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,14 @@ func (r ManagedLustreFileSystemResource) CustomizeDiff() sdk.ResourceFunc {
configCapacity := metadata.ResourceDiff.Get("storage_capacity_in_tb")
skuProperties := GetSkuPropertiesByName(configSku.(string))

if configCapacity.(int) < skuProperties.MinimumStorage {
return fmt.Errorf("'storage_capacity_in_tb' field cannot be less than '%d' for the %q sku, got '%d'", skuProperties.MinimumStorage, configSku, configCapacity)
}
if skuProperties != nil {
if configCapacity.(int) < skuProperties.MinimumStorage {
return fmt.Errorf("'storage_capacity_in_tb' field cannot be less than '%d' for the %q sku, got '%d'", skuProperties.MinimumStorage, configSku, configCapacity)
}

if configCapacity.(int)%skuProperties.MinimumStorage != 0 {
return fmt.Errorf("'storage_capacity_in_tb' field must be defined in increments of '%d' for the %q sku, got '%d'", skuProperties.MinimumStorage, configSku, configCapacity)
if configCapacity.(int)%skuProperties.MinimumStorage != 0 {
return fmt.Errorf("'storage_capacity_in_tb' field must be defined in increments of '%d' for the %q sku, got '%d'", skuProperties.MinimumStorage, configSku, configCapacity)
}
}

return nil
Expand Down

0 comments on commit 7867f0a

Please sign in to comment.