/terraform-alicloud-ram

Terraform module which creates a ram user and grant some policy for it on Alibaba Cloud

Primary LanguageHCLMIT LicenseMIT

Alicloud Resource Access Management (RAM) Terraform module

These types of resources are supported:

Terraform versions

Name Version
terraform >= 0.13.0
alicloud >= 1.56.0

Usage

create a new ram user

Create a ram user without any access permission

module "ram_user" {
   source = "terraform-alicloud-modules/ram/alicloud"
   name = "terraformtest1"
 }

Setting create_ram_user_login_profile to true can allow the ram user login the web console

module "ram_user" {
   source = "terraform-alicloud-modules/ram/alicloud"

   name = "terraformtest1"
   create_ram_user_login_profile = true
   password = "123X_xxxx"
 }

Setting create_ram_access_key to true can allocate a access key and secret key to the ram user , and them will store into the default secret file secret.txt

module "ram_user" {
   source = "terraform-alicloud-modules/ram/alicloud"

   name = "terraformtest1"
   create_ram_access_key = true
 }

create a new ram user with some access permission

Create a ram admin

module "ram_user" {
   source = "terraform-alicloud-modules/ram/alicloud"

   name = "terraformtest1"
   is_admin = true
 }

Create a ram user with read-only permission

module "ram_user" {
   source = "terraform-alicloud-modules/ram/alicloud"

   name = "terraformtest1"
   is_reader = true
 }

SubModules

Examples

Notes

From the version v1.3.0, the module has removed the following provider setting:

provider "alicloud" {
  version = ">=1.56.0"
  region = var.region != "" ? var.region : null
  configuration_source = "terraform-alicloud-modules/ram"
} 

If you still want to use the provider setting to apply this module, you can specify a supported version, like 1.2.0:

module "ram" {
  source = "terraform-alicloud-modules/ram/alicloud"
  version     = "1.2.0"
  region      = "cn-hangzhou"
  profile     = "Your-Profile-Name"

  name = "terraformtest1"
  is_reader = true
}

If you want to upgrade the module to 1.3.0 or higher in-place, you can define a provider which same region with previous region:

provider "alicloud" {
   region  = "cn-hangzhou"
   profile = "Your-Profile-Name"
}
module "ram" {
  source = "terraform-alicloud-modules/ram/alicloud"
  name = "terraformtest1"
  is_reader = true
}

or specify an alias provider with a defined region to the module using providers:

provider "alicloud" {
  region  = "cn-hangzhou"
  profile = "Your-Profile-Name"
  alias   = "hz"
}
module "ram" {
  source  = "terraform-alicloud-modules/ram/alicloud"
  providers = {
    alicloud = alicloud.hz
  }
  name = "terraformtest2"
  is_reader = true
}

and then run terraform init and terraform apply to make the defined provider effect to the existing module state. More details see How to use provider in the module

Authors

Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com)

License

Apache 2 Licensed. See LICENSE for full details.