文档

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.

-> NOTE: Available since v1.204.0.

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"
}

Argument Reference

The following arguments are supported:

  • policy_id - (Required, ForceNew) The ID of the tag policy.
  • target_id - (Required, ForceNew) The ID of the object.
  • target_type - (Required, ForceNew) The type of the object. Valid values: USER, ROOT, FOLDER, ACCOUNT.

Attributes Reference

The following attributes are exported:

  • id - The resource ID in terraform of Policy Attachment. It formats as <policy_id>:<target_id>:<target_type>.

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>

  • 本页导读 (0)
文档反馈