Skip to content

Commit 0ab9c98

Browse files
committed
data: get vpc in project by projectid
1 parent ed7ac8c commit 0ab9c98

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cloudstack/data_source_cloudstack_vpc.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ func dataSourceCloudstackVPC() *schema.Resource {
3737
Schema: map[string]*schema.Schema{
3838
"filter": dataSourceFiltersSchema(),
3939

40+
"projectid": {
41+
Type: schema.TypeString,
42+
Optional: true,
43+
},
44+
4045
//Computed values
4146
"name": {
4247
Type: schema.TypeString,
@@ -81,6 +86,9 @@ func dataSourceCloudstackVPC() *schema.Resource {
8186
func datasourceCloudStackVPCRead(d *schema.ResourceData, meta interface{}) error {
8287
cs := meta.(*cloudstack.CloudStackClient)
8388
p := cs.VPC.NewListVPCsParams()
89+
if d.Get("projectid") != "" {
90+
p.SetProjectid(d.Get("projectid").(string))
91+
}
8492
csVPCs, err := cs.VPC.ListVPCs(p)
8593

8694
if err != nil {

0 commit comments

Comments
 (0)