Hey!, I’m having a probably very dumb problem, I’m...
# golang
n
Hey!, I’m having a probably very dumb problem, I’m using the Google Native SDK and I’m trying to create a VPC, here’s the code snippet for that:
Copy code
vpc, err := network.NewNetwork(ctx, projectID+"-vpc-"+config.Name, &network.NetworkArgs{
		AutoCreateSubnetworks: pulumi.Bool(config.AutocreateSubnets),
		Name:                  pulumi.String(config.Name),
		RoutingConfig: &network.NetworkRoutingConfigArgs{
			RoutingMode: ?
		},
	})
I’m having an issue with the ?,
RoutingMode
is an object of
*(network,NetworkRoutingConfigArgs).RoutingMode
type for which there are 2 constants `network.NetworkRoutingConfigRoutingModeGlobal`and
network.NetworkRoutingConfigRoutingModeRegional
. I’ve tried the following but all are rejected by the compiler:
Copy code
&network.NetworkRoutingConfigRoutingModeGlobal
&network.NetworkRoutingConfigRoutingMode{ network.NetworkRoutingConfigRoutingModeGlobal }
&network.NetworkRoutingConfigRoutingMode(network.NetworkRoutingConfigRoutingModeGlobal)
Does anyone know how I can pass the constant to the
RoutingMode
field?
b
Try assigning it to a local variable and then take the address of that with &. Go doesn’t like taking addresses of constants
n
Ahhh….I knew it was a dumb problem, that did it
Thanks!