alicloud_ram_policy

Provides a RAM Policy resource.

Example Usage

# Create a new RAM Policy.
resource "alicloud_ram_policy" "policy" {
  name = "test_policy"
  statement = [
    {
      effect = "Allow"
      action = [
        "oss:ListObjects",
        "oss:GetObject"
      ]
      resource = [
        "acs:oss:*:*:mybucket",
        "acs:oss:*:*:mybucket/*"
      ]
    }
  ]
  description = "this is a policy test"
  force = true
}

Argument Reference

The following arguments are supported:

  • name - (Required, Forces new resource) Name of the RAM policy. This name can have a string of 1 to 128 characters, must contain only alphanumeric characters or hyphen "-", and must not begin with a hyphen.
  • statement - (Optional, Type: list, Conflicts with document) Statements of the RAM policy document. It is required when the document is not specified.
    • resource - (Required, Type: list) List of specific objects which will be authorized. The format of each item in this list is acs:${service}:${region}:${account_id}:${relative_id}, such as acs:ecs:*:*:instance/inst-002 and acs:oss:*:1234567890000:mybucket. The ${service} can be ecs, oss, ots and so on, the ${region} is the region info which can use * replace when it is not supplied, the ${account_id} refers to someone's Alicloud account id or you can use * to replace, the ${relative_id} is the resource description section which related to the ${service}.
    • action - (Required, Type: list) List of operations for the resource. The format of each item in this list is ${service}:${action_name}, such as oss:ListBuckets and ecs:Describe*. The ${service} can be ecs, oss, ots and so on, the ${action_name} refers to the name of an api interface which related to the ${service}.
    • effect - (Required) This parameter indicates whether or not the action is allowed. Valid values are Allow and Deny.
  • version - (Optional, Conflicts with document) Version of the RAM policy document. Valid value is 1. Default value is 1.
  • document - (Optional, Conflicts with statement and version) Document of the RAM policy. It is required when the statement is not specified.
  • description - (Optional, Forces new resource) Description of the RAM policy. This name can have a string of 1 to 1024 characters.
  • force - (Optional) This parameter is used for resource destroy. Default value is false.

Attributes Reference

The following attributes are exported:

Import

RAM policy can be imported using the id or name, e.g.

$ terraform import alicloud_ram_policy.example my-policy

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/alicloud/r/ram_policy.html