If I use package 'pulumi_eks' to create a cluster ...
# general
r
If I use package 'pulumi_eks' to create a cluster and disable the default providers (
disable-default-providers: *
), it seems there's no way to config the aws provider for _pulumi_eks_. The old-school way (
opts=pulumi.ResourceOptions(provider=provider
) does not work as the provider in opts here refers to the K8S provider. So I will got this error:
Copy code
Exception: Default provider for 'eks' disabled. 'eks:index:Cluster' must use an explicit provider.
Any help is appreciated for this matter!!
a
Hi. You will need to pass
opts=pulumi.ResourceOptions(provider=eksProvider, providers=[awsProvider, k8sProvider])
.
provider
is used to provision the resource that
opts
is being directly passed to, while
providers
is used to provision matching child resources.
r
Hi @ancient-policeman-24615, thanks for the reply. what is eksProvider, is that the same as the awsProvider? Plus, I tried with
providers
only, but still get this error message:
image.png
a
Sorry for the confusion.
eksProvider
is the provider associated with `pulumi_eks`: https://www.pulumi.com/registry/packages/eks/api-docs/provider/
Each Pulumi Package has their own provider, even if they just serve component resources.
r
Hi @ancient-policeman-24615, now I got some progress, but still problematic. Following is how I use eks.Provider and eks.Cluster:
Copy code
kube_provider = kube.Provider("kubeProvider", kubeconfig="./kubeconfig")
eks_provider = eks.Provider("eks")

...

test_cluster = eks.Cluster(
        name=f"test_{cluster_name}",
        resource_name="test-cluster-resource",
        ...
        vpc_id=default_vpc.id,
        opts = pulumi.ResourceOptions(provider=eks_provider, providers=[aws_provider, kube_provider]),
)
Now I got provider issues from other functions:
Copy code
Exception: Invoke: Default provider for 'aws' disabled. 'aws:index/getPartition:getPartition' must use an explicit provider.
cc: @rich-whale-93740
a
If that is coming from
test_cluster
, then that is a bug in
pulumi-eks
. Sorry about that.