Hello. I created an elastic load balancer in pytho...
# aws
r
Hello. I created an elastic load balancer in python code. Now I imported such resource in another pulumi project with opts=ResourceOptions( import_= ....arn..... ) Now I want to add a new created security group to the imported load balancer. How to do this ?....thanks so much
q
Was the import a one of thing, or are you planning to manage the load balancer in two different pulumi stacks? Security Groups are a property of the load balancer that you can set: https://www.pulumi.com/registry/packages/aws/api-docs/alb/loadbalancer/#securitygroups_nodejs But if you manage the LB in two different stacks you'll have to keep both in sync or ignore the changes you're making in the other stacks explicitly (https://www.pulumi.com/docs/iac/concepts/options/ignorechanges/). Generally I'd recommend to manage a resource in only a single stack
r
Hi Florian and thanks very much for your reply. The overall scenario is as follows: I have an ECS cluster and an ALB load balancer created with a pulumi stack for a microservice deployment. Next we developed a new microservice with it's own code repository. My goal is to use the ALB and ECS already deployed with the first pulumi stack. Using remote stack reference I'm able to get reference for these existing resources but I'm a little struggle on how to set properties for them in the new pulumi stack. I.E. I want to add an security group to the existing ALB and a new task definition and service to the existing ECS. I prefer to continue manage the ALB and ECS resources with the first pulumi stack, the one that in origin created them along with the first microservice. Is what I ask for doable ? or my overall design is wrong ? Apologize for my poor experience on the matter....and thanks very much for your kindly support.
q
If you wanna re-use the ALB and ECS cluster for multiple services I'd recommend moving those resources to their own stack. Managing a single resource in multiple stacks is gonna be complex (you'll need to ignore the mutually exclusive changes in each repo) and will introduce tight coupling. I'd recommend adding a single security group to the ALB in this central stack and exporting the security group ID. In the application stacks you can import the ALB security group ID with cross stack references and then add the necessary security group rules for your applications.
r
Clear. Thanks very much, Florian. Kindly regards Francesco