Creating a Tag Policy
Introduction
Tag policies are a type of policy that can help you standardize tags across resources in your organization's accounts. A tag policy is only applied to tagged resources and tags that are defined in that policy.
For example, a tag policy can specify that a tag attached to a resource must use the case treatment and tag values defined in the tag policy. If the case and value of the tag do not comply with the tag policy, the resource will be marked as non-compliant.
You can use tag policies as detective or preventive guardrails:
1. Detective guardrails: If a resource tag violates the tag policy, the resource will appear as noncompliant in the compliance result.
2. Preventive guardrails: If enforcement is enabled for a tag policy, non-compliant tagging operations will be prevented from being performed on specified resource types.
Constraints
Only organization administrators can create a tag policy.
Before you create a tag policy and add it to the organization unit and account, a tag policy must be enabled by the administrator account. For details, see Enabling or Disabling the Tag Policy Type.
Procedure
- Log in to Huawei Cloud as an organization administrator or an administrator account.
- Click on the left, choose . The organization management page is displayed.
- Click
on the left to go to the policy management page and click Tag policies.Figura 1 Accessing the Tag policies page
- Click Create Policy.
Figura 2 Creating a policy
- Enter a policy name. Ensure that you are entering a unique policy name, different from any existing name.
- Set a policy according to Tag Policy Syntax. The system automatically verifies the syntax. If the syntax is incorrect, modify it as prompted.
Figura 3 Setting a policy tag
- (Optional) Add one or more tags to the policy. Enter a tag key and a tag value, and click Add.
- Click Save in the lower right corner. If the tag policy is created successfully, it will be added to the list.
To update or delete a tag policy, see Updating or Deleting a Tag Policy.
To attach or detach a tag policy, see Attaching or Detaching a Tag Policy.