Skip to content

Commit

Permalink
fix(ocean/aws): resolved issues with vng resource_limits (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadkesarwani committed Nov 30, 2022
1 parent da35912 commit 9b6eee7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/terraform-plugin-docs v0.5.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0
github.com/spotinst/spotinst-sdk-go v1.131.1
github.com/spotinst/spotinst-sdk-go v1.132.0
golang.org/x/lint v0.0.0-20200302205851-738671d3881b

)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spotinst/spotinst-sdk-go v1.131.1 h1:8WGvAc1PKno221aSnzc42goFwgehHw7DKBWve437IyE=
github.com/spotinst/spotinst-sdk-go v1.131.1/go.mod h1:C6mrT7+mqOgPyabacjyYTvilu8Xm96mvTvrZQhj99WI=
github.com/spotinst/spotinst-sdk-go v1.132.0 h1:oQ9pZJTP6Z3NFjMhud0TuohSybc7V+qrzxrb9G82bI8=
github.com/spotinst/spotinst-sdk-go v1.132.0/go.mod h1:C6mrT7+mqOgPyabacjyYTvilu8Xm96mvTvrZQhj99WI=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ func Setup(fieldsMap map[commons.FieldName]*commons.GenericField) {
commons.OceanAWSLaunchConfiguration,
ResourceLimits,
&schema.Schema{
Type: schema.TypeSet,
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -1995,6 +1995,10 @@ func flattenResourceLimits(resourceLimits *aws.ResourceLimits) []interface{} {
if resourceLimits != nil {
result := make(map[string]interface{})

value := spotinst.Int(-1)
result[string(MinInstanceCount)] = value
result[string(MaxInstanceCount)] = value

if resourceLimits.MaxInstanceCount != nil {
result[string(MaxInstanceCount)] = spotinst.IntValue(resourceLimits.MaxInstanceCount)
}
Expand All @@ -2018,7 +2022,7 @@ func flattenTagSelector(tagSelector *aws.TagSelector) []interface{} {
}

func expandResourceLimits(data interface{}) (*aws.ResourceLimits, error) {
if list := data.(*schema.Set).List(); len(list) > 0 {
if list := data.([]interface{}); len(list) > 0 {
resLimits := &aws.ResourceLimits{}
if list != nil && list[0] != nil {
m := list[0].(map[string]interface{})
Expand Down

0 comments on commit 9b6eee7

Please sign in to comment.