When using the Automation API, how can I override ...
# automation-api
c
When using the Automation API, how can I override the default providers? Background: I am writing end-to-end tests. First, I deploy a GKE stack. It provides a kubeconfig in its outputs and I would like to reuse it to deploy stuff on the cluster. I know I can pass the kubeconfig to the 2nd pulumi program as a config value, but that would require boilerplate code I'd like to avoid (because there are many pulumi programs i want to programmatically deploy in my tests).
According to the code, it's not possible 😕
m
What would be a possible idea on how you would pass the informations?
c
That's a good question. I am not sure about that. Maybe by adding a
default_provider_parameters
to
StackSettings
, and a few
${PROVIDER_NAME}ProviderArgs
classes? We'd end up with something like this:
Copy code
pulumi.automation.select_stack(
    'foo',
    work_dir='/path/to/project',
    opts=LocalWorkspaceOptions(
        stack_settings={
            'foo': StackSettings(
                default_provider_parameters=[
                    KubernetesProviderArgs(kubeconfig=kubeconfig),
                ],
            ),
        },
    ),
)
Not super pretty but it would do the trick. Of course, that may be too complicated for an edge case. For now, I pass the
kubeconfig
as a configuration value and it works. I can definitely live with this.
m
If you want, open an issue for this we can discuss this idea with a larger audience.
c
Not sure it's a good idea to pollute the project's Github with every potentially bad idea I have. 😅 I'll work with my current implementation for a while so I get a better understand of what I actually need.