-
Notifications
You must be signed in to change notification settings - Fork 133
feat(baremetal): add support cloud-init #3478
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,56 @@ resource "scaleway_baremetal_server" "base" { | |
| } | ||
| ``` | ||
|
|
||
| ### With cloud-init | ||
|
|
||
| ```terraform | ||
| data "scaleway_iam_ssh_key" "my_ssh_key" { | ||
| name = "main" | ||
| } | ||
|
|
||
| data "scaleway_baremetal_offer" "my_offer" { | ||
| zone = "fr-par-2" | ||
| name = "EM-I220E-NVME" | ||
| } | ||
|
|
||
| resource "scaleway_baremetal_server" "my_server_ci" { | ||
| zone = "fr-par-2" | ||
| offer = data.scaleway_baremetal_offer.my_offer.offer_id | ||
| os = "d17d6872-0412-45d9-a198-af82c34d3c5c" | ||
| ssh_key_ids = [data.scaleway_iam_ssh_key.my_ssh_key.id] | ||
|
|
||
| cloud_init = file("userdata.yaml") | ||
| } | ||
| ``` | ||
|
|
||
| ```terraform | ||
| data "scaleway_iam_ssh_key" "my_ssh_key" { | ||
| name = "main" | ||
| } | ||
|
|
||
| data "scaleway_baremetal_offer" "my_offer" { | ||
| zone = "fr-par-2" | ||
| name = "EM-I220E-NVME" | ||
| } | ||
|
|
||
| resource "scaleway_baremetal_server" "my_server_ci" { | ||
| zone = "fr-par-2" | ||
| offer = data.scaleway_baremetal_offer.my_offer.offer_id | ||
| os = "d17d6872-0412-45d9-a198-af82c34d3c5c" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use a data source and no hard coded values |
||
| ssh_key_ids = [data.scaleway_iam_ssh_key.my_ssh_key.id] | ||
|
|
||
| cloud_init = <<EOF | ||
| #cloud-config | ||
| packages: | ||
| - htop | ||
| - curl | ||
|
|
||
| runcmd: | ||
| - echo "Hello from raw cloud-init!" > /home/ubuntu/message.txt | ||
| EOF | ||
| } | ||
| ``` | ||
|
|
||
| ### With private network | ||
|
|
||
| ```terraform | ||
|
|
@@ -306,6 +356,7 @@ The following arguments are supported: | |
| - `ipam_ip_ids` - (Optional) List of IPAM IP IDs to assign to the server in the requested private network. | ||
| - `zone` - (Defaults to [provider](../index.md#zone) `zone`) The [zone](../guides/regions_and_zones.md#zones) in which the server should be created. | ||
| - `partitioning` (Optional) The partitioning schema in JSON format | ||
| - `cloud_init` - (Optional) Configuration data to pass to cloud-init such as a YAML cloud config or a user-data script. Accepts either a string containing the content or a path to a file (for example `file("cloud-init.yml")`). Max length: 127998 characters. Updates to `cloud_init` will update the server user-data via the API and do not trigger a reinstall; however, a reboot of the server is required for the OS to re-run cloud-init and apply the changes. Only supported for OSes that have cloud-init enabled. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a way to see if cloud init is supported or not? |
||
| - `protected` - (Optional) Set to true to activate server protection option. | ||
| - `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the server is associated with. | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.