Skip to content
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: ephemeral deployment #218

Merged
merged 4 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/resources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Optional:

- `distro_series` (String) The distro series used to deploy the allocated MAAS machine. If it's not given, the MAAS server default value is used.
- `enable_hw_sync` (Boolean) Periodically sync hardware
- `ephemeral` (Boolean) Deploy machine in memory
- `hwe_kernel` (String) Hardware enablement kernel to use with the image. Only used when deploying Ubuntu.
- `user_data` (String) Cloud-init user data script that gets run on the machine once it has deployed. A good practice is to set this with `file("/tmp/user-data.txt")`, where `/tmp/user-data.txt` is a cloud-init script.

Expand Down
15 changes: 11 additions & 4 deletions maas/resource_maas_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ func resourceMaasInstance() *schema.Resource {
ForceNew: true,
Description: "Periodically sync hardware",
},
"ephemeral": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Description: "Deploy machine in memory",
},
"hwe_kernel": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -318,10 +324,11 @@ func getMachineDeployParams(d *schema.ResourceData) *entity.MachineDeployParams
if deployParamsData[0] != nil {
deployParams := deployParamsData[0].(map[string]interface{})
return &entity.MachineDeployParams{
DistroSeries: deployParams["distro_series"].(string),
EnableHwSync: deployParams["enable_hw_sync"].(bool),
HWEKernel: deployParams["hwe_kernel"].(string),
UserData: base64Encode([]byte(deployParams["user_data"].(string))),
DistroSeries: deployParams["distro_series"].(string),
EnableHwSync: deployParams["enable_hw_sync"].(bool),
EphemeralDeploy: deployParams["ephemeral"].(bool),
HWEKernel: deployParams["hwe_kernel"].(string),
UserData: base64Encode([]byte(deployParams["user_data"].(string))),
}
}
}
Expand Down
Loading