alicloud_ram_policy
Provides a RAM Policy resource.
NOTE: When you want to destroy this resource forcefully(means remove all the relationships associated with it automatically and then destroy it) without set
force
withtrue
at beginning, you need addforce = true
to configuration file and runterraform plan
, then you can delete resource forcefully.
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 withdocument
) Statements of the RAM policy document. It is required when thedocument
is not specified.-
resource
- (Required, Type: list) List of specific objects which will be authorized. The format of each item in this list isacs:${service}:${region}:${account_id}:${relative_id}
, such asacs:ecs:*:*:instance/inst-002
andacs:oss:*:1234567890000:mybucket
. The${service}
can beecs
,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 theresource
. The format of each item in this list is${service}:${action_name}
, such asoss:ListBuckets
andecs:Describe*
. The${service}
can beecs
,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 theaction
is allowed. Valid values areAllow
andDeny
.
-
-
version
- (Optional, Conflicts withdocument
) Version of the RAM policy document. Valid value is1
. Default value is1
. -
document
- (Optional, Conflicts withstatement
andversion
) Document of the RAM policy. It is required when thestatement
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 isfalse
.
Attributes Reference
The following attributes are exported:
-
id
- The policy ID. -
name
- The policy name. -
type
- The policy type. -
description
- The policy description. -
statement
- List of statement of the policy document. -
document
- The policy document. -
version
- The policy document version. -
attachment_count
- The policy attachment count.
Import
RAM policy can be imported using the id or name, e.g.
$ terraform import alicloud_ram_policy.example my-policy
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/alicloud/r/ram_policy.html