Adding a cloud zone to a project removes existing cloud zone assignment from the project when updating it using the PATCH method via the API.
Aria Automation 8.18.1 after upgrade from vRA 8.11
This occurs because the zoneAssignmentConfigurations property is a nested property of the ProjectSpecification schema to the PATCH /iaas/api/projects/:id API
When a new cloud zone needs to be added to the project, the client should send in the body of the request the full list of zones + the new zone added to the list.
Example:
// Current state of the project // GET /iaas/api/projects/project-1-uuid { // ... "id": "project-1-uuid", "zones": [ { "zoneId": "zone-1-uuid", "id": "project-1-uuidzone-1-uuid", // ... } ] } // Payload to add a new zone // PATCH /iaas/api/projects/project-1-uuid { // ... "zoneAssignmentConfigurations": [ { "zoneId": "zone-1-uuid", // ... }, { "zoneId": "zone-2-uuid", // ... }, ] } // Project state after the update // GET /iaas/api/projects/project-1-uuid { // ... "id": "project-1-uuid", "zones": [ { "zoneId": "zone-1-uuid", "id": "project-1-uuidzone-1-uuid", // ... }, { "zoneId": "zone-2-uuid", "id": "project-1-uuidzone-2-uuid", // ... } ] }
To achieve this, the following algorithm can be used to update the projects:
CREATE the new cloud zone FOR each project in all projects: READ project (GET /iaas/api/projects/{project_id}) BUILD zoneAssignmentConfigurations property by using existing zones property of the project and adding the new zone at the end of the list UPDATE the project (PATCH /iaas/api/projects/{project_id}) END LOOP
In the event that ansible is being used, an Ansible playbook example has been attached (assign_zones.yaml)