Add a member account to Cloud Firewall
Adds a member account to Cloud Firewall for centralized multi-account security management.
Available since v1.194.0 of the alicloud provider.
Prerequisites
Make sure that you have:
An Alibaba Cloud account and an AccessKey pair
Terraform installed and configured (version 0.12 or later)
This guide uses Cloud Shell as the runtime environment with Terraform 0.12 and alicloud provider version 1.203.0. The code examples use therequired_providerssyntax (Terraform 0.13+). If you use Terraform 0.12, specify the provider version in theproviderblock instead:
provider "alicloud" {
version = "~> 1.203.0"
}Example usage
Basic usage
terraform {
required_providers {
alicloud = {
source = "aliyun/alicloud"
version = ">= 1.203.0"
}
}
}
provider "alicloud" {}
resource "alicloud_cloud_firewall_instance_member" "default" {
member_desc = "Added memberUid by Terraform"
member_uid = 180998553943****
}Add a member account created by Resource Manager
terraform {
required_providers {
alicloud = {
source = "aliyun/alicloud"
version = ">= 1.203.0"
}
}
}
provider "alicloud" {}
resource "alicloud_resource_manager_account" "member" {
display_name = "my-member-account"
}
resource "alicloud_cloud_firewall_instance_member" "default" {
member_desc = "Added by Terraform"
member_uid = alicloud_resource_manager_account.member.id
}Procedure
Create a file named
main.tfin your Terraform working directory and add the configuration from the Example usage section.Run
terraform initto initialize the working directory and download the alicloud provider.$ terraform initRun
terraform applyto preview the changes. Review the execution plan, then enteryesto apply. After the resource is created, Terraform returns the member UID as the resource ID (for example,180998553943****).$ terraform applyVerify the result.
Run
terraform showto view the member account details:$ terraform showAlternatively, log on to the Cloud Firewall console and navigate to System Settings > Multi-account Management to view the member account.
Argument reference
The following arguments are supported:
member_uid- (Required, ForceNew) The UID of the member account to add to Cloud Firewall. Changing this forces a new resource to be created.member_desc- (Optional) A description of the member account. For example,"Added memberUid by Terraform".
Attribute reference
The following attributes are exported:
id- The member UID of the Cloud Firewall instance member.create_time- The timestamp when the member account was added, in Unix epoch seconds. For example,1681899524.member_display_name- The display name of the member account. For example,"beaver_qa3".modify_time- The timestamp of the last modification, in Unix epoch seconds.status- The status of the member account. For example,"normal".
Timeouts
The timeouts block specifies timeouts for the following actions:
create- (Default5m) Used when adding a member account to Cloud Firewall.update- (Default5m) Used when updating the member account description.delete- (Default1m) Used when removing a member account from Cloud Firewall.
Import
You can import a Cloud Firewall instance member by its member UID.
Using the import block (Terraform v1.5+):
import {
to = alicloud_cloud_firewall_instance_member.example
id = "180998553943****"
}Using terraform import:
$ terraform import alicloud_cloud_firewall_instance_member.example 180998553943****Related resources
alicloud_cloud_firewall_instance_member - Terraform Registry documentation
alicloud_resource_manager_account - Create member accounts with Resource Manager