https://pulumi.com logo
#golang
Title
s

salmon-account-74572

07/01/2020, 10:48 PM
All the examples of using
ec2.NewSecurityGroup
only have a single ingress rule. What's the syntax for specifying multiple ingress rules?
l

lemon-agent-27707

07/01/2020, 11:08 PM
To create additional entries in the array you would do something like the following:
Copy code
Ingress: ec2.SecurityGroupIngressArray{
	ec2.SecurityGroupIngressArgs{
		Protocol:   pulumi.String("tcp"),
		FromPort:   <http://pulumi.Int|pulumi.Int>(80),
		ToPort:     <http://pulumi.Int|pulumi.Int>(80),
		CidrBlocks: pulumi.StringArray{pulumi.String("0.0.0.0/0")},
	},
ec2.SecurityGroupIngressArgs{
		Protocol:   pulumi.String("tcp"),
		FromPort:   <http://pulumi.Int|pulumi.Int>(81),
		ToPort:     <http://pulumi.Int|pulumi.Int>(81),
		CidrBlocks: pulumi.StringArray{pulumi.String("0.0.0.0/0")},
	},
},
s

salmon-account-74572

07/01/2020, 11:19 PM
Thanks @lemon-agent-27707!
3 Views