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.

Important

Before you proceed, you must set up the appropriate OCI policies for the virtual service resource. For details, Required IAM Policy for Virtual Services.
    1. Open the navigation menu and click Developer Services. Under Containers & Artifacts, click Service Mesh.
    2. Click Service Meshes.
    3. On the Service Mesh page, from the list of compartments on the left side, select a compartment.
    4. From the list of meshes, click the mesh name that contains the virtual services.
    5. On the details page of the mesh, click the name of the virtual service.
    6. On the details page of the virtual service, click Move resource.
    7. In the Move resource dialog box, select the destination compartment.
    8. 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.
  • Use the ChangeVirtualServiceCompartment operation to move a mesh.