pulumi-kubernetes
pulumi-kubernetes copied to clipboard
Add support for asset (StringAsset) as file parameter to kubernetes.yaml.v2.ConfigFile
Hello!
- Vote on this issue by adding a 👍 reaction
- If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
Issue details
It would be nice if kubernetes.yaml.v2.ConfigFile
would allow assets (specifically pulumi.StringAsset
) to be passed in the file
parameter.
that way I could have an output that render yaml via jinja2 and returns an StringAsset
and pass it to ConfigFile
like this
config_file = pulumi.Output.all(arg1=resource1.arn, arg2=resource2.arn).apply(lambda args: pulumi.StringAsset(template.render(args)))
# https://www.pulumi.com/registry/packages/kubernetes/api-docs/yaml/v2/configfile/#kubernetes-yaml-v2-configfile
kubernetes.yaml.v2.ConfigFile(
"test",
file=config_file,
opts=pulumi.ResourceOptions(
provider=kubernetes_provider,
),
)
the above code now raises
Exception: setting args: copying input "file": expected a pulumi.String, got a asset
To me there are two possible solutions
- allow
file=
to be a file-like object , orStringAsset
in addition to thestr
(file-path) - introduce a new parameter to
ConfigFile
likecontent=
where you can pass the computed manifest - Add a new concept like
kubernetes.yaml.v2.Manifest()
where we can pass the manifest content without having a file (allowing the manifest content to be a computed string )