Skip to content

Commit 996ae9d

Browse files
committed
docs: generate docs for datasource filter feature
1 parent 57ff44a commit 996ae9d

File tree

28 files changed

+120
-47
lines changed

28 files changed

+120
-47
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright (c) ZStack.io, Inc.
2+
13
stages:
24
- build
35

docs/data-sources/backupstorages.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ List all backup storages, or query backup storages by exact name match, or query
1717
data "zstack_backupstorages" "example" {
1818
# name = "backupstorage name"
1919
# name_pattern = "image%" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
20+
filter = { # option
21+
Status = "Connected"
22+
State = "Enabled"
23+
}
2024
}
2125
2226
output "zstack_imagestorages" {
@@ -29,6 +33,7 @@ output "zstack_imagestorages" {
2933

3034
### Optional
3135

36+
- `filter` (Map of String) Key-value pairs to filter image Storages. For example, to filter by status, use `Status = "Connected"`.
3237
- `name` (String) Exact name for searching backup storage.
3338
- `name_pattern` (String) Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
3439

docs/data-sources/clusters.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ Fetches a list of clusters and their associated attributes.
1717
data "zstack_clusters" "example" {
1818
#name = "cluster1"
1919
#name_pattern = "clu%" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
20+
filter = { # option
21+
State = "Enabled"
22+
HypervisorType = "KVM"
23+
Architecture = "x86_64"
24+
}
2025
}
2126
2227
output "zstack_clusters" {
@@ -29,6 +34,7 @@ output "zstack_clusters" {
2934

3035
### Optional
3136

37+
- `filter` (Map of String) Key-value pairs to filter Clusters. For example, to filter by CPU Architecture, use `Architecture = "x86_64"`.
3238
- `name` (String) Exact name for searching Cluster
3339
- `name_pattern` (String) Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
3440

docs/data-sources/disk_offers.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Fetches a list of disk offers and their associated attributes from the ZStack en
1717
data "zstack_disk_offers" "example" {
1818
name = "smallDiskOffering"
1919
# name_pattern = "sm%" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
20+
filter = { # option
21+
State = "Enabled"
22+
}
2023
}
2124
2225
output "zstack_disk_offers" {
@@ -29,6 +32,7 @@ output "zstack_disk_offers" {
2932

3033
### Optional
3134

35+
- `filter` (Map of String) Key-value pairs to filter disk offering. For example, to filter by State, use `State = "Enabled"`.
3236
- `name` (String) Exact name for searching disk offer
3337
- `name_pattern` (String) Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
3438

docs/data-sources/hosts.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ Fetches a list of hosts and their associated attributes from the ZStack environm
1717
data "zstack_images" "example" {
1818
# name = "imageName"
1919
# name_pattern = "hostname%" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
20+
filter = {
21+
Status = "Ready"
22+
State = "Enabled"
23+
Platform = "Linux"
24+
Architecture = "x86_64"
25+
}
2026
}
2127
22-
23-
2428
output "zstack_images" {
2529
value = data.zstack_images.example
2630
}
@@ -31,6 +35,7 @@ output "zstack_images" {
3135

3236
### Optional
3337

38+
- `filter` (Map of String) Key-value pairs to filter hosts. For example, to filter by State, use `State = "Enabled"`.
3439
- `name` (String) Exact name for searching hosts
3540
- `name_pattern` (String) Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
3641

docs/data-sources/images.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ Fetches a list of images and their associated attributes from the ZStack environ
1717
data "zstack_hosts" "example" {
1818
# name = "hostname"
1919
# name_pattern = "hostname%" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
20+
filter = { # option
21+
State = "Enabled"
22+
Status = "Connected"
23+
HypervisorType = "KVM"
24+
Architecture = "x86_64"
25+
TotalCpuCapacity = "480"
26+
ManagementIp = "172.30.3.4"
27+
}
2028
}
2129
2230
output "zstack_hosts" {
@@ -29,6 +37,7 @@ output "zstack_hosts" {
2937

3038
### Optional
3139

40+
- `filter` (Map of String) Key-value pairs to filter images. For example, to filter by status, use `Status = "Ready"`.
3241
- `name` (String) Exact name for searching images
3342
- `name_pattern` (String) Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
3443

docs/data-sources/instance_offers.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ Fetches a list of instance offers and their associated attributes from the ZStac
1515
# Copyright (c) ZStack.io, Inc.
1616
1717
data "zstack_instance_offers" "example" {
18-
18+
# name = "InstanceOffering-1"
19+
# name_pattern = "clu%" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
20+
filter = { # option
21+
State = "Enabled"
22+
}
1923
}
2024
2125
output "zstack_instance_offers" {
@@ -28,6 +32,7 @@ output "zstack_instance_offers" {
2832

2933
### Optional
3034

35+
- `filter` (Map of String) Key-value pairs to filter instance offering. For example, to filter by State, use `State = "Enabled"`.
3136
- `name` (String) Exact name for searching instance offer
3237
- `name_pattern` (String) Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
3338

docs/data-sources/instances.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Fetches a list of VM instances and their associated attributes from the ZStack e
1717
data "zstack_instances" "vminstances" {
1818
# name = "name of vm instance"
1919
# name_pattern = "virtual machine instances name% Pattern" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
20+
filter = { # option
21+
State = "Running"
22+
CPUNum = "3"
23+
}
2024
}
2125
2226
@@ -30,6 +34,7 @@ output "zstack_vminstances" {
3034

3135
### Optional
3236

37+
- `filter` (Map of String) Key-value pairs to filter instance . For example, to filter by State, use `State = "Running"`.
3338
- `name` (String) Exact name for searching VM instance
3439
- `name_pattern` (String) Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
3540

docs/data-sources/l2networks.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ Fetches a list of L2 networks and their associated attributes from the ZStack en
1616
1717
data "zstack_l2networks" "networks" {
1818
# name = "L2 networks name"
19-
# name_pattern = "L2 networks name% Pattern" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
19+
# name_pattern = "L2 networks name% Pattern" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
20+
filter = {
21+
Vlan = 36
22+
Type = "L2VlanNetwork"
23+
}
2024
}
2125
2226
output "zstack_l2networks" {
@@ -29,6 +33,7 @@ output "zstack_l2networks" {
2933

3034
### Optional
3135

36+
- `filter` (Map of String) Key-value pairs to filter L2 networks . For example, to filter by Vlan, use `Vlan = "2"`.
3237
- `name` (String) Exact name for searching L2 Network.
3338
- `name_pattern` (String) Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
3439

docs/data-sources/l3networks.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Fetches a list of L3 networks and their associated attributes from the ZStack en
1717
data "zstack_l3networks" "networks" {
1818
# name = "L3 networks name"
1919
# name_pattern = "L3 networks name% Pattern" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
20+
filter = {
21+
Category = "Private"
22+
IpVersion = 6
23+
}
2024
}
2125
2226
output "zstack_networks" {
@@ -29,6 +33,7 @@ output "zstack_networks" {
2933

3034
### Optional
3135

36+
- `filter` (Map of String) Key-value pairs to filter L3 networks . For example, to filter by Category, use `Category = "Private"`.
3237
- `name` (String) Exact name for searching L3 Network.
3338
- `name_pattern` (String) Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
3439

0 commit comments

Comments
 (0)