Hi community. I am having a seemingly unsolvable p...
# python
h
Hi community. I am having a seemingly unsolvable problem here with my config. I am basically doing what the provider docs say:
Copy code
talos_cluster_secrets = talos.machine.Secrets(
            "machine_secrets",
            talos_version=talos_version,
            opts=resource_opts,
        )
        talos.machine.get_configuration_output(
                machine_type="controlplane",
                talos_version=talos_version,
                cluster_name=name,
                cluster_endpoint="<https://cluster.local:6443>",
                kubernetes_version=kubernetes_version,

                machine_secrets=talos_cluster_secrets.machine_secrets,
                opts=invoke_opts,
            )
but I am getting this error
Copy code
Exception: invoke of talos:machine/getConfiguration:getConfiguration failed: invocation of talos:machine/getConfiguration:getConfiguration returned an error: [AttributeName("machine_secrets").AttributeName("certs").AttributeName("k8s_aggregator")] Missing Configuration for Required Attribute: Must set a configuration value for the machine_secrets.certs.k8s_aggregator attribute as the provider has marked it as required.
the attributes that are referred to in the error (.certs.k8s_aggregator) are different from time to time but I cant get it to work. I can print out the values fine with
Copy code
talos_cluster_secrets.machine_secrets.apply(lambda s: print(s.certs.k8s_aggregator))
But still getting the error. Any help is very much appreciated 🙂
e
Is this during a preview or up?
h
happens on preview
e
yeh I think this is a bug with invokes and unknown values
h
here is the whole output if that helps:
Copy code
❯ pulumi preview
Previewing update (production):
     Type                 Name                     Plan     Info
     pulumi:pulumi:Stack  myidm-hcloud-production           1 error

Diagnostics:
  pulumi:pulumi:Stack (myidm-hcloud-production):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/usr/bin/pulumi-language-python-exec", line 232, in <module>
        loop.run_until_complete(coro)
      File "/home/roland/.pyenv/versions/3.12.7/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
        return future.result()
               ^^^^^^^^^^^^^^^
      File "/home/roland/development/iDM/plm_myidm_global/pulumi/hcloud/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 143, in run_in_stack
        await run_pulumi_func(run)
      File "/home/roland/development/iDM/plm_myidm_global/pulumi/hcloud/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 55, in run_pulumi_func
        await wait_for_rpcs()
      File "/home/roland/development/iDM/plm_myidm_global/pulumi/hcloud/venv/lib/python3.12/site-packages/pulumi/runtime/stack.py", line 119, in wait_for_rpcs
        await task
      File "/home/roland/development/iDM/plm_myidm_global/pulumi/hcloud/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 155, in do_invoke_output
        invoke_result = await _invoke(
                        ^^^^^^^^^^^^^^
      File "/home/roland/development/iDM/plm_myidm_global/pulumi/hcloud/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 367, in wait_for_fut
        return await asyncio.ensure_future(do_rpc())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/roland/development/iDM/plm_myidm_global/pulumi/hcloud/venv/lib/python3.12/site-packages/pulumi/runtime/invoke.py", line 363, in do_rpc
        raise error
    Exception: invoke of talos:machine/getConfiguration:getConfiguration failed: invocation of talos:machine/getConfiguration:getConfiguration returned an error: [AttributeName("machine_secrets").AttributeName("certs").AttributeName("k8s_aggregator")] Missing Configuration for Required Attribute: Must set a configuration value for the machine_secrets.certs.k8s_aggregator attribute as the provider has marked it as required.

    Refer to the provider documentation or contact the provider developers for additional information about configurable attributes that are required.
tried different variations with applys but always a similar errror
e
I thought the _output variants had been added to fix it, but at least on python the code for it looks like it still doesn't handle unknowns
I think it might work on
up
Please raise a bug at github.com/pulumi/pulumi about it though
We should fix this
h
sure. Will do. Got a workaround idea in the meantime?
on up the same happens.
e
the value does print in the apply statement?
h
yes i can print the values and everything is there.
e
hmm ok, not unknowns then
Given that I'd raise this as a provider bug on the talos repo. If you can grab grpc logs (set the envvar PULUMI_DEBUG_GRPC to a file path) those logs would help the provider team debug it
h
which seems to be related to a pulumi - python issue: https://github.com/pulumi/pulumi/issues/15883
Support passing composite output types as input types downstream
Could you please translate this for me?
In the meantime, instead of
client_configuration=secrets.client_configuration
you can assign each field on
client_configuration
individually. It's tedious, but it should get you back running.
e
I think that means writing an apply on
client_configuration
to return a new structure of the expected "type" but just copying each field. Given this is python I'm surprised it doesn't just work though with a cast
cc @limited-rainbow-51650 as his normally around on community slack, he might have a better answer and working work around
h
Alright. Going to try that. Thanks for your help 🙏
Unfortunately this didn't work for me:
Copy code
talos_cluster_secrets.machine_secrets.apply(lambda ms: talos.machine.get_configuration_output(
                ...
                machine_secrets={
                    "secrets": {
                        "bootstrap_token": ms.secrets.bootstrap_token,
..
still gives me:
Copy code
machine_secrets.secrets.bootstrap_token attribute as the provider has marked it as required.
no idea why but this seems to work for now:
Copy code
talos_cluster_secrets.machine_secrets.apply(lambda ms: talos.machine.get_configuration_output(
                ...
                machine_secrets={
                    "secrets": {
                        "bootstrapToken": ms.secrets.bootstrap_token,
..
(using camelCase for these properties)
e
ah interesting, I think that's probably because of https://github.com/pulumi/pulumi/issues/15883 but glad you worked around it