Terraform module which create RAM roles on Alibaba Cloud.
terraform-alicloud-ram-role
=====================================================================
English | 简体中文
Terraform module used to create a RAM role on Alibaba Cloud, and attach several RAM policies for it.
These types of resources are supported:
The Module requires Terraform 0.12.
module "ram_role" {
source = "terraform-alicloud-modules/ram-role/alicloud"
name = "test-role"
users = [
# Add a trusted user under a specified account.
{
user_names = join(",", ["user3", "user4"])
account_id = "123456789012****"
},
# If not set `account_id`, the default is the current account.
{
user_names = join(",", ["user1", "user2"])
}
]
# Setting predefined or custom services
services = ["ecs", "apigateway", "oss.aliyuncs.com", "ecs-cn-hangzhou.aliyuncs.com"]
force = true
policies = [
# Binding a system policy.
{
policy_names = ["AliyunVPCFullAccess","AliyunKafkaFullAccess"]
policy_type = "System"
},
# When binding custom policy, make sure this policy has been created.
{
policy_names = ["VpcListTagResources", "RamPolicyForZhangsan"]
policy_type = "Custom"
},
# Create Custom policy and bind the ram role.
{
policy_names = module.ram_policy.this_policy_name
}
]
}
module "ram_policy" {
source = "terraform-alicloud-modules/ram-policy/alicloud"
policies = [
{
name = "manage-slb-and-eip-resource"
defined_actions = join(",", ["slb-all", "vpc-all", "vswitch-all"])
actions = join(",", ["vpc:AssociateEipAddress", "vpc:UnassociateEipAddress"])
resources = join(",", ["acs:vpc:*:*:eip/eip-12345", "acs:slb:*:*:*"])
},
{
#actions is the action of custom specific resource.
#resources is the specific object authorized to customize.
actions = join(",", ["ecs:ModifyInstanceAttribute", "vpc:ModifyVpc", "vswitch:ModifyVSwitch"])
resources = join(",", ["acs:ecs:*:*:instance/i-001", "acs:vpc:*:*:vpc/v-001", "acs:vpc:*:*:vswitch/vsw-001"])
effect = "Deny"
}
]
}
Created and maintained by Zhou qilin([email protected]), He Guimin(@xiaozhu36, [email protected])
Apache 2 Licensed. See LICENSE for full details.