DEV Community

Cover image for Terraforming Alibaba Cloud - Resource Management
Ankit Mehta
Ankit Mehta

Posted on • Updated on

Terraforming Alibaba Cloud - Resource Management

Cloud services categorization and management can be challenging if resources are not tagged and group properly. This is the first post in the Alibaba Cloud Weekly series.

In this blog post, the Alibaba Cloud Resource Management service is explained with Terraformation and provision.

When starting with Alibaba Cloud, a default Resource Management group is created. However, keeping all the resources in the default group can be messy. One can create a Resource Management group separated by Department, Functional Group, or Environment.

Following Terraform code can help in creating a new Resource Management group called "dev". For future posts, the same group will be used.

For the current solution following two files are created. (upcoming blog posts will use modules)

.
├── terraform.tf
└── terraform.tfvars
Enter fullscreen mode Exit fullscreen mode

terraform.tf :

variable "access_key" {}
variable "secret_key" {}
variable "region" {}

terraform {
  required_providers {
    alicloud = {
      source  = "aliyun/alicloud"
      version = "1.121.1"
    }
  }
}

provider "alicloud" {
  access_key = var.access_key
  secret_key = var.secret_key
  region     = var.region
}

resource "alicloud_resource_manager_resource_group" "development-rg" {
  resource_group_name = "aliyun-development-rg"
  display_name        = "aliyun-development-rg"
}
Enter fullscreen mode Exit fullscreen mode

terraform.tfvars : ( To generate access and secret keys
For Regions )

access_key            = "SOMEACCESSKEY"
secret_key            = "SOMESECRETKEY"
region                = "SOMEREGION"
Enter fullscreen mode Exit fullscreen mode

On successful, a new resource management group should be visible as follows.

Resource Manager : After Deployment

As stated earlier, the Resource Management Group is a one-stop location to find all the resources created for a particular group.

Resource Management Dashboard

While using Terraform for the next post, the resource group will be specified. Any resources created without resource group directive are created under the "Default" resource group.

Note that there a soft limit on the Resource Management Group. Any account can have a maximum of 30 Groups, and this limit can be extended by opening a service limit increase ticket.

Permissions can be set for each resource group to provide more granular access.

Permission-Resource Management

Terraform Provider Reference: https://registry.terraform.io/providers/aliyun/alicloud/latest/docs

Do let us know your feedback in the comment box below. Also do let us know if you want us to explore any other Alibaba Cloud services.

Next week we will add a VPC and VSwitch creation under the newly created Resource Management group.

If you are new to Terraform and want us to create a post for it then do let us know in the comment section below.

Top comments (0)