Skip to content

Commit ef86e4e

Browse files
authored
Merge pull request #41 from ScaleComputing/docs
extend documentation
2 parents 4b63bb3 + 080778c commit ef86e4e

File tree

9 files changed

+57
-6
lines changed

9 files changed

+57
-6
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Terraform Provider HyperCore
2+
3+
This is Terraform Provider for [Scale Computing](https://www.scalecomputing.com/) [HyperCore](https://www.scalecomputing.com/sc-hypercore) product.
4+
25
## Requirements
36

47
- [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.0

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
page_title: "hypercore Provider"
44
subcategory: ""
55
description: |-
6-
6+
Terraform Provider for Scale Computing https://www.scalecomputing.com/ HyperCore https://www.scalecomputing.com/sc-hypercore product.
77
---
88

99
# hypercore Provider
1010

11-
11+
Terraform Provider for [Scale Computing](https://www.scalecomputing.com/) [HyperCore](https://www.scalecomputing.com/sc-hypercore) product.
1212

1313
## Example Usage
1414

docs/resources/disk.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
page_title: "hypercore_disk Resource - hypercore"
44
subcategory: ""
55
description: |-
6-
Hypercore disk resource to manage VM disks. To use this resource, it's recommended to set the environment variable TF_CLI_ARGS_apply="-parallelism=1" or pass the -parallelism parameter to the terraform apply.
6+
Hypercore disk resource to manage VM disks. To use this resource, it's recommended to set the environment variable TF_CLI_ARGS_apply="-parallelism=1" or pass the -parallelism parameter to the terraform apply. Removing disk from a running VM is (often) not possible. In this case it is required to shutdown the VM before disk removal.
77
---
88

99
# hypercore_disk (Resource)
1010

11-
Hypercore disk resource to manage VM disks. <br><br>To use this resource, it's recommended to set the environment variable `TF_CLI_ARGS_apply="-parallelism=1"` or pass the `-parallelism` parameter to the `terraform apply`.
11+
Hypercore disk resource to manage VM disks. <br><br>To use this resource, it's recommended to set the environment variable `TF_CLI_ARGS_apply="-parallelism=1"` or pass the `-parallelism` parameter to the `terraform apply`.<br><br> Removing disk from a running VM is (often) not possible. In this case it is required to shutdown the VM before disk removal.
1212

1313
## Example Usage
1414

docs/resources/vm.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,28 @@ page_title: "hypercore_vm Resource - hypercore"
44
subcategory: ""
55
description: |-
66
HypercoreVM resource to create a VM from a template VM
7+
A running VM might need to shutdown to apply required changes.
8+
In this case first a nice ACPI shutdown is tried.
9+
If the VM does not stop, a force shutdown is tried.
10+
In both cases the provider waits up to HC_VM_SHUTDOWN_TIMEOUT seconds for the VM to shutdown.
11+
HC_VM_SHUTDOWN_TIMEOUT dafault value is 300 seconds.
12+
HC_VM_SHUTDOWN_TIMEOUT can be changed via environ.
13+
The provider will currently try to shutdown VM only before VM delete.
714
---
815

916
# hypercore_vm (Resource)
1017

1118
HypercoreVM resource to create a VM from a template VM
1219

20+
A running VM might need to shutdown to apply required changes.
21+
In this case first a nice ACPI shutdown is tried.
22+
If the VM does not stop, a force shutdown is tried.
23+
In both cases the provider waits up to HC_VM_SHUTDOWN_TIMEOUT seconds for the VM to shutdown.
24+
HC_VM_SHUTDOWN_TIMEOUT dafault value is 300 seconds.
25+
HC_VM_SHUTDOWN_TIMEOUT can be changed via environ.
26+
27+
The provider will currently try to shutdown VM only before VM delete.
28+
1329
## Example Usage
1430

1531
```terraform
@@ -19,6 +35,15 @@ locals {
1935
vm_name = "my-vm"
2036
}
2137
38+
resource "hypercore_vm" "empty-vm" {
39+
group = "my-group"
40+
name = "empty-vm"
41+
description = "some description"
42+
43+
vcpu = 4
44+
memory = 4096 # MiB
45+
}
46+
2247
data "hypercore_vms" "clone_source_vm" {
2348
name = "source_vm"
2449
}

examples/resources/hypercore_vm/resource.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ locals {
44
vm_name = "my-vm"
55
}
66

7+
resource "hypercore_vm" "empty-vm" {
8+
group = "my-group"
9+
name = "empty-vm"
10+
description = "some description"
11+
12+
vcpu = 4
13+
memory = 4096 # MiB
14+
}
15+
716
data "hypercore_vms" "clone_source_vm" {
817
name = "source_vm"
918
}

internal/provider/hypercore_disk_resource.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ func (r *HypercoreDiskResource) Schema(ctx context.Context, req resource.SchemaR
5151
// This description is used by the documentation generator and the language server.
5252
MarkdownDescription: "" +
5353
"Hypercore disk resource to manage VM disks. <br><br>" +
54-
"To use this resource, it's recommended to set the environment variable `TF_CLI_ARGS_apply=\"-parallelism=1\"` or pass the `-parallelism` parameter to the `terraform apply`.",
54+
"To use this resource, it's recommended to set the environment variable `TF_CLI_ARGS_apply=\"-parallelism=1\"` or pass the `-parallelism` parameter to the `terraform apply`." +
55+
"<br><br> Removing disk from a running VM is (often) not possible. In this case it is required to shutdown the VM before disk removal." +
56+
"",
5557
Attributes: map[string]schema.Attribute{
5658
"id": schema.StringAttribute{
5759
Computed: true,

internal/provider/hypercore_vm_resource.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,16 @@ func (r *HypercoreVMResource) Metadata(ctx context.Context, req resource.Metadat
7878
func (r *HypercoreVMResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
7979
resp.Schema = schema.Schema{
8080
// This description is used by the documentation generator and the language server.
81-
MarkdownDescription: "HypercoreVM resource to create a VM from a template VM",
81+
MarkdownDescription: `HypercoreVM resource to create a VM from a template VM
82+
83+
A running VM might need to shutdown to apply required changes.
84+
In this case first a nice ACPI shutdown is tried.
85+
If the VM does not stop, a force shutdown is tried.
86+
In both cases the provider waits up to HC_VM_SHUTDOWN_TIMEOUT seconds for the VM to shutdown.
87+
HC_VM_SHUTDOWN_TIMEOUT dafault value is 300 seconds.
88+
HC_VM_SHUTDOWN_TIMEOUT can be changed via environ.
89+
90+
The provider will currently try to shutdown VM only before VM delete.`,
8291

8392
Attributes: map[string]schema.Attribute{
8493
"group": schema.StringAttribute{

internal/provider/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (p *HypercoreProvider) Metadata(ctx context.Context, req provider.MetadataR
4646

4747
func (p *HypercoreProvider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
4848
resp.Schema = schema.Schema{
49+
MarkdownDescription: "Terraform Provider for [Scale Computing](https://www.scalecomputing.com/) [HyperCore](https://www.scalecomputing.com/sc-hypercore) product.",
4950
Attributes: map[string]schema.Attribute{
5051
"host": schema.StringAttribute{
5152
MarkdownDescription: "Hypercore Computing host URI; can also be set with `HC_HOST` environment variable.",

internal/provider/tests/acceptance/setup/env.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
HC_VM_SHUTDOWN_TIMEOUT=30
2+
13
SOURCE_VM_UUID="97904009-1878-4881-b6df-83c85ab7dc1a"
24
EXISTING_VDISK_UUID="33c78baf-c3c6-4600-8432-9c7a2a3008ab"
35
SOURCE_VM_NAME="integration-test-vm"

0 commit comments

Comments
 (0)