File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ func dataSourceCloudstackVPC() *schema.Resource {
66
66
"project" : {
67
67
Type : schema .TypeString ,
68
68
Computed : true ,
69
+ Optional : true ,
69
70
},
70
71
71
72
"zone_name" : {
@@ -81,6 +82,12 @@ func dataSourceCloudstackVPC() *schema.Resource {
81
82
func datasourceCloudStackVPCRead (d * schema.ResourceData , meta interface {}) error {
82
83
cs := meta .(* cloudstack.CloudStackClient )
83
84
p := cs .VPC .NewListVPCsParams ()
85
+
86
+ // If there is a project supplied, we retrieve and set the project id
87
+ if err := setProjectid (p , cs , d ); err != nil {
88
+ return err
89
+ }
90
+
84
91
csVPCs , err := cs .VPC .ListVPCs (p )
85
92
86
93
if err != nil {
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ Use this datasource to get information about a vpc for use in other resources.
14
14
15
15
``` hcl
16
16
data "cloudstack_vpc" "vpc-data-source"{
17
+ project = "project-1"
17
18
filter{
18
19
name = "name"
19
20
value= "test-vpc"
@@ -27,6 +28,7 @@ data "cloudstack_vpc" "vpc-data-source"{
27
28
### Argument Reference
28
29
29
30
* ` filter ` - (Required) One or more name/value pairs to filter off of. You can apply filters on any exported attributes.
31
+ * ` project ` - (Optional) The name or ID of the project the vpc belongs to.
30
32
31
33
## Attributes Reference
32
34
@@ -38,4 +40,4 @@ The following attributes are exported:
38
40
* ` vpc_offering_name ` - Vpc offering name the VPC is created from.
39
41
* ` network_domain ` - The network domain of the VPC.
40
42
* ` project ` - The project name of the VPC.
41
- * ` zone_name ` - The name of the zone the VPC belongs to.
43
+ * ` zone_name ` - The name of the zone the VPC belongs to.
You can’t perform that action at this time.
0 commit comments