Skip to content

Commit

Permalink
f: depends
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjjung committed Dec 16, 2024
1 parent 3228c71 commit 1606e01
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions tb_pulumi/rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,19 +411,22 @@ def __init__(
# Figure out the IPs once the instances are ready and build a load balancer targeting them
port = SERVICE_PORTS.get(engine, 5432)
inst_addrs = [instance.address for instance in instances]
load_balancer_ips = pulumi.Output.all(*inst_addrs).apply(
lambda addresses: [socket.gethostbyname(addr) for addr in addresses]
)
load_balancer = tb_pulumi.ec2.NetworkLoadBalancer(
f'{name}-nlb',
project=project,
exclude_from_project=True,
listener_port=port,
subnets=subnets,
target_port=port,
ingress_cidrs=[vpc_cidr],
internal=True,
ips=[socket.gethostbyname(addr) for addr in inst_addrs],
security_group_description=f'Allow database traffic for {name}',
opts=pulumi.ResourceOptions(parent=self, depends_on=[*instances, *subnets]),
)
f'{name}-nlb',
project=project,
# exclude_from_project=True,
listener_port=port,
subnets=subnets,
target_port=port,
ingress_cidrs=[vpc_cidr],
internal=True,
ips=load_balancer_ips,
security_group_description=f'Allow database traffic for {name}',
opts=pulumi.ResourceOptions(parent=self, depends_on=[*instances, *load_balancer_ips, *subnets]),
)

ssm_param_db_read_host = load_balancer.apply(
lambda lb: aws.ssm.Parameter(
Expand Down

0 comments on commit 1606e01

Please sign in to comment.