» alicloud_ram_roles

This data source provides a list of RAM Roles in an Alibaba Cloud account according to the specified filters.

» Example Usage

data "alicloud_ram_roles" "roles_ds" {
  output_file = "roles.txt"
  name_regex = ".*test.*"
  policy_name = "AliyunACSDefaultAccess"
  policy_type = "Custom"
}

output "first_role_id" {
  value = "${data.alicloud_ram_roles.roles_ds.roles.0.id}"
}

» Argument Reference

The following arguments are supported:

  • name_regex - (Optional) A regex string to filter results by the role name.
  • policy_type - (Optional) Filter results by a specific policy type. Valid values are Custom and System. If you set this parameter, you must set policy_name as well.
  • policy_name - (Optional) Filter results by a specific policy name. If you set this parameter without setting policy_type, the later will be automatically set to System. The resulting roles will be attached to the specified policy.
  • output_file - (Optional) File name where to save data source results (after running terraform plan).

» Attributes Reference

The following attributes are exported in addition to the arguments listed above:

  • roles - A list of roles. Each element contains the following attributes: