One method is explained in https://docs.vmware.com/en/VMware-Tanzu-Operations-Manager/3.0/vmware-tanzu-ops-manager/install-custom-vm-extensions.html
See if you are using Cloudformation and Autoscaling groups. Tagging helps organize large fleets and is also assists with billing, for example, you can get cost reports by tags. It is recommended not to remove this constraint if they have it.
Some operators may use custom VM extensions.
Review the deployment-time tagging in the BOSH manifest: https://bosh.io/docs/manifest-v2/#tags
Anything you add in the `tags` block gets added to the instances.
Alternatively, you should use VM extensions for this kind of process. Review the Procedure section to get this done through the Ops Manager API. But that is ultimately just going to the BOSH manifest anyway, and VM extensions are for heavyweight configurations, like adding a security group automatically.
You can tag instances using Ops Man APIs. This process has been tried and tested on GCP.
1. Get an bearer token and store it in a variable called TOKEN
uaac target ${opsman.domain.com}/uaa --skip-ssl-validation uaac token owner get opsman admin -s "" TOKEN=`uaac context | egrep access_token | awk -F ":" '{print $2}' | sed s/' '//`
2. Create the custom VM extension using the ops man API:
curl -vv "https://localhost/api/v0/staged/vm_extensions"" -X POST -H "Authorization: Bearer $TOKEN" -k -H "Content-Type: application/json" -d '{"name": "##_###_#####", "cloud_properties": { "tags": ["my-tag"] }}'
3. Get a listing of products and jobs for your PCF install:
curl -vv "https://localhost/api/v0/deployed/products"" -X GET -H "Authorization: Bearer $TOKEN" -k curl -vv "https://localhost/api/v0/deployed/products/<PRODUCT_GUID>/jobs"" -X GET -H "Authorization: Bearer $TOKEN" -k
4. Apply the custom extension to each job, which is a VM/instance in GCP:
curl -vv "https://localhost/api/v0/staged/products/cf-e5a4d9966eaa8cf564c0/jobs/compute-################ec7c/resource_config" -X PUT -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"additional_vm_extensions":["vm_ext_adam"],"instance_type": {"id":"automatic"}}' -k
Refer to PCF Docs: https://docs.vmware.com/en/VMware-Tanzu-Operations-Manager/3.0/vmware-tanzu-ops-manager/install-custom-vm-extensions.html#create-vm-extension