-
Notifications
You must be signed in to change notification settings - Fork 127
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
resource/server: support boot_type #59
Conversation
👍 |
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.
A few minor 🤔 we should think about but this otherwise looks good 👍🏼
scaleway/resource_server.go
Outdated
ForceNew: true, | ||
Description: "The boot_type of the server", | ||
ValidateFunc: validateBootType, | ||
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { |
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.
Given this value would have been set to “bootscript” in the past, I think we can remove this in favour of a default value or a State migration which sets a default?
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.
Infact - is this computed?
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.
come to think about it, Computed and Optional I'd say. I'll adjust accordingly.
scaleway/resource_server.go
Outdated
Optional: true, | ||
ForceNew: true, | ||
Description: "The boot_type of the server", | ||
ValidateFunc: validateBootType, |
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.
There’s a built-in validation function provided by Terraform Core that we can use here:
validation.StringInSlice([]string{
“bootscript”,
“local”,
}, true)
Where the true stands for case sensitive
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.
nice! didn't know about this.
ty for the review @tombuildsstuff . I've updated the PR accordingly. |
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.
One minor comment but this otherwise LGTM 👍
website/docs/r/server.html.markdown
Outdated
@@ -34,6 +34,7 @@ The following arguments are supported: | |||
* `image` - (Required) base image of server | |||
* `type` - (Required) type of server | |||
* `bootscript` - (Optional) server bootscript | |||
* `boot_type` - (Optional) server boot_type (`local`, `bootscript`) |
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.
might be worth making this the boot mechanism for this server. Possible values include
bootscriptand
local`
this PR adds support for the newly introduced boot_type attribute for scaleway server resources:
valid values are
local
andbootscript
for x86_64, as well asbootscript
for arm instance types.Tests are green: