Skip to content

Commit 2cebeee

Browse files
authored
Merge pull request #7 from AutoMQ/zhaoxi-0817
feat: Disable the bucket creation switch and handle it by default.
2 parents 56c5247 + cf1eec3 commit 2cebeee

File tree

5 files changed

+35
-73
lines changed

5 files changed

+35
-73
lines changed

README.md

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -110,32 +110,26 @@ No requirements.
110110
| <a name="input_automq_byoc_env_console_cidr"></a> [automq\_byoc\_env\_console\_cidr](#input\_automq\_byoc\_env\_console\_cidr) | Set CIDR block to restrict the source IP address range for accessing the AutoMQ environment console. If not set, the default is 0.0.0.0/0. | `string` | `"0.0.0.0/0"` | no |
111111
| <a name="input_automq_byoc_vpc_id"></a> [automq\_byoc\_vpc\_id](#input\_automq\_byoc\_vpc\_id) | The ID of the VPC | `string` | n/a | no |
112112
| <a name="input_cloud_provider_region"></a> [cloud\_provider\_region](#input\_cloud\_provider\_region) | Set the cloud provider's region. AutoMQ will deploy to this region. | `string` | n/a | yes |
113-
| <a name="input_create_automq_byoc_data_bucket"></a> [create\_automq\_byoc\_data\_bucket](#input\_create\_automq\_byoc\_data\_bucket) | This parameter controls whether to create a new bucket. If it is a POC scenario or there is no available bucket, set it to true. If there is already a suitable bucket, set it to false. | `bool` | `true` | no |
114-
| <a name="input_create_automq_byoc_ops_bucket"></a> [create\_automq\_byoc\_ops\_bucket](#input\_create\_automq\_byoc\_ops\_bucket) | This parameter controls whether to create a new bucket. If it is a POC scenario or there is no available bucket, set it to true. If there is already a suitable bucket, set it to false. | `bool` | `true` | no |
115113
| <a name="input_create_new_vpc"></a> [create\_new\_vpc](#input\_create\_new\_vpc) | This setting determines whether to create a new VPC. If set to true, a new VPC spanning three availability zones will be automatically created, which is recommended only for POC scenarios. For production scenario using AutoMQ, you should provide the VPC where the current Kafka application resides and check the current VPC against the requirements specified in the documentation. | `bool` | `true` | no |
116-
| <a name="input_specific_data_bucket_name"></a> [specific\_data\_bucket\_name](#input\_specific\_data\_bucket\_name) | Set up a new object storage bucket that will be used to store message data generated by applications. The message data Bucket must be separate from the Ops Bucket. | `string` | `"automq-data"` | no |
117-
| <a name="input_specific_ops_bucket_name"></a> [specific\_ops\_bucket\_name](#input\_specific\_ops\_bucket\_name) | Set up a new object storage bucket that will be used to store AutoMQ system logs and metrics data for system monitoring and alerts. This Bucket does not contain any application business data. The Ops Bucket must be separate from the message data Bucket. | `string` | `"automq-ops"` | no |
118114
| <a name="input_specified_ami_by_marketplace"></a> [specified\_ami\_by\_marketplace](#input\_specified\_ami\_by\_marketplace) | Specifies the switch to obtain ami id from the cloud market. If true, it means to obtain the specified version of ami id through the cloud market. Otherwise, it needs to be specified manually. | `bool` | `true` | no |
119115

120116
## Outputs
121117

122-
| Name | Description |
123-
|------|-------------|
124-
| <a name="output_automq_byoc_data_bucket_arn"></a> [automq\_byoc\_data\_bucket\_arn](#output\_automq\_byoc\_data\_bucket\_arn) | Data storage bucket arn. |
125-
| <a name="output_automq_byoc_data_bucket_name"></a> [automq\_byoc\_data\_bucket\_name](#output\_automq\_byoc\_data\_bucket\_name) | The object storage bucket for that used to store message data generated by applications. The message data Bucket must be separate from the Ops Bucket. |
126-
| <a name="output_automq_byoc_env_console_ami"></a> [automq\_byoc\_env\_console\_ami](#output\_automq\_byoc\_env\_console\_ami) | Mirror ami id of AutoMQ BYOC Console. |
127-
| <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. |
128-
| <a name="output_automq_byoc_env_console_ec2_instance_ip"></a> [automq\_byoc\_env\_console\_ec2\_instance\_ip](#output\_automq\_byoc\_env\_console\_ec2\_instance\_ip) | The instance IP of the deployed AutoMQ BYOC control panel. You can access the service through this IP. |
118+
| Name | Description |
119+
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
120+
| <a name="output_automq_byoc_data_bucket_name"></a> [automq\_byoc\_data\_bucket\_name](#output\_automq\_byoc\_data\_bucket\_name) | The object storage bucket for that used to store message data generated by applications. The message data Bucket must be separate from the Ops Bucket. |
121+
| <a name="output_automq_byoc_env_console_ami"></a> [automq\_byoc\_env\_console\_ami](#output\_automq\_byoc\_env\_console\_ami) | Mirror ami id of AutoMQ BYOC Console. |
122+
| <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. |
123+
| <a name="output_automq_byoc_env_console_ec2_instance_ip"></a> [automq\_byoc\_env\_console\_ec2\_instance\_ip](#output\_automq\_byoc\_env\_console\_ec2\_instance\_ip) | The instance IP of the deployed AutoMQ BYOC control panel. You can access the service through this IP. |
129124
| <a name="output_automq_byoc_env_console_public_subnet_id"></a> [automq\_byoc\_env\_console\_public\_subnet\_id](#output\_automq\_byoc\_env\_console\_public\_subnet\_id) | AutoMQ WebUI is deployed under this subnet. |
130-
| <a name="output_automq_byoc_env_id"></a> [automq\_byoc\_env\_id](#output\_automq\_byoc\_env\_id) | This parameter is used to create resources within the environment. Additionally, all cloud resource names will incorporate this parameter as part of their names.This parameter supports only numbers, uppercase and lowercase English letters, and hyphens. It must start with a letter and is limited to a length of 32 characters. |
131-
| <a name="output_automq_byoc_endpoint"></a> [automq\_byoc\_env\_webui\_address](#output\_automq\_byoc\_env\_webui\_address) | Address accessed by AutoMQ BYOC service |
132-
| <a name="output_automq_byoc_instance_id"></a> [automq\_byoc\_instance\_id](#output\_automq\_byoc\_instance\_id) | AutoMQ BYOC Console instance ID. |
133-
| <a name="output_automq_byoc_instance_profile_arn"></a> [automq\_byoc\_instance\_profile\_arn](#output\_automq\_byoc\_instance\_profile\_arn) | Instance configuration file ARN |
134-
| <a name="output_automq_byoc_ops_bucket_arn"></a> [automq\_byoc\_ops\_bucket\_arn](#output\_automq\_byoc\_ops\_bucket\_arn) | Ops storage bucket arn. |
135-
| <a name="output_automq_byoc_ops_bucket_name"></a> [automq\_byoc\_ops\_bucket\_name](#output\_automq\_byoc\_ops\_bucket\_name) | The object storage bucket for that used to store AutoMQ system logs and metrics data for system monitoring and alerts. This Bucket does not contain any application business data. The Ops Bucket must be separate from the message data Bucket. |
136-
| <a name="output_automq_byoc_policy_arn"></a> [automq\_byoc\_policy\_arn](#output\_automq\_byoc\_policy\_arn) | AutoMQ BYOC is bound to a custom policy on the role arn. |
137-
| <a name="output_automq_byoc_role_arn"></a> [automq\_byoc\_role\_arn](#output\_automq\_byoc\_role\_arn) | AutoMQ BYOC is bound to the role arn of the Console. |
138-
| <a name="output_automq_byoc_security_group_name"></a> [automq\_byoc\_security\_group\_name](#output\_automq\_byoc\_security\_group\_name) | Security group bound to the AutoMQ BYOC service. |
139-
| <a name="output_automq_byoc_vpc_id"></a> [automq\_byoc\_vpc\_id](#output\_automq\_byoc\_vpc\_id) | AutoMQ BYOC is deployed in this VPC. |
140-
| <a name="output_automq_byoc_vpc_route53_zone_id"></a> [automq\_byoc\_vpc\_route53\_zone\_id](#output\_automq\_byoc\_vpc\_route53\_zone\_id) | Route53 bound to the VPC. |
125+
| <a name="output_automq_byoc_env_id"></a> [automq\_byoc\_env\_id](#output\_automq\_byoc\_env\_id) | This parameter is used to create resources within the environment. Additionally, all cloud resource names will incorporate this parameter as part of their names.This parameter supports only numbers, uppercase and lowercase English letters, and hyphens. It must start with a letter and is limited to a length of 32 characters. |
126+
| <a name="output_automq_byoc_endpoint"></a> [automq\_byoc\_endpoint](#output\_automq\_byoc\_endpoint) | Address accessed by AutoMQ BYOC service |
127+
| <a name="output_automq_byoc_instance_id"></a> [automq\_byoc\_instance\_id](#output\_automq\_byoc\_instance\_id) | AutoMQ BYOC Console instance ID. |
128+
| <a name="output_automq_byoc_instance_profile_arn"></a> [automq\_byoc\_instance\_profile\_arn](#output\_automq\_byoc\_instance\_profile\_arn) | Instance configuration file ARN |
129+
| <a name="output_automq_byoc_ops_bucket_name"></a> [automq\_byoc\_ops\_bucket\_name](#output\_automq\_byoc\_ops\_bucket\_name) | The object storage bucket for that used to store AutoMQ system logs and metrics data for system monitoring and alerts. This Bucket does not contain any application business data. The Ops Bucket must be separate from the message data Bucket. |
130+
| <a name="output_automq_byoc_policy_arn"></a> [automq\_byoc\_policy\_arn](#output\_automq\_byoc\_policy\_arn) | AutoMQ BYOC is bound to a custom policy on the role arn. |
131+
| <a name="output_automq_byoc_role_arn"></a> [automq\_byoc\_role\_arn](#output\_automq\_byoc\_role\_arn) | AutoMQ BYOC is bound to the role arn of the Console. |
132+
| <a name="output_automq_byoc_security_group_name"></a> [automq\_byoc\_security\_group\_name](#output\_automq\_byoc\_security\_group\_name) | Security group bound to the AutoMQ BYOC service. |
133+
| <a name="output_automq_byoc_vpc_id"></a> [automq\_byoc\_vpc\_id](#output\_automq\_byoc\_vpc\_id) | AutoMQ BYOC is deployed in this VPC. |
134+
| <a name="output_automq_byoc_vpc_route53_zone_id"></a> [automq\_byoc\_vpc\_route53\_zone\_id](#output\_automq\_byoc\_vpc\_route53\_zone\_id) | Route53 bound to the VPC. |
141135
<!-- END_TF_DOCS -->

main.tf

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ module "automq_byoc_data_bucket_name" {
77
source = "terraform-aws-modules/s3-bucket/aws"
88
version = "4.1.2"
99

10-
# Switch whether to create a bucket. If it is true, it will be created. If it is false, it will use the name entered by the user. If the name is empty, it will default to automq-data.
11-
create_bucket = var.create_automq_byoc_data_bucket
12-
bucket = var.create_automq_byoc_data_bucket ? (
13-
var.specific_data_bucket_name == "" ? "automq-data-${var.automq_byoc_env_id}" : var.specific_data_bucket_name
14-
) : (
15-
var.automq_byoc_data_bucket_name == "" ? "automq-data-${var.automq_byoc_env_id}" : var.automq_byoc_data_bucket_name
16-
)
10+
# If you don't specify a data-bucket, it will be created, otherwise the available bucket provided will be used
11+
create_bucket = var.automq_byoc_data_bucket_name == "" ? true : false
12+
bucket = "automq-data-${var.automq_byoc_env_id}"
1713
force_destroy = true
1814
}
1915

@@ -22,12 +18,8 @@ module "automq_byoc_ops_bucket_name" {
2218
source = "terraform-aws-modules/s3-bucket/aws"
2319
version = "4.1.2"
2420

25-
create_bucket = var.create_automq_byoc_ops_bucket
26-
bucket = var.create_automq_byoc_ops_bucket ? (
27-
var.specific_ops_bucket_name == "" ? "automq-ops-${var.automq_byoc_env_id}" : var.specific_ops_bucket_name
28-
) : (
29-
var.automq_byoc_ops_bucket_name == "" ? "automq-ops-${var.automq_byoc_env_id}" : var.automq_byoc_ops_bucket_name
30-
)
21+
create_bucket = var.automq_byoc_ops_bucket_name == "" ? true : false
22+
bucket = "automq-ops-${var.automq_byoc_env_id}"
3123
force_destroy = true
3224
}
3325

@@ -124,6 +116,8 @@ resource "aws_vpc_endpoint" "s3" {
124116
locals {
125117
automq_byoc_vpc_id = var.create_new_vpc ? module.automq_byoc_vpc[0].vpc_id : var.automq_byoc_vpc_id
126118
automq_byoc_env_console_public_subnet_id = var.create_new_vpc ? element(module.automq_byoc_vpc[0].public_subnets, 0) : var.automq_byoc_env_console_public_subnet_id
119+
automq_data_bucket = var.automq_byoc_data_bucket_name == "" ? module.automq_byoc_data_bucket_name.s3_bucket_id : "${var.automq_byoc_data_bucket_name}-${var.automq_byoc_env_id}"
120+
automq_ops_bucket = var.automq_byoc_ops_bucket_name == "" ? module.automq_byoc_ops_bucket_name.s3_bucket_id : "${var.automq_byoc_ops_bucket_name}-${var.automq_byoc_env_id}"
127121
}
128122

129123
module "automq_byoc" {
@@ -132,8 +126,8 @@ module "automq_byoc" {
132126
cloud_provider_region = var.cloud_provider_region
133127
automq_byoc_vpc_id = local.automq_byoc_vpc_id
134128
automq_byoc_env_console_public_subnet_id = local.automq_byoc_env_console_public_subnet_id
135-
automq_byoc_data_bucket_name = module.automq_byoc_data_bucket_name.s3_bucket_id
136-
automq_byoc_ops_bucket_name = module.automq_byoc_ops_bucket_name.s3_bucket_id
129+
automq_byoc_data_bucket_name = local.automq_data_bucket
130+
automq_byoc_ops_bucket_name = local.automq_ops_bucket
137131
automq_byoc_env_id = var.automq_byoc_env_id
138132
automq_byoc_ec2_instance_type = var.automq_byoc_ec2_instance_type
139133
automq_byoc_env_version = var.automq_byoc_env_version

modules/aws-console-module/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ output "automq_byoc_security_group_name" {
2323
value = aws_security_group.allow_all.name
2424
}
2525

26+
output "automq_byoc_data_bucket_name" {
27+
value = var.automq_byoc_data_bucket_name
28+
}
29+
30+
output "automq_byoc_ops_bucket_name" {
31+
value = var.automq_byoc_ops_bucket_name
32+
}
33+
2634
output "automq_byoc_role_arn" {
2735
value = aws_iam_role.automq_byoc_role.arn
2836
}

outputs.tf

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,12 @@ output "automq_byoc_endpoint" {
3030

3131
output "automq_byoc_data_bucket_name" {
3232
description = "The object storage bucket for that used to store message data generated by applications. The message data Bucket must be separate from the Ops Bucket."
33-
value = module.automq_byoc_data_bucket_name.s3_bucket_id
34-
}
35-
36-
output "automq_byoc_data_bucket_arn" {
37-
description = "Data storage bucket arn."
38-
value = module.automq_byoc_data_bucket_name.s3_bucket_arn
33+
value = module.automq_byoc.automq_byoc_data_bucket_name
3934
}
4035

4136
output "automq_byoc_ops_bucket_name" {
4237
description = "The object storage bucket for that used to store AutoMQ system logs and metrics data for system monitoring and alerts. This Bucket does not contain any application business data. The Ops Bucket must be separate from the message data Bucket."
43-
value = module.automq_byoc_ops_bucket_name.s3_bucket_id
44-
}
45-
46-
output "automq_byoc_ops_bucket_arn" {
47-
description = "Ops storage bucket arn."
48-
value = module.automq_byoc_ops_bucket_name.s3_bucket_arn
38+
value = module.automq_byoc.automq_byoc_ops_bucket_name
4939
}
5040

5141
output "automq_byoc_role_arn" {

variables.tf

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,6 @@ variable "automq_byoc_ops_bucket_name" {
5454
default = ""
5555
}
5656

57-
variable "create_automq_byoc_data_bucket" {
58-
description = "This parameter controls whether to create a new bucket. If it is a POC scenario or there is no available bucket, set it to true. If there is already a suitable bucket, set it to false."
59-
type = bool
60-
default = true
61-
}
62-
63-
variable "create_automq_byoc_ops_bucket" {
64-
description = "This parameter controls whether to create a new bucket. If it is a POC scenario or there is no available bucket, set it to true. If there is already a suitable bucket, set it to false."
65-
type = bool
66-
default = true
67-
}
68-
69-
variable "specific_data_bucket_name" {
70-
description = "Set up a new object storage bucket that will be used to store message data generated by applications. The message data Bucket must be separate from the Ops Bucket."
71-
type = string
72-
default = ""
73-
}
74-
75-
variable "specific_ops_bucket_name" {
76-
description = "Set up a new object storage bucket that will be used to store AutoMQ system logs and metrics data for system monitoring and alerts. This Bucket does not contain any application business data. The Ops Bucket must be separate from the message data Bucket."
77-
type = string
78-
default = ""
79-
}
80-
8157
variable "specified_ami_by_marketplace" {
8258
description = "Specifies the switch to obtain ami id from the cloud market. If true, it means to obtain the specified version of ami id through the cloud market. Otherwise, it needs to be specified manually."
8359
type = bool

0 commit comments

Comments
 (0)