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

quick-room-65437

09/22/2021, 3:31 PM
Noob question: Trying to create a new vpc and then use the id in subsequent steps... however the Vpc struct that gets returned doesn't have an Id - unlike the LookupVpcResult struct.
b

billowy-army-68599

09/22/2021, 3:33 PM
can you share your code? it should definitely have an id
q

quick-room-65437

09/22/2021, 3:34 PM
sure -- dead simple:
Copy code
vpc, err := ec2.NewVpc(ctx,"api-dev-vpc", &ec2.VpcArgs{
			CidrBlock: pulumi.String("10.0.0.0/16"),
			Tags:      pulumi.ToStringMap(tags),
		})
looking at the struct def I see the
pulumi.CustomResourceState
however I get this:
Copy code
Diagnostics:
  pulumi:pulumi:Stack (GPW-API-dev):
    # GPW-API
    ./main.go:44:72: vpc.Id undefined (type *ec2.Vpc has no field or method Id)
I also had to roll back to a previous version because I was getting a ton of re-declared errors with the most recent release
b

billowy-army-68599

09/22/2021, 3:43 PM
I believe it's
vpc.ID()
in Go
q

quick-room-65437

09/22/2021, 3:49 PM
ok thanks -- will use that
another question - when I use the most recent release I get a ton of errors about re-declared types....I had to pin the dependency versions to 3.0 (pulumi) and 4.0 (aws) respectively to get anything to work....thoughts?
b

billowy-army-68599

09/22/2021, 3:55 PM
we are in the process of fixing that bug now,
4.20.0
should work
we'll have a patch release out shortly
q

quick-room-65437

09/22/2021, 4:01 PM
ok thanks
3 Views