alicloud_tag_policy_attachment

Provides a Tag Policy Attachment resource to attaches a policy to an object. After you attach a tag policy to an object. For information about Tag Policy Attachment and how to use it, see What is Policy Attachment.

Example Usage

Basic Usage

variable "name" {
  default = "tf-example"
}
provider "alicloud" {
  region = "cn-shanghai"
}
data "alicloud_account" "default" {}
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
}

resource "alicloud_tag_policy_attachment" "example" {
  policy_id   = alicloud_tag_policy.example.id
  target_id   = data.alicloud_account.default.id
  target_type = "USER"
}
        {"tags":{"CostCenter":{"tag_value":{"@@assign":["Beijing","Shanghai"]},"tag_key":{"@@assign":"CostCenter"}}}}
    EOF
}

resource "alicloud_tag_policy_attachment" "example" {
  policy_id   = alicloud_tag_policy.example.id
  target_id   = data.alicloud_account.default.id
  target_type = "USER"
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Import

Tag Policy Attachment can be imported using the id, e.g.

$ terraform import alicloud_tag_policy_attachment.example <policy_id>:<target_id>:<target_type>