Skip to content

Commit 7087d9a

Browse files
committed
Update: re-use project
1 parent 0ab9c98 commit 7087d9a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

cloudstack/data_source_cloudstack_vpc.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ 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-
4540
//Computed values
4641
"name": {
4742
Type: schema.TypeString,
@@ -71,6 +66,7 @@ func dataSourceCloudstackVPC() *schema.Resource {
7166
"project": {
7267
Type: schema.TypeString,
7368
Computed: true,
69+
Optional: true,
7470
},
7571

7672
"zone_name": {
@@ -86,9 +82,12 @@ func dataSourceCloudstackVPC() *schema.Resource {
8682
func datasourceCloudStackVPCRead(d *schema.ResourceData, meta interface{}) error {
8783
cs := meta.(*cloudstack.CloudStackClient)
8884
p := cs.VPC.NewListVPCsParams()
89-
if d.Get("projectid") != "" {
90-
p.SetProjectid(d.Get("projectid").(string))
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
9189
}
90+
9291
csVPCs, err := cs.VPC.ListVPCs(p)
9392

9493
if err != nil {

0 commit comments

Comments
 (0)