File tree Expand file tree Collapse file tree 10 files changed +60
-72
lines changed
data-sources/backupstorages Expand file tree Collapse file tree 10 files changed +60
-72
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ data "zstack_backupstorages" "example" {
3333}
3434
3535output "zstack_imagestorages" {
36- value = data.zstack_backupstorage .example
36+ value = data.zstack_backupstorages .example
3737}
3838```
3939
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ Fetches a list of hosts and their associated attributes from the ZStack environm
1212## Example Usage
1313
1414``` terraform
15- # Copyright (c) ZStack.io, Inc.
15+ # Copyright (c) ZStack.io, Inc.
1616
17- data "zstack_images " "example" {
18- # name = "imageName "
17+ data "zstack_hosts " "example" {
18+ # name = "hostname "
1919 # name_pattern = "hostname%" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
2020 filter {
2121 name = "architecture"
@@ -27,16 +27,16 @@ data "zstack_images" "example" {
2727 }
2828 filter {
2929 name = "status"
30- values = ["Ready", "Deleted "]
30+ values = ["Disconnected "]
3131 }
3232 filter {
33- name = "guest_os_type "
34- values = ["Linux "]
33+ name = "cluster_uuid "
34+ values = ["37c25209578c495ca176f60ad0cd97fa "]
3535 }
3636}
3737
38- output "zstack_images " {
39- value = data.zstack_images .example
38+ output "zstack_hosts " {
39+ value = data.zstack_hosts .example
4040}
4141```
4242
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ Fetches a list of images and their associated attributes from the ZStack environ
1212## Example Usage
1313
1414``` terraform
15- # Copyright (c) ZStack.io, Inc.
15+ # Copyright (c) ZStack.io, Inc.
1616
17- data "zstack_hosts " "example" {
18- # name = "hostname "
17+ data "zstack_images " "example" {
18+ # name = "imageName "
1919 # name_pattern = "hostname%" # Pattern for fuzzy name search, similar to MySQL LIKE. Use % for multiple characters and _ for exactly one character.
2020 filter {
2121 name = "architecture"
@@ -27,16 +27,16 @@ data "zstack_hosts" "example" {
2727 }
2828 filter {
2929 name = "status"
30- values = ["Disconnected "]
30+ values = ["Ready", "Deleted "]
3131 }
3232 filter {
33- name = "cluster_uuid "
34- values = ["37c25209578c495ca176f60ad0cd97fa "]
33+ name = "guest_os_type "
34+ values = ["Linux "]
3535 }
3636}
3737
38- output "zstack_hosts " {
39- value = data.zstack_hosts .example
38+ output "zstack_images " {
39+ value = data.zstack_images .example
4040}
4141```
4242
Original file line number Diff line number Diff line change @@ -12,34 +12,30 @@ This resource allows you to manage virtual machine (VM) instances in ZStack. A V
1212## Example Usage
1313
1414``` terraform
15- # Copyright (c) ZStack.io, Inc.
15+ data "zstack_images" "centos" {
16+ name = "centos8"
17+ }
1618
17- data "zstack_images " "images " {
18- name = "image name "
19+ data "zstack_l3networks " "l3networks " {
20+ name = "public-net "
1921}
2022
21- data "zstack_l3network " "example " {
22- name = "network name "
23+ data "zstack_instance_offers " "offer " {
24+ name = "min "
2325}
2426
25- resource "zstack_vm" "vm" {
26- count = 2
27- name = "disk-test-${count.index + 1}"
28- description = "test"
29- image_uuid = data.zstack_images.images.images.0.uuid #"${data.zstack_images.images.images[0].uuid}" #"9b26312501614ec0b6dc731e6977dfb2"
30- l3_network_uuids = [data.zstack_l3network.example.l3networks.0.uuid]
31- root_disk = {
32- offering_uuid = "e002a969bb3041c087e355c77e997be5"
33- }
34- memory_size = 1024 # in megabytes, MB
35- data_disks = [{
36- size = 100 # in gigabytes (GB)
37- }]
38- cpu_num = 1
27+ resource "zstack_instance" "example_vm" {
28+ name = "example-v"
29+ image_uuid = data.zstack_images.centos.images[0].uuid
30+ l3_network_uuids = [data.zstack_l3networks.l3networks.l3networks[0].uuid]
31+ description = "jumper server"
32+ instance_offering_uuid = data.zstack_instance_offers.offer.instance_offers[0].uuid #using Instance offering uuid or custom cpu and memory
33+ memory_size = 4096
34+ cpu_num = 4
3935}
4036
41- output "zstack_vm " {
42- value = zstack_vm.vm
37+ output "zstack_instance " {
38+ value = zstack_instance.example_vm
4339}
4440```
4541
Original file line number Diff line number Diff line change @@ -14,8 +14,7 @@ This resource allows you to manage subnets in ZStack. A subnet is a logical subd
1414``` terraform
1515# Copyright (c) ZStack.io, Inc.
1616
17- resource "zstack_subnet" "test" {
18-
17+ resource "zstack_subnet_ip_range" "test" {
1918 l3_network_uuid = "6a7c9dd9d6e449f992a59df8c102b3ba"
2019 name = "net1"
2120 start_ip = "192.168.1.1"
@@ -24,8 +23,8 @@ resource "zstack_subnet" "test" {
2423 gateway = "192.168.100.1"
2524}
2625
27- output "zstack_subnet " {
28- value = zstack_subnet .test
26+ output "zstack_subnet_ip_range " {
27+ value = zstack_subnet_ip_range .test
2928}
3029```
3130
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ data "zstack_backupstorages" "example" {
1919}
2020
2121output "zstack_imagestorages" {
22- value = data. zstack_backupstorage . example
22+ value = data. zstack_backupstorages . example
2323}
2424
2525
Original file line number Diff line number Diff line change 1- # Copyright (c) ZStack.io, Inc.
2-
3- data "zstack_images" "images" {
4- name = " image name"
1+ data "zstack_images" "centos" {
2+ name = " centos8"
53}
64
7- data "zstack_l3network " "example " {
8- name = " network name "
5+ data "zstack_l3networks " "l3networks " {
6+ name = " public-net "
97}
108
11- resource "zstack_vm" "vm" {
12- count = 2
13- name = " disk-test-${ count . index + 1 } "
14- description = " test"
15- image_uuid = data. zstack_images . images . images . 0 . uuid # "${data.zstack_images.images.images[0].uuid}" #"9b26312501614ec0b6dc731e6977dfb2"
16- l3_network_uuids = [data . zstack_l3network . example . l3networks . 0 . uuid ]
17- root_disk = {
18- offering_uuid = " e002a969bb3041c087e355c77e997be5"
19- }
20- memory_size = 1024 # in megabytes, MB
21- data_disks = [{
22- size = 100 # in gigabytes (GB)
23- }]
24- cpu_num = 1
9+ data "zstack_instance_offers" "offer" {
10+ name = " min"
2511}
2612
27- output "zstack_vm" {
28- value = zstack_vm. vm
13+ resource "zstack_instance" "example_vm" {
14+ name = " example-v"
15+ image_uuid = data. zstack_images . centos . images [0 ]. uuid
16+ l3_network_uuids = [data . zstack_l3networks . l3networks . l3networks [0 ]. uuid ]
17+ description = " jumper server"
18+ instance_offering_uuid = data. zstack_instance_offers . offer . instance_offers [0 ]. uuid # using Instance offering uuid or custom cpu and memory
19+ memory_size = 4096
20+ cpu_num = 4
2921}
3022
31-
23+ output "zstack_instance" {
24+ value = zstack_instance. example_vm
25+ }
Original file line number Diff line number Diff line change 11# Copyright (c) ZStack.io, Inc.
22
3- resource "zstack_subnet" "test" {
4-
3+ resource "zstack_subnet_ip_range" "test" {
54 l3_network_uuid = " 6a7c9dd9d6e449f992a59df8c102b3ba"
65 name = " net1"
76 start_ip = " 192.168.1.1"
@@ -10,7 +9,7 @@ resource "zstack_subnet" "test" {
109 gateway = " 192.168.100.1"
1110}
1211
13- output "zstack_subnet " {
14- value = zstack_subnet . test
12+ output "zstack_subnet_ip_range " {
13+ value = zstack_subnet_ip_range . test
1514}
1615
Original file line number Diff line number Diff line change @@ -11,6 +11,6 @@ description: |-
1111
1212## Example Usage
1313
14- {{tffile "examples/data-sources/images /data-source.tf"}}
14+ {{tffile "examples/data-sources/hosts /data-source.tf"}}
1515
1616{{ .SchemaMarkdown }}
Original file line number Diff line number Diff line change @@ -11,6 +11,6 @@ description: |-
1111
1212## Example Usage
1313
14- {{tffile "examples/data-sources/hosts /data-source.tf"}}
14+ {{tffile "examples/data-sources/images /data-source.tf"}}
1515
1616{{ .SchemaMarkdown }}
You can’t perform that action at this time.
0 commit comments