Skip to content

Commit 20e2369

Browse files
Merge pull request #344 from wilsonandvmware/add-custom-properties
[issue-291] Add Custom properties in resourceProject
2 parents 22e3a85 + d45f571 commit 20e2369

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

vra/data_source_project.go

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ func dataSourceProject() *schema.Resource {
3636
},
3737
},
3838
},
39+
"custom_properties": {
40+
Type: schema.TypeMap,
41+
Optional: true,
42+
Description: "The project custom properties which are added to all requests in this project",
43+
},
3944
"description": {
4045
Type: schema.TypeString,
4146
Optional: true,
@@ -150,6 +155,7 @@ func dataSourceProjectRead(d *schema.ResourceData, meta interface{}) error {
150155
d.SetId(*project.ID)
151156
d.Set("administrators", flattenUserList(project.Administrators))
152157
d.Set("constraints", flattenProjectConstraints(project.Constraints))
158+
d.Set("custom_properties", project.CustomProperties)
153159
d.Set("description", project.Description)
154160
d.Set("machine_naming_template", project.MachineNamingTemplate)
155161
d.Set("members", flattenUserList(project.Members))

vra/resource_project.go

+10
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ func resourceProject() *schema.Resource {
3838
},
3939
},
4040
},
41+
"custom_properties": {
42+
Type: schema.TypeMap,
43+
Optional: true,
44+
Description: "The project custom properties which are added to all requests in this project",
45+
},
4146
"description": {
4247
Type: schema.TypeString,
4348
Optional: true,
@@ -128,6 +133,7 @@ func resourceProjectCreate(d *schema.ResourceData, m interface{}) error {
128133

129134
administrators := expandUserList(d.Get("administrators").(*schema.Set).List())
130135
constraints := expandProjectConstraints(d.Get("constraints").(*schema.Set).List())
136+
customProperties := expandCustomProperties(d.Get("custom_properties").(map[string]interface{}))
131137
description := d.Get("description").(string)
132138
machineNamingTemplate := d.Get("machine_naming_template").(string)
133139
members := expandUserList(d.Get("members").(*schema.Set).List())
@@ -140,6 +146,7 @@ func resourceProjectCreate(d *schema.ResourceData, m interface{}) error {
140146
createResp, err := apiClient.Project.CreateProject(project.NewCreateProjectParams().WithBody(&models.ProjectSpecification{
141147
Administrators: administrators,
142148
Constraints: constraints,
149+
CustomProperties: customProperties,
143150
Description: description,
144151
MachineNamingTemplate: machineNamingTemplate,
145152
Members: members,
@@ -174,6 +181,7 @@ func resourceProjectRead(d *schema.ResourceData, m interface{}) error {
174181
project := *ret.Payload
175182
d.Set("administrators", flattenUserList(project.Administrators))
176183
d.Set("constraints", flattenProjectConstraints(project.Constraints))
184+
d.Set("custom_properties", project.CustomProperties)
177185
d.Set("description", project.Description)
178186
d.Set("machine_naming_template", project.MachineNamingTemplate)
179187
d.Set("members", flattenUserList(project.Members))
@@ -192,6 +200,7 @@ func resourceProjectUpdate(d *schema.ResourceData, m interface{}) error {
192200
id := d.Id()
193201
administrators := expandUserList(d.Get("administrators").(*schema.Set).List())
194202
constraints := expandProjectConstraints(d.Get("constraints").(*schema.Set).List())
203+
customProperties := expandCustomProperties(d.Get("custom_properties").(map[string]interface{}))
195204
description := d.Get("description").(string)
196205
machineNamingTemplate := d.Get("machine_naming_template").(string)
197206
members := expandUserList(d.Get("members").(*schema.Set).List())
@@ -204,6 +213,7 @@ func resourceProjectUpdate(d *schema.ResourceData, m interface{}) error {
204213
_, err := apiClient.Project.UpdateProject(project.NewUpdateProjectParams().WithID(id).WithBody(&models.ProjectSpecification{
205214
Administrators: administrators,
206215
Constraints: constraints,
216+
CustomProperties: customProperties,
207217
Description: description,
208218
MachineNamingTemplate: machineNamingTemplate,
209219
Members: members,

website/docs/d/vra_project.html.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ A project data source supports the following arguments:
3333

3434
* `constraints` - (Optional) List of storage, network and extensibility constraints to be applied when provisioning through this project.
3535

36+
* `custom_properties` - (Optional) The project custom properties which are added to all requests in this project.
37+
3638
* `description` - (Optional) A human-friendly description.
3739

3840
* `id` - (Optional) The id of the image profile instance.

website/docs/r/vra_project.html.markdown

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ resource "vra_project" "this" {
2222
storage_limit_gb = 65536
2323
}
2424
25+
custom_properties = {
26+
"foo": "bar",
27+
"foo2": "bar2"
28+
}
29+
2530
shared_resources = false
2631
2732
administrators = ["[email protected]"]
@@ -73,6 +78,8 @@ A project resource supports the following arguments:
7378

7479
* `constraints` - (Optional) List of storage, network and extensibility constraints to be applied when provisioning through this project.
7580

81+
* `custom_properties` - (Optional) The project custom properties which are added to all requests in this project.
82+
7683
* `description` - (Optional) A human-friendly description.
7784

7885
* `machine_naming_template` - (Optional) The naming template to be used for resources provisioned in this project.

0 commit comments

Comments
 (0)