Skip to content

Commit

Permalink
Revert "fix(ocean/aws): fixed deletion of autoscale_headroom object…
Browse files Browse the repository at this point in the history
…s and it's attributes. (#543)" (#546)
  • Loading branch information
chandra1-n committed May 16, 2024
1 parent 78c5500 commit bc76ac9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Unreleased

## 1.172.2 (May, 17 2024)
BUG FIXES:
* resource/spotinst_ocean_aws: reverting th fix done for `autoscale_headroom` block.

## 1.172.1 (May, 16 2024)
BUG FIXES:
* resource/spotinst_ocean_aws: Fixed disabling of `autoscale_headroom` object and its attributes in cluster config under `autoscaler`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,20 @@ func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) {
string(CPUPerUnit): {
Type: schema.TypeInt,
Optional: true,
Default: -1,
},

string(GPUPerUnit): {
Type: schema.TypeInt,
Optional: true,
Default: -1,
},
string(MemoryPerUnit): {
Type: schema.TypeInt,
Optional: true,
Default: -1,
},

string(NumOfUnits): {
Type: schema.TypeInt,
Optional: true,
Default: -1,
},
},
},
Expand Down Expand Up @@ -213,7 +209,7 @@ func expandAutoscaler(data interface{}, nullify bool) (*aws.AutoScaler, error) {
if headroom != nil {
autoscaler.SetHeadroom(headroom)
} else {
autoscaler.SetHeadroom(nil)
autoscaler.Headroom = nil
}
}

Expand Down Expand Up @@ -284,26 +280,18 @@ func expandOceanAWSAutoScalerHeadroom(data interface{}) (*aws.AutoScalerHeadroom

if v, ok := m[string(CPUPerUnit)].(int); ok && v >= 0 {
headroom.SetCPUPerUnit(spotinst.Int(v))
} else {
headroom.SetCPUPerUnit(nil)
}

if v, ok := m[string(MemoryPerUnit)].(int); ok && v >= 0 {
headroom.SetMemoryPerUnit(spotinst.Int(v))
} else {
headroom.SetMemoryPerUnit(nil)
}

if v, ok := m[string(NumOfUnits)].(int); ok && v >= 0 {
headroom.SetNumOfUnits(spotinst.Int(v))
} else {
headroom.SetNumOfUnits(nil)
}

if v, ok := m[string(GPUPerUnit)].(int); ok && v >= 0 {
headroom.SetGPUPerUnit(spotinst.Int(v))
} else {
headroom.SetGPUPerUnit(nil)
}
}
return headroom, nil
Expand Down

0 comments on commit bc76ac9

Please sign in to comment.