policy
is composed of several sub-statements. Each sub-statement contains the following elements: policy_key
, tag_key
, tag_value
, effective scope, etc.{"tags": {"principal": {"tag_key": {"@@assign": "principal"},"tag_value": {"@@assign": ["name 1"]},"resource_type_scope":{"@@assign": ["ecs:instance","ecs:disk"]},"correction": {"@@assign": "on"}}}}
Element | Required | Description | Description in above example |
tags | Yes | A tag policy always starts with tags . tags is always on the first line of a tag policy and is fixed. | tags , which is fixed |
policy_key | Yes | Tag key, which identifies a compliant tag key and takes the same value as the policy key. Tag keys are case sensitive. You can define multiple tag keys in a tag policy. | principal is the tag key. |
tag_key | Yes | Tag key, which identifies a compliant tag key and takes the same value as the policy key (case-sensitive). You can define multiple tag keys in a tag policy. | principal |
tag_value | Yes | Tag value, which identifies a compliant tag value. | Tag value is set to name1 and use principal as a valid value |
resource_type_scope | Yes | The effective scope of resource types, which is specified by the tag key-value pair. | Effective scope is limited to
ecs:instance,ecs:disk |
correction | No | Indicates whether the tag key value needs to be automatically corrected. | on indicates that the correction feature is enabled for the resources within the effective scope of resource types. |
Operator | Required | Description | Description in above example |
@@assign | Yes | This operator is used to assign the specified content to the specified element. | Assign principal to the policy key and tag keyAssign name 1 to the tag valueAssign ecs:instance,ecs:disk to the effective scope of resource typesAssign on to whether the correction feature is enabled |
Was this page helpful?