Skip to content

Commit

Permalink
fix(server): change tags from List to Set (#414)
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Gager <[email protected]>
  • Loading branch information
kangasta and mikegager authored Oct 10, 2023
1 parent 305cc54 commit 9758383
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
- kubernetes: remove node group maximum value validation. The maximum number of nodes (in the cluster) is determined by the cluster plan and the validation is done on the API side.

### Fixed
- **Breaking**, server: change tags from `List` to `Set`. The list order has already been ignored earlier and API does not support defining the order of tags.
- servergroup: use valid value as default for `anti_affinity_policy`.

## [2.12.0] - 2023-07-21
Expand Down
8 changes: 1 addition & 7 deletions internal/service/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,11 @@ func ResourceServer() *schema.Resource {
},
"tags": {
Description: "The server related tags",
Type: schema.TypeList,
Type: schema.TypeSet,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Optional: true,
// Suppress diff if only order of tags changes, because we cannot really control the order of tags of a server.
// This removes some unnecessary change-of-order diffs until Type is changed from TypeList to TypeSet.
DiffSuppressFunc: func(key, oldName, newName string, d *schema.ResourceData) bool {
oldTags, newTags := d.GetChange("tags")
return !tagsHasChange(oldTags, newTags)
},
},
"host": {
Description: "Use this to start the VM on a specific host. Refers to value from host -attribute. Only available for private cloud hosts",
Expand Down
2 changes: 1 addition & 1 deletion internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func WithRetry(fn func() (interface{}, error), retries int, delay time.Duration)
// ExpandStrings expands a terraform list to slice of str
func ExpandStrings(data interface{}) []string {
strSlice := []string{}
for _, s := range data.([]interface{}) {
for _, s := range data.(*schema.Set).List() {
strSlice = append(strSlice, s.(string))
}

Expand Down

0 comments on commit 9758383

Please sign in to comment.