Moving a Virtual Service Between Compartments
Move a virtual service from one compartment to another in Service Mesh.
After you move a virtual service to a new compartment, inherent policies apply immediately and affect access to the virtual service through the Console. For more information, see Managing Compartments.
Before you proceed, you must set up the appropriate OCI policies for the virtual service resource. For details, Required IAM Policy for Virtual Services.
- Open the navigation menu and click Developer Services. Under Containers & Artifacts, click Service Mesh.
- Click Service Meshes.
- On the Service Mesh page, from the list of compartments on the left side, select a compartment.
- From the list of meshes, click the mesh name that contains the virtual services.
- On the details page of the mesh, click the name of the virtual service.
- On the details page of the virtual service, click Move resource.
- In the Move resource dialog box, select the destination compartment.
- Click Move resource.
To see what operations are available for
virtual-service change-compartment
use:oci service-mesh virtual-service change-compartment -h
To move a virtual service using the CLI, run
oci service-mesh virtual-service change-compartment
to move the virtual service:oci service-mesh virtual-service change-compartment --compartment-id <compartmentId> --virtual-service-id <virtualServiceId>
Where:
<compartmentId>
: The OCID of the compartment to which the virtual service belongs.<virtualServiceId>
: The OCID of the virtual service to move. To find out the Virtual Service's OCID, see Listing Virtual Services.
For example:
oci service-mesh virtual-service change-compartment --compartment-id ocid1.compartment.oc1..aaa... --virtual-service-id ocid1.meshvirtualservice.oc1..aaa...
The response to the command includes:
- The life cycle state (for example, ACTIVE, FAILED).
- The ID of the work request to move the virtual service (details of work requests are available for seven days after completion, cancellation, or failure).
If you want the command to wait to return control until the virtual service is active or the request has failed, include either or both of the following parameters:
--wait-for-state SUCCEEDED
--wait-for-state FAILED
For example:
oci service-mesh virtual-service change-compartment --compartment-id ocid1.compartment.oc1..aaa... --virtual-service-id ocid1.meshvirtualservice.oc1..aaa... --wait-for-state SUCCEEDED
Tip
You can't use the virtual service until the work request has successfully moved it and the virtual service is active.Checking Virtual Service Status
To see the status of the virtual service, enter:
oci service-mesh virtual-service get --virtual-service-id <virtualServiceId>
To view the status of the work request moving the virtual service, refer to Service Mesh Work Requests
For more information about using the CLI, see:
Use the ChangeVirtualServiceCompartment operation to move a mesh.