diff --git a/README.md b/README.md index d661623..8ede3bf 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ See docs directory If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above). -The Cudo API client is generated in the cudo-compute-market repo using the "make tf" command, copy the generated "compute" folder from cudo-compute-market/clients/go-grpc/ to terraform-provider-cudo/internal/. +The Cudo API client is generated in the cudo-compute-market repo using the `make tf` command, copy the generated "compute" folder from cudo-compute-market/clients/go-grpc/ to terraform-provider-cudo/internal/. To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory. diff --git a/docs/data-sources/storage_disk.md b/docs/data-sources/storage_disk.md new file mode 100644 index 0000000..57725da --- /dev/null +++ b/docs/data-sources/storage_disk.md @@ -0,0 +1,35 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cudo_storage_disk Data Source - terraform-provider-cudo" +subcategory: "" +description: |- + Disk data source +--- + +# cudo_storage_disk (Data Source) + +Disk data source + +## Example Usage + +```terraform +data "cudo_storage_disk" "storage_disk_datasource" { + id = "my-disk" +} +``` + + +## Schema + +### Required + +- `id` (String) Storage disk ID. + +### Optional + +- `project_id` (String) The unique identifier of the project the disk is in. + +### Read-Only + +- `data_center_id` (String) The unique identifier of the datacenter where the disk is located. +- `size_gib` (Number) Size of the storage disk in GiB diff --git a/docs/resources/storage_disk.md b/docs/resources/storage_disk.md new file mode 100644 index 0000000..39bcbeb --- /dev/null +++ b/docs/resources/storage_disk.md @@ -0,0 +1,34 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cudo_storage_disk Resource - terraform-provider-cudo" +subcategory: "" +description: |- + Storage disk resource +--- + +# cudo_storage_disk (Resource) + +Storage disk resource + +## Example Usage + +```terraform +resource "cudo_storage_disk" "my-storage-disk" { + data_center_id = "gb-bournemouth-1" + id = "my-disk" + size_gib = 100 +} +``` + + +## Schema + +### Required + +- `data_center_id` (String) The unique identifier of the datacenter where the disk is located. +- `id` (String) The unique identifier of the storage disk +- `size_gib` (Number) Size of the storage disk in GiB + +### Optional + +- `project_id` (String) The project the storage disk is in. diff --git a/docs/resources/vm.md b/docs/resources/vm.md index cc46b60..490d751 100644 --- a/docs/resources/vm.md +++ b/docs/resources/vm.md @@ -30,8 +30,15 @@ resource "cudo_vm" "my-vm-max-price" { ] } +resource "cudo_storage_disk" "my-storage-disk" { + data_center_id = "gb-bournemouth-1" + id = "my-disk" + size_gib = 100 +} + # pick a specific data center and machine type resource "cudo_vm" "my-vm" { + depends_on = [cudo_storage_disk.my-storage-disk] id = "terra-vm-1" machine_type = "standard" data_center_id = "gb-bournemouth-1" @@ -41,6 +48,11 @@ resource "cudo_vm" "my-vm" { image_id = "debian-11" size_gib = 50 } + storage_disks = [ + { + disk_id = "my-disk" + } + ] ssh_key_source = "project" start_script = < +### Nested Schema for `storage_disks` + +Required: + +- `disk_id` (String) ID of storage disk to attach to vm diff --git a/examples/data-sources/cudo_storage_disk/data-source.tf b/examples/data-sources/cudo_storage_disk/data-source.tf new file mode 100644 index 0000000..5595074 --- /dev/null +++ b/examples/data-sources/cudo_storage_disk/data-source.tf @@ -0,0 +1,3 @@ +data "cudo_storage_disk" "storage_disk_datasource" { + id = "my-disk" +} \ No newline at end of file diff --git a/examples/resources/cudo_storage_disk/resource.tf b/examples/resources/cudo_storage_disk/resource.tf new file mode 100644 index 0000000..7c48074 --- /dev/null +++ b/examples/resources/cudo_storage_disk/resource.tf @@ -0,0 +1,5 @@ +resource "cudo_storage_disk" "my-storage-disk" { + data_center_id = "gb-bournemouth-1" + id = "my-disk" + size_gib = 100 +} \ No newline at end of file diff --git a/examples/resources/cudo_vm/resource.tf b/examples/resources/cudo_vm/resource.tf index 94dddf8..8dd84a4 100644 --- a/examples/resources/cudo_vm/resource.tf +++ b/examples/resources/cudo_vm/resource.tf @@ -15,8 +15,15 @@ resource "cudo_vm" "my-vm-max-price" { ] } +resource "cudo_storage_disk" "my-storage-disk" { + data_center_id = "gb-bournemouth-1" + id = "my-disk" + size_gib = 100 +} + # pick a specific data center and machine type resource "cudo_vm" "my-vm" { + depends_on = [cudo_storage_disk.my-storage-disk] id = "terra-vm-1" machine_type = "standard" data_center_id = "gb-bournemouth-1" @@ -26,6 +33,11 @@ resource "cudo_vm" "my-vm" { image_id = "debian-11" size_gib = 50 } + storage_disks = [ + { + disk_id = "my-disk" + } + ] ssh_key_source = "project" start_script = <