HPE Morpheus Enterprise
1828019 Members
1927 Online
109973 Solutions
New Discussion

Create instance and assign tags

 
SOLVED
Go to solution
CA1239945
Occasional Contributor

Create instance and assign tags

I have an instance type configured with inputs that are entered on the “add instance” wizard form, and used to tag the instance. The inputs are marked “export as tag” so they are exported to VMware vCenter and assigned to the VM.

If I use the API to create an instance, I would like to assign tags to the instance when it is created and have them exported to vCenter (as described above). I have added “tags”:[{}] containing name value pairs to the JSON body but they don’t get added to the instance nor do they get assigned to the VM in vCenter.

Here is an example:

“tags”:[
{“name”:“tag1”,“value”:“abcd”}
]

The request is accepted by the API and the instance is provisioned, but the tags do not get assigned. I am using the same instance type and the name of the tags matches the “Field Name” of the tags. I have also tried using the name of the input as well.

Have I missed something? What am I doing wrong?

2 REPLIES 2
CA1239945
Occasional Contributor

Re: Create instance and assign tags

Thanks very much for that. It has worked. :slightly_smiling_face:

dgaharwar
Regular Advisor
Solution

Re: Create instance and assign tags

If you want to add the inputs which have export as tag checked, the payload should look like this,

  "config": {
    "customOptions": {
      "tag1": "abcd"
    },

Where tag1 is the Field Name of that input and abcd is the value.