Skip to content

Commit 434d075

Browse files
committed
docs(index.md.tmpl): update YAML header and example usage
1 parent 00a9b46 commit 434d075

File tree

3 files changed

+105
-3
lines changed

3 files changed

+105
-3
lines changed

docs/index.md

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ description: |-
66
It provides a seamless integration with Terraform, enabling you to define and manage your cloud infrastructure as code.
77
---
88

9-
# zstack Provider
9+
# ZStack Provider
1010

1111

1212

1313
The ZStack provider is designed to manage resources in a ZStack Cloud environment.
1414
It provides a way to interact with ZStack's API to create, update, and delete resources such as virtual machines, networks, storage, and more.
1515
This provider is ideal for organizations looking to automate their cloud infrastructure management using Terraform.
1616

17-
1817
## Example Usage
1918

2019
To use the ZStack provider, you need to configure it with the necessary credentials and endpoint information. Login ZStack Cloud, Operation Management -> Access Control -> AccessKey Management, Click Generate AccessKey
@@ -23,11 +22,63 @@ Below is an example configuration:
2322
```terraform
2423
# Copyright (c) ZStack.io, Inc.
2524
25+
# Configure the ZStack provider with the necessary credentials and endpoint information.
26+
# - `host`: The IP address or domain name of the ZStack Cloud API endpoint.
27+
# - `access_key_id`: The Access Key ID for authenticating with ZStack Cloud.
28+
# - `access_key_secret`: The Access Key Secret for authenticating with ZStack Cloud.
29+
2630
provider "zstack" {
2731
host = "ip address of zstack cloud api endpoint"
2832
access_key_id = "access_key_id of zstack cloud"
2933
access_key_secret = "access_key_secret of zstack cloud"
3034
}
35+
36+
# Fetch the details of an image from ZStack Cloud by its name.
37+
# - `name`: The name of the image to retrieve.
38+
data "zstack_images" "centos" {
39+
name = "Image-1"
40+
}
41+
42+
# Fetch the details of an L3 network from ZStack Cloud by its name.
43+
# - `name`: The name of the L3 network to retrieve.
44+
data "zstack_l3networks" "l3networks" {
45+
name = "L3Network-1"
46+
}
47+
48+
# Fetch the details of an instance offering from ZStack Cloud by its name.
49+
# - `name`: The name of the instance offering to retrieve.
50+
data "zstack_instance_offers" "offer" {
51+
name = "InstanceOffering-1"
52+
}
53+
54+
# Create a new virtual machine instance in ZStack Cloud.
55+
# - `name`: The name of the virtual machine.
56+
# - `image_uuid`: The UUID of the image to use for the virtual machine.
57+
# - `l3_network_uuids`: A list of L3 network UUIDs to attach to the virtual machine.
58+
# - `description`: A description of the virtual machine.
59+
# - `instance_offering_uuid`: The UUID of the instance offering to use for the virtual machine.
60+
# - `memory_size`: (Optional) The memory size in bytes. If not specified, the instance offering's memory size will be used.
61+
# - `cpu_num`: (Optional) The number of CPUs. If not specified, the instance offering's CPU count will be used.
62+
# - `never_stop`: If set to `true`, the virtual machine will never be stopped.
63+
# - `root_disk`: Configuration for the root disk of the virtual machine.
64+
resource "zstack_instance" "example_vm" {
65+
name = "moexample-v"
66+
image_uuid = data.zstack_images.centos.images[0].uuid
67+
l3_network_uuids = [data.zstack_l3networks.l3networks.l3networks[0].uuid]
68+
description = "Example VM instance"
69+
instance_offering_uuid = data.zstack_instance_offers.offer.instance_offers[0].uuid # Using Instance offering UUID or custom CPU and memory
70+
# memory_size = 1024000000
71+
# cpu_num = 1
72+
never_stop = true
73+
root_disk = {
74+
size = 123456788
75+
}
76+
}
77+
78+
# Output the details of the created virtual machine instance.
79+
output "zstack_instance" {
80+
value = zstack_instance.example_vm
81+
}
3182
```
3283

3384
<!-- schema generated by tfplugindocs -->
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,59 @@
11
# Copyright (c) ZStack.io, Inc.
22

3+
# Configure the ZStack provider with the necessary credentials and endpoint information.
4+
# - `host`: The IP address or domain name of the ZStack Cloud API endpoint.
5+
# - `access_key_id`: The Access Key ID for authenticating with ZStack Cloud.
6+
# - `access_key_secret`: The Access Key Secret for authenticating with ZStack Cloud.
7+
38
provider "zstack" {
49
host = "ip address of zstack cloud api endpoint"
510
access_key_id = "access_key_id of zstack cloud"
611
access_key_secret = "access_key_secret of zstack cloud"
712
}
13+
14+
# Fetch the details of an image from ZStack Cloud by its name.
15+
# - `name`: The name of the image to retrieve.
16+
data "zstack_images" "centos" {
17+
name = "Image-1"
18+
}
19+
20+
# Fetch the details of an L3 network from ZStack Cloud by its name.
21+
# - `name`: The name of the L3 network to retrieve.
22+
data "zstack_l3networks" "l3networks" {
23+
name = "L3Network-1"
24+
}
25+
26+
# Fetch the details of an instance offering from ZStack Cloud by its name.
27+
# - `name`: The name of the instance offering to retrieve.
28+
data "zstack_instance_offers" "offer" {
29+
name = "InstanceOffering-1"
30+
}
31+
32+
# Create a new virtual machine instance in ZStack Cloud.
33+
# - `name`: The name of the virtual machine.
34+
# - `image_uuid`: The UUID of the image to use for the virtual machine.
35+
# - `l3_network_uuids`: A list of L3 network UUIDs to attach to the virtual machine.
36+
# - `description`: A description of the virtual machine.
37+
# - `instance_offering_uuid`: The UUID of the instance offering to use for the virtual machine.
38+
# - `memory_size`: (Optional) The memory size in bytes. If not specified, the instance offering's memory size will be used.
39+
# - `cpu_num`: (Optional) The number of CPUs. If not specified, the instance offering's CPU count will be used.
40+
# - `never_stop`: If set to `true`, the virtual machine will never be stopped.
41+
# - `root_disk`: Configuration for the root disk of the virtual machine.
42+
resource "zstack_instance" "example_vm" {
43+
name = "moexample-v"
44+
image_uuid = data.zstack_images.centos.images[0].uuid
45+
l3_network_uuids = [data.zstack_l3networks.l3networks.l3networks[0].uuid]
46+
description = "Example VM instance"
47+
instance_offering_uuid = data.zstack_instance_offers.offer.instance_offers[0].uuid # Using Instance offering UUID or custom CPU and memory
48+
# memory_size = 1024000000
49+
# cpu_num = 1
50+
never_stop = true
51+
root_disk = {
52+
size = 123456788
53+
}
54+
}
55+
56+
# Output the details of the created virtual machine instance.
57+
output "zstack_instance" {
58+
value = zstack_instance.example_vm
59+
}

templates/index.md.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ The ZStack provider is designed to manage resources in a ZStack Cloud environmen
1414
It provides a way to interact with ZStack's API to create, update, and delete resources such as virtual machines, networks, storage, and more.
1515
This provider is ideal for organizations looking to automate their cloud infrastructure management using Terraform.
1616

17-
1817
## Example Usage
1918

2019
To use the ZStack provider, you need to configure it with the necessary credentials and endpoint information. Login ZStack Cloud, Operation Management -> Access Control -> AccessKey Management, Click Generate AccessKey

0 commit comments

Comments
 (0)