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

chilly-photographer-60932

01/12/2019, 11:54 PM
Copy code
type DefaultSecurityGroupArgs struct {
    // Can be specified multiple times for each
    // egress rule. Each egress block supports fields documented below.
    Egress interface{}
    // Can be specified multiple times for each
    // ingress rule. Each ingress block supports fields documented below.
    Ingress             interface{}
    RevokeRulesOnDelete interface{}
    // A mapping of tags to assign to the resource.
    Tags interface{}
    // The VPC ID. **Note that changing
    // the `vpc_id` will _not_ restore any default security group rules that were
    // modified, added, or removed.** It will be left in its current state
    VpcId interface{}
}
What type should I pass for
Ingress
? I tried
map[string]interface{})
. It fails with
ingress: should be a list
I was able to solve it.
Copy code
vpc, err := ec2.NewVpc(ctx, "naveen", &ec2.VpcArgs{CidrBlock: "10.0.0.0/16"})

		if err != nil {
			return err
		}

		acl, err := ec2.NewDefaultNetworkAcl(ctx, "naveen", &ec2.DefaultNetworkAclArgs{
			DefaultNetworkAclId: vpc.DefaultNetworkAclId(),
			Ingress: []map[string]interface{}{
				{
					"protocol":  "tcp",
					"fromPort":  80,
					"toPort":    80,
					"ruleNo":    1,
					"action":    "allow",
					"cidrBlock": "0.0.0.0/0",
				},
			}})
		if err != nil {
			return err
		}
		apply := acl.ID().Apply(func(id pulumi.ID) (i interface{}, e error) {
			return id, nil
		})
		value, _, _ := apply.Value()
		spew.Dump(value)
		spew.Dump(vpc.ID().Value())
		ctx.Export("aclId", value)
		return nil
4 Views