alicloud_tag_policy

更新时间:

Provides a TAG Policy resource.

For information about TAG Policy and how to use it, see What is Policy.

-> NOTE: Available since v1.203.0.

Example Usage

Basic Usage


variable "name" {
  default = "terraform-example"
}

provider "alicloud" {
  region = "cn-shanghai"
}

resource "alicloud_tag_policy" "example" {
  policy_name    = var.name
  policy_desc    = var.name
  user_type      = "USER"
  policy_content = <<EOF
		{"tags":{"CostCenter":{"tag_value":{"@@assign":["Beijing","Shanghai"]},"tag_key":{"@@assign":"CostCenter"}}}}
    EOF
}

Argument Reference

The following arguments are supported:

  • policy_name - (Required) The name of the tag policy. The name must be 1 to 128 characters in length and can contain letters, digits, and underscores (_).
  • policy_content - (Required) The document of the tag policy.
  • policy_desc - (Optional) The description of the policy. The description must be 1 to 512 characters in length.
  • user_type - (Optional, ForceNew)The mode of the Tag Policy feature. Valid values: USER, RD.

Attributes Reference

The following attributes are exported:

  • id - The resource ID in terraform of Policy.

Timeouts

-> NOTE: Available since v1.243.0.

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 5 mins) Used when create the Policy.
  • delete - (Defaults to 5 mins) Used when delete the Policy.
  • update - (Defaults to 5 mins) Used when update the Policy.

Import

TAG Policy can be imported using the id, e.g.

$ terraform import alicloud_tag_policy.example <id>