https://pulumi.com logo
#google-cloud
Title
# google-cloud
h

high-church-15413

05/16/2022, 5:10 PM
hello: How do we enable dataplane in GKE autopilot? I am using gcp classic provider but did not see an config to do that.
n

narrow-translator-93508

06/10/2022, 5:39 PM
This is how I do it (with
Go
)
Copy code
// EnableManagedControlPlane activates some hub functions that cannot be used because of bugs
// with the gkehub pulumi module as of today.
func (sm *ServiceMesh) EnableManagedControlPlane() error {
	_, err := local.NewCommand(
		sm.Context, "mesh-auto-control-plane", &local.CommandArgs{
			Create: pulumi.Sprintf(
				`gcloud alpha container hub mesh update \
					--control-plane automatic \
					--membership %s \
					--project %s
				`,
				sm.Outputs.ClusterName.ApplyT(
					func(s interface{}) string {
						return s.(string)
					},
				).(pulumi.StringOutput),
				sm.Config.Get("project"),
			),
			// @todo implement DELETE
		},
	)
	if err != nil {
		return fmt.Errorf(
			"EnableManagedControlPlane: could not apply auto control plane for membership name %s: %w",
			sm.Outputs.ClusterName.ApplyT(
				func(s interface{}) string {
					return s.(string)
				},
			),
			err,
		)
	}

	return nil
}
Not perfect, but works like a charm!