Skip to content

Commit

Permalink
fix(ocean/gcp): fixed min_size and max_size attributes to accept …
Browse files Browse the repository at this point in the history
…0. (#601)
  • Loading branch information
sharadkesarwani authored Nov 26, 2024
1 parent afe9ee6 commit d13b34b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 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.199.2 (November, 26 2024)
BUG FIXES:
* resource/spotinst_ocean_gke_import: Fixed update of attribute `min_size` and `max_size`.

## 1.199.1 (November, 26 2024)
BUG FIXES:
* resource/spotinst_ocean_aws: Fixed `max_vcpu` and `max_memory_gib` fields to accept null.
Expand Down
11 changes: 4 additions & 7 deletions spotinst/ocean_gke_import/fields_spotinst_ocean_gke_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) {
&schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error {
clusterWrapper := resourceObject.(*commons.GKEImportClusterWrapper)
Expand Down Expand Up @@ -268,8 +267,8 @@ func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) {
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error {
clusterWrapper := resourceObject.(*commons.GKEImportClusterWrapper)
cluster := clusterWrapper.GetCluster()
if v, ok := resourceData.GetOk(string(MaxSize)); ok {
cluster.Capacity.SetMaximum(spotinst.Int(v.(int)))
if v, ok := resourceData.Get(string(MaxSize)).(int); ok && v >= 0 {
cluster.Capacity.SetMaximum(spotinst.Int(v))
}
return nil
},
Expand All @@ -282,7 +281,6 @@ func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) {
&schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error {
clusterWrapper := resourceObject.(*commons.GKEImportClusterWrapper)
Expand Down Expand Up @@ -311,8 +309,8 @@ func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) {
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error {
clusterWrapper := resourceObject.(*commons.GKEImportClusterWrapper)
cluster := clusterWrapper.GetCluster()
if v, ok := resourceData.GetOk(string(MinSize)); ok {
cluster.Capacity.SetMinimum(spotinst.Int(v.(int)))
if v, ok := resourceData.Get(string(MinSize)).(int); ok && v >= 0 {
cluster.Capacity.SetMinimum(spotinst.Int(v))
}
return nil
},
Expand All @@ -325,7 +323,6 @@ func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) {
&schema.Schema{
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
func(resourceObject interface{}, resourceData *schema.ResourceData, meta interface{}) error {
clusterWrapper := resourceObject.(*commons.GKEImportClusterWrapper)
Expand Down

0 comments on commit d13b34b

Please sign in to comment.