diff --git a/cloudstack/data_source_cloudstack_zone.go b/cloudstack/data_source_cloudstack_zone.go index 39c8317c..296c887c 100644 --- a/cloudstack/data_source_cloudstack_zone.go +++ b/cloudstack/data_source_cloudstack_zone.go @@ -87,7 +87,7 @@ func dataSourceCloudstackZoneRead(d *schema.ResourceData, meta interface{}) erro } func zoneDescriptionAttributes(d *schema.ResourceData, zone *cloudstack.Zone) error { - d.SetId(zone.Name) + d.SetId(zone.Id) d.Set("name", zone.Name) d.Set("dns1", zone.Dns1) d.Set("internal_dns1", zone.Internaldns1) diff --git a/cloudstack/provider_test.go b/cloudstack/provider_test.go index c38837ac..d6726b77 100644 --- a/cloudstack/provider_test.go +++ b/cloudstack/provider_test.go @@ -67,7 +67,7 @@ func testSetIDOnResourceData(t *testing.T) { setValueOrID(&d, "id", "name", "54711781-274e-41b2-83c0-17194d0108f7") if d.Get("id").(string) != "54711781-274e-41b2-83c0-17194d0108f7" { - t.Fatal("err: 'id' doest not match '54711781-274e-41b2-83c0-17194d0108f7'") + t.Fatal("err: 'id' does not match '54711781-274e-41b2-83c0-17194d0108f7'") } } diff --git a/cloudstack/resource_cloudstack_instance.go b/cloudstack/resource_cloudstack_instance.go index f9f8d871..0c1a6bb1 100644 --- a/cloudstack/resource_cloudstack_instance.go +++ b/cloudstack/resource_cloudstack_instance.go @@ -144,7 +144,12 @@ func resourceCloudStackInstance() *schema.Resource { Optional: true, }, - "hostid": { + "host_id": { + Type: schema.TypeString, + Optional: true, + }, + + "cluster_id": { Type: schema.TypeString, Optional: true, }, @@ -333,12 +338,18 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{}) p.SetKeypair(keypair.(string)) } - // If a hostid is supplied, add it to the parameter struct + // If a host_id is supplied, add it to the parameter struct - if hostid, ok := d.GetOk("hostid"); ok { + if hostid, ok := d.GetOk("host_id"); ok { p.SetHostid(hostid.(string)) } + // If a cluster_id is supplied, add it to the parameter struct + + if clusterid, ok := d.GetOk("cluster_id"); ok { + p.SetClusterid(clusterid.(string)) + } + if userData, ok := d.GetOk("user_data"); ok { ud, err := getUserData(userData.(string), cs.HTTPGETOnly) if err != nil { diff --git a/website/docs/r/account.html.markdown b/website/docs/r/account.html.markdown new file mode 100644 index 00000000..5d555a38 --- /dev/null +++ b/website/docs/r/account.html.markdown @@ -0,0 +1,52 @@ +--- +layout: default +page_title: "CloudStack: cloudstack_account" +sidebar_current: "docs-cloudstack-resource-account" +description: |- + Creates a Account +--- + +# CloudStack: cloudstack_account + +A `cloudstack_account` resource manages an account within CloudStack. + +## Example Usage + +```hcl +resource "cloudstack_account" "example" { + email = "user@example.com" + first_name = "John" + last_name = "Doe" + password = "securepassword" + username = "jdoe" + account_type = 1 # 1 for admin, 2 for domain admin, 0 for regular user + role_id = "1234abcd" # ID of the role associated with the account +} +``` + +## Argument Reference + +The following arguments are supported: + +* `email` - (Required) The email address of the account owner. +* `first_name` - (Required) The first name of the account owner. +* `last_name` - (Required) The last name of the account owner. +* `password` - (Required) The password for the account. +* `username` - (Required) The username of the account. +* `account_type` - (Required) The account type. Possible values are `0` for regular user, `1` for admin, and `2` for domain admin. +* `role_id` - (Required) The ID of the role associated with the account. +* `account` - (Optional) The account name. If not specified, the username will be used as the account name. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the account. + +## Import + +Accounts can be imported; use `` as the import ID. For example: + +```shell +$ terraform import cloudstack_account.example +``` diff --git a/website/docs/r/disk_offering.html.markdown b/website/docs/r/disk_offering.html.markdown new file mode 100644 index 00000000..cbccf164 --- /dev/null +++ b/website/docs/r/disk_offering.html.markdown @@ -0,0 +1,47 @@ +--- +layout: default +page_title: "CloudStack: cloudstack_disk_offering" +sidebar_current: "docs-cloudstack-resource-disk_offering" +description: |- + Creates a Disk Offering +--- + +# CloudStack: cloudstack_disk_offering + +A `cloudstack_disk_offering` resource manages a disk offering within CloudStack. + +## Example Usage + +```hcl +resource "cloudstack_disk_offering" "example" { + name = "example-disk-offering" + display_text = "Example Disk Offering" + disk_size = 100 +} +``` + + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the disk offering. +* `display_text` - (Required) The display text of the disk offering. +* `disk_size` - (Required) The size of the disk offering in GB. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the disk offering. +* `name` - The name of the disk offering. +* `display_text` - The display text of the disk offering. +* `disk_size` - The size of the disk offering in GB. + +## Import + +Disk offerings can be imported; use `` as the import ID. For example: + +```shell +$ terraform import cloudstack_disk_offering.example +``` diff --git a/website/docs/r/domain.html.markdown b/website/docs/r/domain.html.markdown new file mode 100644 index 00000000..8bf9668e --- /dev/null +++ b/website/docs/r/domain.html.markdown @@ -0,0 +1,48 @@ +--- +layout: default +page_title: "CloudStack: cloudstack_domain" +sidebar_current: "docs-cloudstack-resource-domain" +description: |- + Creates a Domain +--- + +# CloudStack: cloudstack_domain + +A `cloudstack_domain` resource manages a domain within CloudStack. + +## Example Usage + +```hcl +resource "cloudstack_domain" "example" { + name = "example-domain" + network_domain = "example.local" + parent_domain_id = "ROOT" +} +``` + + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the domain. +* `domain_id` - (Optional) The ID of the domain. +* `network_domain` - (Optional) The network domain for the domain. +* `parent_domain_id` - (Optional) The ID of the parent domain. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the domain. +* `name` - The name of the domain. +* `network_domain` - The network domain for the domain. +* `parent_domain_id` - The ID of the parent domain. + +## Import + +Domains can be imported; use `` as the import ID. For example: + +```shell +$ terraform import cloudstack_domain.example +``` diff --git a/website/docs/r/instance.html.markdown b/website/docs/r/instance.html.markdown index 018b5b03..b5021cc1 100644 --- a/website/docs/r/instance.html.markdown +++ b/website/docs/r/instance.html.markdown @@ -34,6 +34,12 @@ The following arguments are supported: * `service_offering` - (Required) The name or ID of the service offering used for this instance. +* `host_id` - (Optional) destination Host ID to deploy the VM to - parameter available + for root admin only + +* `cluster_id` - (Optional) destination Cluster ID to deploy the VM to - parameter available + for root admin only + * `network_id` - (Optional) The ID of the network to connect this instance to. Changing this forces a new resource to be created. diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown new file mode 100644 index 00000000..9c3967a5 --- /dev/null +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -0,0 +1,79 @@ +--- +layout: default +page_title: "CloudStack: cloudstack_kubernetes_cluster" +sidebar_current: "docs-cloudstack-resource-kubernetes_cluster" +description: |- + Creates a Kubernetes Cluster +--- + +# CloudStack: cloudstack_kubernetes_cluster + +A `cloudstack_kubernetes_cluster` resource manages a Kubernetes cluster within CloudStack. + +## Example Usage + +```hcl +resource "cloudstack_kubernetes_cluster" "example" { + name = "example-cluster" + zone = "zone-id" + kubernetes_version = "1.18.6" + service_offering = "small" + size = 1 + autoscaling_enabled = true + min_size = 1 + max_size = 5 + control_nodes_size = 1 + description = "An example Kubernetes cluster" + keypair = "my-ssh-key" + network_id = "net-id" + state = "Running" + project = "my-project" +} +``` + + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the Kubernetes cluster. +* `zone` - (Required) The zone where the Kubernetes cluster will be deployed. +* `kubernetes_version` - (Required) The Kubernetes version for the cluster. +* `service_offering` - (Required) The service offering for the nodes in the cluster. +* `size` - (Optional) The initial size of the Kubernetes cluster. Defaults to `1`. +* `autoscaling_enabled` - (Optional) Whether autoscaling is enabled for the cluster. +* `min_size` - (Optional) The minimum size of the Kubernetes cluster when autoscaling is enabled. +* `max_size` - (Optional) The maximum size of the Kubernetes cluster when autoscaling is enabled. +* `control_nodes_size` - (Optional) The size of the control nodes in the cluster. +* `description` - (Optional) A description for the Kubernetes cluster. +* `keypair` - (Optional) The SSH key pair to use for the nodes in the cluster. +* `network_id` - (Optional) The network ID to connect the Kubernetes cluster to. +* `ip_address` - (Computed) The IP address of the Kubernetes cluster. +* `state` - (Optional) The state of the Kubernetes cluster. Defaults to `"Running"`. +* `project` - (Optional) The project to assign the Kubernetes cluster to. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the Kubernetes cluster. +* `name` - The name of the Kubernetes cluster. +* `description` - The description of the Kubernetes cluster. +* `control_nodes_size` - The size of the control nodes in the cluster. +* `size` - The size of the Kubernetes cluster. +* `autoscaling_enabled` - Whether autoscaling is enabled for the cluster. +* `min_size` - The minimum size of the Kubernetes cluster when autoscaling is enabled. +* `max_size` - The maximum size of the Kubernetes cluster when autoscaling is enabled. +* `keypair` - The SSH key pair used for the nodes in the cluster. +* `network_id` - The network ID connected to the Kubernetes cluster. +* `ip_address` - The IP address of the Kubernetes cluster. +* `state` - The state of the Kubernetes cluster. +* `project` - The project assigned to the Kubernetes cluster. + +## Import + +Kubernetes clusters can be imported; use `` as the import ID. For example: + +```shell +$ terraform import cloudstack_kubernetes_cluster.example +``` diff --git a/website/docs/r/kubernetes_version.html.markdown b/website/docs/r/kubernetes_version.html.markdown new file mode 100644 index 00000000..a3f7a0ff --- /dev/null +++ b/website/docs/r/kubernetes_version.html.markdown @@ -0,0 +1,54 @@ +--- +layout: default +page_title: "CloudStack: cloudstack_kubernetes_version" +sidebar_current: "docs-cloudstack-resource-kubernetes_version" +description: |- + Creates a Kubernetes Version +--- + +# CloudStack: cloudstack_kubernetes_version + +A `cloudstack_kubernetes_version` resource manages a Kubernetes version within CloudStack. + +## Example Usage + +```hcl +resource "cloudstack_kubernetes_version" "example" { + semantic_version = "1.19.0" + url = "https://example.com/k8s/1.19.0.tar.gz" + min_cpu = 2 + min_memory = 2048 +} +``` + +## Argument Reference + +The following arguments are supported: + +* `semantic_version` - (Required) The semantic version of the Kubernetes version. +* `url` - (Required) The URL to download the Kubernetes version package. +* `min_cpu` - (Required) The minimum CPU requirement for the Kubernetes version. +* `min_memory` - (Required) The minimum memory requirement for the Kubernetes version. +* `name` - (Optional) The name of the Kubernetes version. +* `zone` - (Optional) The zone in which the Kubernetes version should be added. +* `checksum` - (Optional) The checksum of the Kubernetes version package. +* `state` - (Optional) The state of the Kubernetes version. Defaults to "Enabled". + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the Kubernetes version. +* `semantic_version` - The semantic version of the Kubernetes version. +* `name` - The name of the Kubernetes version. +* `min_cpu` - The minimum CPU requirement for the Kubernetes version. +* `min_memory` - The minimum memory requirement for the Kubernetes version. +* `state` - The state of the Kubernetes version. + +## Import + +Kubernetes versions can be imported using the ID of the resource; use `` as the import ID. For example: + +```shell +$ terraform import cloudstack_kubernetes_version.example +``` diff --git a/website/docs/r/network_offering.html.markdown b/website/docs/r/network_offering.html.markdown new file mode 100644 index 00000000..1ef9a87c --- /dev/null +++ b/website/docs/r/network_offering.html.markdown @@ -0,0 +1,50 @@ +--- +layout: default +page_title: "CloudStack: cloudstack_network_offering" +sidebar_current: "docs-cloudstack-resource-network_offering" +description: |- + Creates a Network Offering +--- + +# CloudStack: cloudstack_network_offering + +A `cloudstack_network_offering` resource manages a network offering within CloudStack. + +## Example Usage + +```hcl +resource "cloudstack_network_offering" "example" { + name = "example-network-offering" + display_text = "Example Network Offering" + guest_ip_type = "Shared" + traffic_type = "Guest" +} +``` + + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the network offering. +* `display_text` - (Required) The display text of the network offering. +* `guest_ip_type` - (Required) The type of IP address allocation for the network offering. Possible values are "Shared" or "Isolated". +* `traffic_type` - (Required) The type of traffic for the network offering. Possible values are "Guest" or "Management". + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the network offering. +* `name` - The name of the network offering. +* `display_text` - The display text of the network offering. +* `guest_ip_type` - The type of IP address allocation for the network offering. +* `traffic_type` - The type of traffic for the network offering. + +## Import + +Network offerings can be imported; use `` as the import ID. For example: + +```shell +$ terraform import cloudstack_network_offering.example +``` diff --git a/website/docs/r/service_offering.html.markdown b/website/docs/r/service_offering.html.markdown index c94ab460..94735eb8 100644 --- a/website/docs/r/service_offering.html.markdown +++ b/website/docs/r/service_offering.html.markdown @@ -1,28 +1,25 @@ --- -layout: "cloudstack" -page_title: "CloudStack: cloudstack_service_offering" -sidebar_current: "docs-cloudstack-resource-service-offering" +layout: default +title: "CloudStack: cloudstack_service_offering" +sidebar_current: "docs-cloudstack-resource-service_offering" description: |- - Creates a service offering. + Creates a Service Offering --- -# cloudstack_service_offering +# CloudStack: cloudstack_service_offering -Creates a service offering. +A `cloudstack_service_offering` resource manages a service offering within CloudStack. ## Example Usage -Basic usage: - ```hcl -resource "cloudstack_service_offering" "default" { - name = "Small" - cpu_number = 2 - cpu_speed = 1000 - memory = 4096 +resource "cloudstack_service_offering" "example" { + name = "example-service-offering" + display_text = "Example Service Offering" } ``` + ## Argument Reference The following arguments are supported: @@ -51,10 +48,17 @@ The following arguments are supported: * `storage_type` - (Optional) The storage type of the service offering. Values are `local` and `shared`. Changing this forces a new resource to be created. - ## Attributes Reference The following attributes are exported: * `id` - The ID of the service offering. + +## Import + +Service offerings can be imported; use `` as the import ID. For example: + +```shell +$ terraform import cloudstack_service_offering.example +``` diff --git a/website/docs/r/user.html.markdown b/website/docs/r/user.html.markdown new file mode 100644 index 00000000..94949bbe --- /dev/null +++ b/website/docs/r/user.html.markdown @@ -0,0 +1,48 @@ +--- +layout: default +title: "CloudStack: cloudstack_user" +sidebar_current: "docs-cloudstack-resource-user" +description: |- + Creates a User +--- + +# CloudStack: cloudstack_user + +A `cloudstack_user` resource manages a user within CloudStack. + +## Example Usage + +```hcl +resource "cloudstack_user" "example" { + account = "example-account" + email = "user@example.com" + first_name = "John" + last_name = "Doe" + password = "securepassword" + username = "jdoe" +} +``` + + +## Argument Reference + +The following arguments are supported: + +* `account` - (Optional) The account the user belongs to. +* `email` - (Required) The email address of the user. +* `first_name` - (Required) The first name of the user. +* `last_name` - (Required) The last name of the user. +* `password` - (Required) The password for the user. +* `username` - (Required) The username of the user. + +## Attributes Reference + +No attributes are exported. + +## Import + +Users can be imported; use `` as the import ID. For example: + +```shell +$ terraform import cloudstack_user.example +``` diff --git a/website/docs/r/volume.html.markdown b/website/docs/r/volume.html.markdown new file mode 100644 index 00000000..bb83e2e7 --- /dev/null +++ b/website/docs/r/volume.html.markdown @@ -0,0 +1,45 @@ +--- +layout: default +page_title: "CloudStack: cloudstack_volume" +sidebar_current: "docs-cloudstack-resource-volume" +description: |- + Creates a Volume +--- +# CloudStack: cloudstack_volume + +A `cloudstack_volume` resource manages a volume within CloudStack. + +## Example Usage + +```hcl +resource "cloudstack_volume" "example" { + name = "example-volume" + disk_offering_id = "a6f7e5fb-1b9a-417e-a46e-7e3d715f34d3" + zone_id = "b0fcd7cc-5e14-499d-a2ff-ecf49840f1ab" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the volume. Forces new resource. +* `disk_offering_id` - (Required) The ID of the disk offering for the volume. Forces new resource. +* `zone_id` - (Required) The ID of the zone where the volume will be created. Forces new resource. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the volume. +* `name` - The name of the volume. +* `disk_offering_id` - The ID of the disk offering for the volume. +* `zone_id` - The ID of the zone where the volume resides. + +## Import + +Volumes can be imported; use `` as the import ID. For example: + +```shell +$ terraform import cloudstack_volume.example +``` diff --git a/website/docs/r/zone.html.markdown b/website/docs/r/zone.html.markdown new file mode 100644 index 00000000..58586a34 --- /dev/null +++ b/website/docs/r/zone.html.markdown @@ -0,0 +1,46 @@ +--- +layout: default +page_title: "CloudStack: cloudstack_zone" +sidebar_current: "docs-cloudstack-resource-zone" +description: |- + Creates a Zone +--- + +# CloudStack: cloudstack_zone + +A `cloudstack_zone` resource manages a zone within CloudStack. + +## Example Usage +```hcl +resource "cloudstack_zone" "example" { + name = "example-zone" + dns1 = "8.8.8.8" + internal_dns1 = "8.8.4.4" + network_type = "Basic" +} +``` +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the zone. +* `dns1` - (Required) The DNS server 1 for the zone. +* `internal_dns1` - (Required) The internal DNS server 1 for the zone. +* `network_type` - (Required) The type of network to use for the zone. + +## Attributes Reference + +The following attributes are exported: + +* `id` - The ID of the zone. +* `name` - The name of the zone. +* `dns1` - The DNS server 1 for the zone. +* `internal_dns1` - The internal DNS server 1 for the zone. +* `network_type` - The type of network to use for the zone. + +## Import + +Zones can be imported; use `` as the import ID. For example: +```shell +$ terraform import cloudstack_zone.example +```