-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/implement volume boot order #486
Conversation
ionoscloud/resource_server.go
Outdated
inlineVolumeIds := d.Get("inline_volume_ids") | ||
|
||
if inlineVolumeIds != nil { | ||
inlineVolumeIds := inlineVolumeIds.([]interface{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very minor, but you can use any instead of interface{}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently there is mixed usage of interface{}
and any
, should we allow this or enforce one over the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can allow for now. any was added in go 1.18. maybe we do a search and replace at some point.
ionoscloud/resource_server.go
Outdated
volumes = append(volumes, entry) | ||
if err := d.Set("volume", volumes); err != nil { | ||
return fmt.Errorf("error setting volume %w", err) | ||
bootOrder := "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you just set it to AUTO here and not have the if if bootOrder == "" below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has been reworked, we will now use a boolean instead of predefined strings like 'AUTO', 'NONE', 'PRIMARY'
@@ -352,6 +360,15 @@ func resourceCubeServer() *schema.Resource { | |||
}, | |||
}, | |||
}, | |||
//Keep track of the inline volume of the Cube server in case the boot volume is changed. | |||
"inline_volume_ids": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you test an upgrade pre to after inline_volume_ids? I think we need to add something similar to resoruce_server
// takes care of an upgrade from a version that does not have inline_volume_ids(pre 6.4.0)
// to one that has it(>6.4.0)
if _, ok := d.GetOk("inline_volume_ids"); !ok {
if bootVolumeItf, ok := d.GetOk("boot_volume"); ok {
bootVolume := bootVolumeItf.(string)
var inlineVolumeIds []string
inlineVolumeIds = append(inlineVolumeIds, bootVolume)
if err := d.Set("inline_volume_ids", inlineVolumeIds); err != nil {
return utils.GenerateSetError("server", "inline_volume_ids", err)
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested upgrade from 6.3.8 to current, seems to be working fine
ionoscloud/resource_server.go
Outdated
@@ -310,6 +310,13 @@ func resourceServer() *schema.Resource { | |||
Description: "The UUID of the attached server.", | |||
Computed: true, | |||
}, | |||
"boot_order": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add this to some server tests also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added tests for server resource
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Closing this as the feature has been implemented by |
What does this fix or implement?
Ability to select the primary boot volume for
ionoscloud_server
Checklist
feat:
/fix:
/doc:
/test:
/refactor:
)