Need a pointer (no pun intended) on this issue: <h...
# kubernetes
c
Need a pointer (no pun intended) on this issue: https://github.com/pulumi/pulumi/discussions/8939 Getting mixed up on string pointer/input/output.
b
@chilly-plastic-75584 it’ll be a bit easier to help if you’re able to share some more code snippets of what you’re trying to do.
On my hand, have something like:
Copy code
myConfigMap, err := corev1.NewConfigMap(ctx, "my-configmap", &corev1.ConfigMapArgs{
And then use it like this:
Copy code
corev1.EnvFromSourceArray{
		&corev1.EnvFromSourceArgs{
			ConfigMapRef: &corev1.ConfigMapEnvSourceArgs{
				Name: DefaultConfig.Metadata.Name(),
			},
		},
		&corev1.EnvFromSourceArgs{
			ConfigMapRef: &corev1.ConfigMapEnvSourceArgs{
				Name: Config.Metadata.Name(),
			},
		},
DefaultConfig
and
Config
are basically the
myConfigMap
(just exported in anoher variable)
c
Updated github question with code snippets. Looking at what you provided as well, cheers
Added last item to end, issue with
Copy code
ResourceNames: pulumi.StringArray{
					cfgMap.Metadata.Name(),  // 👈 THIS cannot use cfgMap.Metadata.Name() (value of type pulumi.StringPtrOutput) as pulumi.StringInput value in array or slice literal: missing method ToStringOutput
				},
Close! I updated to use config.metatadata.name and all but the last item seem to be working
b
Your code snippet uses
generatedConfigMapName
but doesn’t set it anywhere
Use this:
Metadata.Name().Elem()
I’m also not quite sure what you mean about letting deployment do it in any order.
c
I figured the order of dependencies is calculated by pulumi. However, in this case I need to explicitly have a generated output name from the config map so thought I might need to run an Apply to then export the configMap name for usage in the rest of the plan. I will try what you just said
b
It should not be necessary to do an Apply, this is a pretty normal use case.
This is one area for Go’s type system is getting in the way.
c
Copy code
ResourceNames: pulumi.StringArray{
					// CfgMap.Metadata.Name(),.
					cfgMap.Metadata.Name().Elem(),
				},
This gave no error
I'm trying now
NICE
my hero
Are you on github so I can mention your username in the answer in github discussions?
b
Yeah, just
@itay
c
done, thank you!
b
Happy to help - thought it’d be faster here than GitHub 🙂
c
Yeah. I'm kinda zealous on putting in github even if i chat in slack because I believe that the lack of visibility and searching to others makes slack a walled garden compared to the repo. Helpful to do here, but I want to save my problem/answer there so others benefit hopefully. Thank you for the quick help
b
For sure, kudos to you for doing that.
🙂 1