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 {
6666 "project" : {
6767 Type : schema .TypeString ,
6868 Computed : true ,
69+ Optional : true ,
6970 },
7071
7172 "zone_name" : {
@@ -81,6 +82,12 @@ func dataSourceCloudstackVPC() *schema.Resource {
8182func datasourceCloudStackVPCRead (d * schema.ResourceData , meta interface {}) error {
8283 cs := meta .(* cloudstack.CloudStackClient )
8384 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+
8491 csVPCs , err := cs .VPC .ListVPCs (p )
8592
8693 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.
1414
1515``` hcl
1616data "cloudstack_vpc" "vpc-data-source"{
17+ project = "project-1"
1718 filter{
1819 name = "name"
1920 value= "test-vpc"
@@ -27,6 +28,7 @@ data "cloudstack_vpc" "vpc-data-source"{
2728### Argument Reference
2829
2930* ` 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.
3032
3133## Attributes Reference
3234
@@ -38,4 +40,4 @@ The following attributes are exported:
3840* ` vpc_offering_name ` - Vpc offering name the VPC is created from.
3941* ` network_domain ` - The network domain of the VPC.
4042* ` 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