Good morning, I'm having trouble using pulumi with...
# general
s
Good morning, I'm having trouble using pulumi with go + aws. I'm trying to create a security group and then use it's ID in another security group's Ingress rule but I keep getting an error like this:
error: aws:ec2/securityGroup:SecurityGroup resource 'sg1' has a problem: ingress.0: invalid or unknown key: source_security_group_id
Can anybody help me figure this one out?
g
Can you share your code?
s
Copy code
publicSecurityGroup, err := ec2.NewSecurityGroup(ctx, "sg1", &ec2.SecurityGroupArgs{
			Description: "For inter-security group traffic",
			VpcId:       vpc.ID(),
			Ingress: []map[string]interface{}{
				{
					"protocol":   "tcp",
					"fromPort":   22,
					"toPort":     22,
					"cidrBlocks": []string{"0.0.0.0/0"},
				},
			},
		})

		privateSecurityGroup, err := ec2.NewSecurityGroup(ctx, "sg2", &ec2.SecurityGroupArgs{
			Description: "For intra-security group traffic",
			Ingress: []map[string]interface{}{
				{
					"protocol": "tcp",
					"fromPort": 0,
					"toPort":   65535,
					"sourceSecurityGroupId": publicSecurityGroup.ID(),
				},
			},
		})
g
for inline ingress rules, I believe you want
securityGroups
instead of
sourceSecurityGroupId
sourceSecurityGroupId
is used for
SecurityGroupRule
resources
s
Awesome that worked - thanks!
👍 1