Skip to content

Commit 93f5d9d

Browse files
authored
Merge pull request #14 from AutoMQ/zhaoxi-ebs
feat: Obtain availability zones based on subnets to avoid releasing d…
2 parents c0c9bff + ca036af commit 93f5d9d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

aws.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,12 @@ resource "aws_eip" "web_ip" {
252252
automqVendor = "automq"
253253
automqEnvironmentID = var.automq_byoc_env_id
254254
}
255+
}
256+
257+
locals {
258+
public_subnet_id = var.create_new_vpc ? module.automq_byoc_vpc[0].public_subnets[0] : var.automq_byoc_env_console_public_subnet_id
259+
}
260+
261+
data "aws_subnet" "public_subnet_info" {
262+
id = local.public_subnet_id
255263
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ resource "aws_instance" "automq_byoc_console" {
3232
}
3333

3434
resource "aws_ebs_volume" "data_volume" {
35-
availability_zone = aws_instance.automq_byoc_console.availability_zone
35+
availability_zone = data.aws_subnet.public_subnet_info.availability_zone
3636
size = 20
3737
type = "gp3"
3838

0 commit comments

Comments
 (0)