This commit is contained in:
2023-10-22 15:13:01 -04:00
parent 2e32ae4b5c
commit afebefe635
4 changed files with 66 additions and 9 deletions

57
docs/resources/server.md Normal file
View File

@@ -0,0 +1,57 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "virtfusion_server Resource - terraform-provider-virtfusion"
subcategory: ""
description: |-
Virtfusion Server Resource
---
# virtfusion_server (Resource)
Virtfusion Server Resource
## Example Usage
```terraform
resource "virtfusion_server" "node1" {
package_id = 1
user_id = 1
hypervisor_id = 1
ipv4 = 1
storage = 30
memory = 1024
cores = 1
traffic = 1000
inbound_network_speed = 100
outbound_network_speed = 100
storage_profile = 1
network_profile = 1
name = "test"
}
```
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `hypervisor_id` (Number) Hypervisor Group ID
- `package_id` (Number) Package ID
- `user_id` (Number) User ID
### Optional
- `cores` (Number) How many cores to allocate. Omit to use the default core count from the package.
- `inbound_network_speed` (Number) Inbound network speed in kB/s. Omit to use the default inbound network speed from the package.
- `ipv4` (Number) IPv4 Addresses to assign. Omit to use the default of 1 IPv4.
- `memory` (Number) How much memory to allocate in MB. Omit to use the default memory size from the package.
- `name` (String) Server name. If omitted, a random UUID will be generated.
- `network_profile` (Number) Network profile ID. Omit to use the default network profile from the package.
- `outbound_network_speed` (Number) Outbound network speed in kB/s. Omit to use the default outbound network speed from the package.
- `storage` (Number) Primary storage size in GB. Omit to use the default storage size from the package.
- `storage_profile` (Number) Storage profile ID. Omit to use the default storage profile from the package.
- `traffic` (Number) How much traffic to allocate in GB. Omit to use the default traffic size from the package. 0=Unlimited
### Read-Only
- `id` (Number) Server ID

View File

@@ -1,4 +1,4 @@
resource "virtfusion_example" "server" {
resource "virtfusion_server" "node1" {
package_id = 1
user_id = 1
hypervisor_id = 1

View File

@@ -18,7 +18,7 @@ func TestAccExampleDataSource(t *testing.T) {
{
Config: testAccExampleDataSourceConfig,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.virtfusion_example.test", "id", "example-id"),
resource.TestCheckResourceAttr("data.virtfusion_server.test", "id", "example-id"),
),
},
},
@@ -26,7 +26,7 @@ func TestAccExampleDataSource(t *testing.T) {
}
const testAccExampleDataSourceConfig = `
data "virtfusion_example" "test" {
data "virtfusion_server" "test" {
configurable_attribute = "example"
}
`

View File

@@ -19,14 +19,14 @@ func TestAccExampleResource(t *testing.T) {
{
Config: testAccExampleResourceConfig("one"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("virtfusion_example.test", "configurable_attribute", "one"),
resource.TestCheckResourceAttr("virtfusion_example.test", "defaulted", "example value when not configured"),
resource.TestCheckResourceAttr("virtfusion_example.test", "id", "example-id"),
resource.TestCheckResourceAttr("virtfusion_server.test", "configurable_attribute", "one"),
resource.TestCheckResourceAttr("virtfusion_server.test", "defaulted", "example value when not configured"),
resource.TestCheckResourceAttr("virtfusion_server.test", "id", "example-id"),
),
},
// ImportState testing
{
ResourceName: "virtfusion_example.test",
ResourceName: "virtfusion_server.test",
ImportState: true,
ImportStateVerify: true,
// This is not normally necessary, but is here because this
@@ -39,7 +39,7 @@ func TestAccExampleResource(t *testing.T) {
{
Config: testAccExampleResourceConfig("two"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("virtfusion_example.test", "configurable_attribute", "two"),
resource.TestCheckResourceAttr("virtfusion_server.test", "configurable_attribute", "two"),
),
},
// Delete testing automatically occurs in TestCase
@@ -49,7 +49,7 @@ func TestAccExampleResource(t *testing.T) {
func testAccExampleResourceConfig(configurableAttribute string) string {
return fmt.Sprintf(`
resource "virtfusion_example" "test" {
resource "virtfusion_server" "test" {
configurable_attribute = %[1]q
}
`, configurableAttribute)