Has anyone had the issue of maintaining correct dependency of a AWS load balancer and the S3 bucket ...
b
Has anyone had the issue of maintaining correct dependency of a AWS load balancer and the S3 bucket used for its access logs? It seems Pulumi doesn’t recognize this dependency correctly. And both resources are being created at the same time resulting in errors. Something like the following:
Copy code
access_logs = aws.lb.LoadBalancerAccessLogsArgs(
        bucket=bucket_name,
        prefix="",  
        enabled=True,
    )

lb = aws.lb.LoadBalancer(
            resource_name,
            internal=False,
            load_balancer_type=type,
            security_groups=groups,
            subnets=publicSubnetIds,
            access_logs=access_logs,
        )
m
Based on the code you shared so far: You're passing the bucket_name as a variable (presumably a string). If you instead create
bucket = aws.s3.Bucket(...)
and pass
bucket.name
the bucket will be created prior to the load balancer.
l
Yes, using an output of the bucket constructor provides the correct dependency. Alternatively, you can add a dependency manually, via the opts. https://www.pulumi.com/docs/concepts/options/dependson/
b
Thanks! changing it bucket.id works!
Also good to know the manual approach too.