Updated on 2024-09-18 GMT+08:00

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 a 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

  1. Log in to Huawei Cloud as an organization administrator or an administrator account.
  2. Click on the left, choose Management & Governance > Organizations. The organization management page is displayed.
  3. Click Policies on the left to go to the policy management page and click Tag policies.

    Figure 1 Accessing the Tag policies page

  4. Click Create Policy.

    Figure 2 Creating a policy

  5. Enter a policy name. Note that the policy name you enter cannot be the same as that of other policies.
  6. Set a policy according to Tag Policy Syntax. The system automatically verifies the syntax. If the syntax is incorrect, modify it as prompted.

    Figure 3 Setting a policy tag

  7. (Optional) Add one or more tags to the policy. Enter a tag key and a tag value, and click Add.
  8. 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.