diff --git a/README.md b/README.md
index 911cae6..195cfa9 100644
--- a/README.md
+++ b/README.md
@@ -29,8 +29,6 @@ module "automq_byoc" {
# Set the target regionId of huaweicloud
cloud_provider_region = "cn-north-4"
-
- automq_byoc_env_console_ami_name = "AutoMQ-control-center-Poc-1.2.5-rc1-x86_64"
}
# Necessary outputs
@@ -100,6 +98,8 @@ No modules.
| [huaweicloud_dns_zone.private_zone](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/dns_zone) | resource |
| [huaweicloud_evs_volume.data_volume](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/evs_volume) | resource |
| [huaweicloud_identity_agency.automq_byoc_agency](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/identity_agency) | resource |
+| [huaweicloud_identity_role.automq_byoc_obs_policy](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/identity_role) | resource |
+| [huaweicloud_identity_role.automq_byoc_policy](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/identity_role) | resource |
| [huaweicloud_networking_secgroup.automq_byoc_console_sg](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/networking_secgroup) | resource |
| [huaweicloud_networking_secgroup_rule.allow_8080](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/networking_secgroup_rule) | resource |
| [huaweicloud_obs_bucket.automq_byoc_data_bucket](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/obs_bucket) | resource |
@@ -108,6 +108,7 @@ No modules.
| [huaweicloud_vpc_eip.automq_byoc_eip](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/vpc_eip) | resource |
| [huaweicloud_vpc_subnet.private_subnets](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/vpc_subnet) | resource |
| [huaweicloud_vpc_subnet.public_subnet](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/resources/vpc_subnet) | resource |
+| [huaweicloud_account.current](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/data-sources/account) | data source |
| [huaweicloud_availability_zones.zones](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/data-sources/availability_zones) | data source |
| [huaweicloud_images_image.automq_byoc_console_ami](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/data-sources/images_image) | data source |
| [huaweicloud_vpc.vpc_info](https://registry.terraform.io/providers/huaweicloud/huaweicloud/latest/docs/data-sources/vpc) | data source |
@@ -126,9 +127,9 @@ No modules.
| [automq_byoc_data_bucket_name](#input_automq_byoc_data_bucket_name) | Set the existed OBS bucket used to store message data generated by applications. If this parameter is not set, a new OBS bucket will be automatically created. The message data Bucket must be separate from the Ops Bucket. | `string` | `""` | no |
| [automq_byoc_ops_bucket_name](#input_automq_byoc_ops_bucket_name) | Set the existed OBS bucket used to store AutoMQ system logs and metrics data for system monitoring and alerts. If this parameter is not set, a new OBS bucket will be automatically created. This Bucket does not contain any application business data. The Ops Bucket must be separate from the message data Bucket. | `string` | `""` | no |
| [automq_byoc_ecs_instance_type](#input_automq_byoc_ecs_instance_type) | Set the ECS instance type; this parameter is used only for deploying the AutoMQ environment console. You need to provide an ECS instance type with at least 2 cores and 8 GB of memory. | `string` | `"s6.large.2"` | no |
-| [automq_byoc_env_version](#input_automq_byoc_env_version) | Set the version for the AutoMQ BYOC environment console. It is recommended to keep the default value, which is the latest version. Historical release note reference [document](https://docs.automq.com/automq-cloud/release-notes). | `string` | `"latest"` | no |
-| [automq_byoc_env_console_ami_name](#input_automq_byoc_env_console_ami_name) | When parameter `specified_ami_by_marketplace` set to false, this parameter must set a custom AMI to deploy automq console. | `string` | `""` | no |
-| [automq_byoc_identity_agency_name](#input_automq_byoc_identity_agency_name) | Set the agency name for the AutoMQ BYOC environment console. If not set, a new agency will be automatically created. | `string` | `""` | no |
+| [automq_byoc_env_version](#input_automq_byoc_env_version) | Set the version for the AutoMQ BYOC environment console. It is recommended to keep the default value, which is the latest version. Historical release note reference [document](https://docs.automq.com/automq-cloud/release-notes). | `string` | `"1.3.5"` | no |
+| [use_custom_ami](#input_use_custom_ami) | The parameter defaults to false, which means a specific AMI is not specified. If you wish to use a custom AMI, set this parameter to true and specify the `automq_byoc_env_console_ami` parameter with your custom AMI ID. | `bool` | `false` | no |
+| [automq_byoc_env_console_ami](#input_automq_byoc_env_console_ami) | When the `use_custom_ami` parameter is set to true, this parameter must be set with a custom AMI Name to deploy the AutoMQ console. | `string` | `""` | no |
## Outputs
@@ -148,4 +149,5 @@ No modules.
| [automq_byoc_agency_name](#output_automq_byoc_agency_name) | AutoMQ BYOC is bound to the agency of the Console. |
| [automq_byoc_vpc_dns_zone_id](#output_automq_byoc_vpc_dns_zone_id) | DNS Zone bound to the VPC. |
| [automq_byoc_env_console_cidr](#output_automq_byoc_env_console_cidr) | AutoMQ BYOC security group CIDR. |
+| [automq_byoc_huaweicloud_current_account_id](#output_automq_byoc_huaweicloud_current_account_id) | n/a |
\ No newline at end of file
diff --git a/huaweicloud.tf b/huaweicloud.tf
index 4d18dfd..dbb366f 100644
--- a/huaweicloud.tf
+++ b/huaweicloud.tf
@@ -118,7 +118,6 @@ resource "huaweicloud_identity_role" "automq_byoc_obs_policy" {
}
resource "huaweicloud_identity_agency" "automq_byoc_agency" {
- count = var.automq_byoc_identity_agency_name == "" ? 1 : 0
name = "automq-byoc-agency-${var.automq_byoc_env_id}"
description = "Agency for AutoMQ BYOC"
delegated_service_name = "op_svc_ecs"
@@ -153,7 +152,7 @@ locals {
automq_byoc_env_console_public_subnet_id = var.create_new_vpc ? huaweicloud_vpc_subnet.public_subnet[0].id : var.automq_byoc_env_console_public_subnet_id
automq_data_bucket = var.automq_byoc_data_bucket_name == "" ? huaweicloud_obs_bucket.automq_byoc_data_bucket[0].bucket : var.automq_byoc_data_bucket_name
automq_ops_bucket = var.automq_byoc_ops_bucket_name == "" ? huaweicloud_obs_bucket.automq_byoc_ops_bucket[0].bucket : var.automq_byoc_ops_bucket_name
- agency_name = var.automq_byoc_identity_agency_name == "" ? huaweicloud_identity_agency.automq_byoc_agency[0].name : var.automq_byoc_identity_agency_name
+ automq_image_name = var.use_custom_ami ? var.automq_byoc_env_console_ami : format("AutoMQ-control-center-Prod-%s-x86_64", var.automq_byoc_env_version)
}
# Data sources
@@ -166,6 +165,6 @@ data "huaweicloud_vpc_subnet" "public_subnet_info" {
}
data "huaweicloud_images_image" "automq_byoc_console_ami" {
- name = var.automq_byoc_env_console_ami_name
+ name = local.automq_image_name
most_recent = true
}
diff --git a/main.tf b/main.tf
index 64bbba8..f7a1ad3 100644
--- a/main.tf
+++ b/main.tf
@@ -16,10 +16,10 @@ resource "huaweicloud_compute_instance" "automq_byoc_console" {
automqEnvironmentID = var.automq_byoc_env_id
}
- agency_name = local.agency_name
+ agency_name = huaweicloud_identity_agency.automq_byoc_agency.name
user_data = base64encode(templatefile("${path.module}/tpls/userdata.tpl", {
- huaweicloud_iam_agency_name = local.agency_name
+ huaweicloud_iam_agency_name = huaweicloud_identity_agency.automq_byoc_agency.name
automq_data_bucket = local.automq_data_bucket,
automq_ops_bucket = local.automq_ops_bucket,
instance_security_group_id = huaweicloud_networking_secgroup.automq_byoc_console_sg.id,
diff --git a/outputs.tf b/outputs.tf
index ef45ee3..99edd46 100644
--- a/outputs.tf
+++ b/outputs.tf
@@ -55,7 +55,7 @@ output "automq_byoc_security_group_name" {
output "automq_byoc_agency_name" {
description = "AutoMQ BYOC is bound to the agency of the Console."
- value = local.agency_name
+ value = huaweicloud_identity_agency.automq_byoc_agency.name
}
output "automq_byoc_vpc_dns_zone_id" {
diff --git a/variables.tf b/variables.tf
index 94fe249..79d4bdf 100644
--- a/variables.tf
+++ b/variables.tf
@@ -57,18 +57,17 @@ variable "automq_byoc_ecs_instance_type" {
variable "automq_byoc_env_version" {
description = "Set the version for the AutoMQ BYOC environment console. It is recommended to keep the default value, which is the latest version. Historical release note reference [document](https://docs.automq.com/automq-cloud/release-notes)."
type = string
- default = "latest"
+ default = "1.3.5"
}
-variable "automq_byoc_env_console_ami_name" {
- description = "When parameter `specified_ami_by_marketplace` set to false, this parameter must set a custom AMI to deploy automq console."
- type = string
- default = ""
+variable "use_custom_ami" {
+ description = "The parameter defaults to false, which means a specific AMI is not specified. If you wish to use a custom AMI, set this parameter to true and specify the `automq_byoc_env_console_ami` parameter with your custom AMI ID."
+ type = bool
+ default = false
}
-
-variable "automq_byoc_identity_agency_name" {
- description = "Set the agency name for the AutoMQ BYOC environment console. If not set, a new agency will be automatically created."
+variable "automq_byoc_env_console_ami" {
+ description = "When the `use_custom_ami` parameter is set to true, this parameter must be set with a custom AMI Name to deploy the AutoMQ console."
type = string
default = ""
}
\ No newline at end of file