Skip to content

Commit

Permalink
Merge pull request #2 from AutoMQ/feat-update-var
Browse files Browse the repository at this point in the history
feat: update control plane version config and specific AMI config
  • Loading branch information
Gezi-lzq authored Oct 23, 2024
2 parents 483f9c9 + 99ddd06 commit e359033
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 |
Expand All @@ -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 |
Expand All @@ -126,9 +127,9 @@ No modules.
| <a name="input_automq_byoc_data_bucket_name"></a> [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 |
| <a name="input_automq_byoc_ops_bucket_name"></a> [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 |
| <a name="input_automq_byoc_ecs_instance_type"></a> [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 |
| <a name="input_automq_byoc_env_version"></a> [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 |
| <a name="input_automq_byoc_env_console_ami_name"></a> [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 |
| <a name="input_automq_byoc_identity_agency_name"></a> [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 |
| <a name="input_automq_byoc_env_version"></a> [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 |
| <a name="input_use_custom_ami"></a> [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 |
| <a name="input_automq_byoc_env_console_ami"></a> [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

Expand All @@ -148,4 +149,5 @@ No modules.
| <a name="output_automq_byoc_agency_name"></a> [automq_byoc_agency_name](#output_automq_byoc_agency_name) | AutoMQ BYOC is bound to the agency of the Console. |
| <a name="output_automq_byoc_vpc_dns_zone_id"></a> [automq_byoc_vpc_dns_zone_id](#output_automq_byoc_vpc_dns_zone_id) | DNS Zone bound to the VPC. |
| <a name="output_automq_byoc_env_console_cidr"></a> [automq_byoc_env_console_cidr](#output_automq_byoc_env_console_cidr) | AutoMQ BYOC security group CIDR. |
| <a name="output_automq_byoc_huaweicloud_current_account_id"></a> [automq_byoc_huaweicloud_current_account_id](#output_automq_byoc_huaweicloud_current_account_id) | n/a |
<!-- END_TF_DOCS -->
5 changes: 2 additions & 3 deletions huaweicloud.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
}
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
15 changes: 7 additions & 8 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
}

0 comments on commit e359033

Please sign in to comment.