https://pulumi.com logo
Title
b

big-angle-30002

12/30/2022, 4:25 PM
hello, I have a question with SecurityGroupIngress. The example in the documentation shows the definition as:
ingress=[aws.ec2.SecurityGroupIngressArgs(
        description="TLS from VPC",
        from_port=443,
        to_port=443,
        protocol="tcp",
        cidr_blocks=[aws_vpc["main"]["cidr_block"]],
        ipv6_cidr_blocks=[aws_vpc["main"]["ipv6_cidr_block"]],
    )]
If I want to have different rules, for example:
ingress=[
                {
                    "description": "https inbound traffic",
                    "protocol": "tcp",
                    "from_port": 443,
                    "to_port": 443,
                    "security_groups": [securityGroup],
                },
                {
                    "description": "http inbound traffic",
                    "protocol": "tcp",
                    "from_port": 80,
                    "to_port": 80,
                    "security_groups": [securityGroup],
                },
            ],
can I pass several arguments like so many dictionaries in the SecurityGroupIngressArgs function?
ingress=[

			aws.ec2.SecurityGroupIngressArgs(
                {
                    "description": "https inbound traffic",
                    "protocol": "tcp",
                    "from_port": 443,
                    "to_port": 443,
                    "security_groups": [securityGroup],
                },
                {
                    "description": "http inbound traffic",
                    "protocol": "tcp",
                    "from_port": 80,
                    "to_port": 80,
                    "security_groups": [securityGroup],
                },
            ],
            
            )
q

quaint-eye-38036

12/30/2022, 6:32 PM
Looks like a use-case of securitygrouprule
d

dry-keyboard-94795

12/30/2022, 10:05 PM
Nope, you should end up with a list of the
Args
object instead
Looks like a use-case of securitygrouprule
This is a good goto. Generally found it more usable/flexible in Terraform