Search code examples
command-line-interfaceoracle-cloud-infrastructure

How to write complex type in json format using OCI CLI?


I try to update a compute instance in oci cli but the command below:

oci compute instance update --instance-id=ocid1.instance.oc1.eu-frankfurt-1.aaaaaa... --defined-tags '{"data":{"launch-options":{"firmware":"UEFI_64"}}}'

results this error:

ServiceError: { "code": "Bad Request", "message": "Tag values must be strings", "opc-request-id": "7B645B7F3D3F4047BE04E39DD6F4CCCA/8904CFD298C5E9F34AF032AF079EB84A/F627F1D27D0DF095A32C89C4701554F1", "status": 400 }

How should I format my tag value correctly?


Solution

  • After I did some further tests based on the input by @user3291073 I found the right solution: First you have to create a tag namespace and tag key definition, then you have to refer to the existing tag namespace and tag key definition in the cli --defined-tags option. So for my previous example this will work with an existing launch-options tag namespace with a firmware tag key definition:

    oci compute instance update --instance-id=ocid1.instance.oc1.eu-frankfurt-1.aaaaaa... --defined-tags '{"launch-options":{"firmware":"UEFI_64"}}'