Anybody knows how to create a ConfigMap from a con...
# golang
r
Anybody knows how to create a ConfigMap from a config.yaml file using Golang Pulumi?
b
@ripe-shampoo-80285 what would be in the
config.yaml
? if it's just a Kubernetes configmap, you can use this: https://www.pulumi.com/registry/packages/kubernetes/api-docs/yaml/configfile/
r
@billowy-army-68599 the config.yaml is application specific configuration not a k8s configmap manifest file. thresholds: - name: default speed: 110 posJump: 1 - name: foo speed: 100 posJump: 1.5
b
got it, hold on I'll throw an example together
something like this:
Copy code
dat, err := ioutil.ReadFile("assets/config.yaml")
		if err != nil {
			return err
		}

		_, err = corev1.NewConfigMap(ctx, "example", &corev1.ConfigMapArgs{
			Data: pulumi.StringMap{"data": pulumi.String(string(dat))},
		})
		if err != nil {
			return err
		}
I haven't tested that, but it should work
r
@billowy-army-68599 Great, I will give it try, thank you!
Thanks @billowy-army-68599 It worked. I changed ioutil.ReadFile to os.ReadFile because the ioutil package is deprecated since Golang 1.16
b
huh, TIL! thanks!