I'm having trouble finding Go GCP examples for the...
# google-cloud
I'm having trouble finding Go GCP examples for the google-cloud-native toolkit. Anyone have a nice repo they've made public with some use cases? 🧵
I did manage to get this to work while I was playing around:
Copy code
package main

import (
	compute "<http://github.com/pulumi/pulumi-google-native/sdk/go/google/compute/v1|github.com/pulumi/pulumi-google-native/sdk/go/google/compute/v1>"

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		computeNetwork, err := compute.NewNetwork(ctx, "network",
				AutoCreateSubnetworks: pulumi.Bool(true),
		if err != nil {
			return err

		_, err = compute.NewFirewall(ctx, "firewall",
				Network: computeNetwork.SelfLink,
				Allowed: compute.FirewallAllowedItemArray{compute.FirewallAllowedItemArgs{
					IpProtocol: pulumi.String("tcp"),
					Ports: pulumi.StringArray{
		if err != nil {
			return err

		return nil
I've spent a fair amount of time using the Python Pulumi toolkit and now trying to get to know the Golang one.
I suspect I find this particular endeavor a bit confusing because while I know enough Go to be dangerous, I haven't had to dive into reflection before. Inspecting this, much of the magic that is going on here appears to revolve around reflection. As I try to follow type hints in my editor, it definitely leads me in the wrong direction. The "fake" array using compute.FirewallAllowedItemArray{} really breaks my brain.
After more futzing, I think I understand the general operating pattern.