Hello again, I see that the <pulumi eks package> p...
# general
n
Hello again, I see that the pulumi eks package provides both
ManagedNodeGroup
and
NodeGroupV2
(using python) I want to add an extra security group from a stack reference, but the node groups require the pulumi_aws.ec2.SecurityGroup class, but a stack reference serialize the class as dict, but even when using
aws.ec2.get_security_group_output(id=stack_ref_sg['id'])
or
aws.ec2.get_security_group(id=stack_ref_sg['id'])
as input for
extra_node_security_groups
the program still breaks.. How can I pass a pre-existing security group to the module?
1
c
Have you tried to export just the SG id itself and not the SecurityGroup object?
n
Yes, I believe I tried that as well, you can see here: https://github.com/pulumi/pulumi-eks/blob/master/sdk/python/pulumi_eks/_inputs.py#L492 it expects
pulumi_aws.ec2.SecurityGroup
without any further processing\overloading with
Union[]
When using:
Copy code
pulumi.export("ec2ice_sg", ec2_instance_connect_endpoint_security_group)
--------
ec2ice_sg = stack_ref.get_output("ec2ice_sg")

...
extra_node_security_groups=[ec2ice_sg['id']],
...
Copy code
Diagnostics:
  aws:ec2:LaunchTemplate (infrastructure-launchTemplate):
    error:   sdk-v2/provider2.go:572: sdk.helper_schema: Null value found in list: Null values are not allowed for this attribute value.: provider=aws@7.10.0
    error: diffing urn:pulumi:dev::EKS::eks:index:NodeGroupV2$aws:ec2/launchTemplate:LaunchTemplate::infrastructure-launchTemplate: 1 error occurred:
        * [network_interfaces[0].security_groups] Null value found in list: Null values are not allowed for this attribute value.
encapsulation using either
pulumi.Output
or
ec2ice_sg.apply()
have the same result
The input of extra_node_security_groups is too rigid, expecting the actually SecurityGroup object, instead of accepting it's id\arn..
c
maybe try exporting the sgid and using the lookup function to get the existing SecurityGroup https://www.pulumi.com/registry/packages/aws/api-docs/ec2/securitygroup/#look-up
n
🤔 I've tried using get_security_group(didn't work), but I've missed the lookup option, checking..
but the group is created in another stack, so what would be the
resource_name
?
Copy code
get(resource_name: str,
            id: pulumi.Input[str]
...
Trying:
sg = aws.ec2.SecurityGroup.get('sg', id=ec2ice_sg['id'])
c
i assume that name is scoped locally to the running Pulumi program and is independent of it's name in the creating stack
I make a lot of assumptions though 😉
n
I think it worked, I'm now getting another error, unrelated
🙌 1
c
that smells like progress
n
Wait, retesting, I had a fuction leftover from the apply attempt
🤞 1
Eureka 🎉
Copy code
pulumi:pulumi:Stack                EKS-dev                                    
     ├─ eks:index:NodeGroupV2           infrastructure                             
 ~   │  ├─ aws:ec2:LaunchTemplate       infrastructure-launchTemplate  update      [diff: ~latestVersion,networkInterfaces]
 ~   │  └─ aws:autoscaling:Group        infrastructure                 update      [diff: ~launchTemplate]
 ~   ├─ aws:eks:Addon                   external-dns                   update      [diff: +tagsAll]
 +   ├─ aws:eks:Addon                   guardduty                      create      
 ~   ├─ aws:eks:Addon                   metrics-server                 update      [diff: +tagsAll]
 ~   ├─ aws:eks:Addon                   ebs                            update      [diff: +tagsAll]
 ~   ├─ aws:eks:Addon                   efs                            update      [diff: +tagsAll]
     └─ eks:index:Cluster               dev                                        
 +-     └─ pulumi:providers:kubernetes  dev-eks-k8s                    replace
Preview is valid 🏁
c
Great
n
resource_name
was just arbitrary, no relevance.. so any string will do I guess
Thanks for the Assist 👑 @curved-jordan-5346
c
no worries!