Skip to content

Commit

Permalink
chore: update huaweicloud.tf and main.tf to include huaweicloud_accou…
Browse files Browse the repository at this point in the history
…nt data source
  • Loading branch information
Gezi-lzq committed Sep 13, 2024
1 parent a5572ad commit b54443f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions huaweicloud.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ resource "huaweicloud_dns_zone" "private_zone" {
}
}

data "huaweicloud_account" "current" {}

# Locals
locals {
automq_byoc_vpc_id = var.create_new_vpc ? huaweicloud_vpc.automq_byoc_vpc[0].id : var.automq_byoc_vpc_id
Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ resource "huaweicloud_compute_instance" "automq_byoc_console" {
automq_ops_bucket = local.automq_ops_bucket,
instance_security_group_id = huaweicloud_networking_secgroup.automq_byoc_console_sg.id,
instance_dns = huaweicloud_dns_zone.private_zone.id,
environment_id = var.automq_byoc_env_id
environment_id = var.automq_byoc_env_id,
huaweicloud_account_id = data.huaweicloud_account.current.id,
}))
}

Expand Down
4 changes: 4 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@ output "automq_byoc_vpc_dns_zone_id" {
output "automq_byoc_env_console_cidr" {
description = "AutoMQ BYOC security group CIDR."
value = var.automq_byoc_env_console_cidr
}

output "automq_byoc_huaweicloud_current_account_id" {
value = data.huaweicloud_account.current.id
}
1 change: 1 addition & 0 deletions tpls/userdata.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ bootcmd:
echo "cmp.provider.credential=vm-role://${huaweicloud_iam_agency_name}@huaweicloud" >> /opt/cmp/config.properties
echo 'cmp.provider.databucket=${automq_data_bucket}' >> /opt/cmp/config.properties
echo 'cmp.provider.opsBucket=${automq_ops_bucket}' >> /opt/cmp/config.properties
echo 'cmp.provider.scope=${huaweicloud_account_id}' >> /opt/cmp/config.properties
echo 'cmp.provider.instanceSecurityGroup=${instance_security_group_id}' >> /opt/cmp/config.properties
echo 'cmp.provider.instanceDNS=${instance_dns}' >> /opt/cmp/config.properties
echo 'cmp.provider.instanceProfile=${huaweicloud_iam_agency_name}' >> /opt/cmp/config.properties
Expand Down

0 comments on commit b54443f

Please sign in to comment.