Hi, anyone else running into this error `Duplicate...
# general
n
Hi, anyone else running into this error
Duplicate resource URN 'urn:pulumi:staging::my-kubernetes::kubernetes:<http://helm.sh/v3:Release::cluster-autoscaler';|helm.sh/v3:Release::cluster-autoscaler';> try giving it a unique name
when using Helm Releases?
the code looks like:
Copy code
def deploy_cluster_autoscaler(cluster_name):
    cluster_autoscaler = Release(
        resource_name="cluster-autoscaler",
        args=ReleaseArgs(
            chart="cluster-autoscaler",
            name=f"cluster-autoscaler-{cluster_name}",
            version="9.25.0",
            namespace="kube-system",
            repository_opts=RepositoryOptsArgs(
                repo="<https://kubernetes.github.io/autoscaler>"
            ),
            values={"autoDiscovery": {"clusterName": f"{cluster_name}"}},
        ),
    )
    return cluster_autoscaler
b
what’s the whole code?
n
just updated it, it's all in one function called from main
b
let me rephrase, how are you invoking the function? the error indicates you’re calling it twice
you likely want to give the resource name some uniqueness
Copy code
def deploy_cluster_autoscaler(cluster_name):
    cluster_autoscaler = Release(
        resource_name=f"cluster-autoscaler-{cluster_name}",
        args=ReleaseArgs(
            chart="cluster-autoscaler",
            name=f"cluster-autoscaler-{cluster_name}",
            version="9.25.0",
            namespace="kube-system",
            repository_opts=RepositoryOptsArgs(
                repo="<https://kubernetes.github.io/autoscaler>"
            ),
            values={"autoDiscovery": {"clusterName": f"{cluster_name}"}},
        ),
    )
    return cluster_autoscaler
n
I provided more details in a similar issue on github. It's being called as so:
Copy code
policy = pulumi.Output.all(
        oidc_provider_arn=eks_cluster.core.oidc_provider.arn,
        cluster_oidc_provider_url=eks_cluster.core.oidc_provider.url,
    ).apply(
        lambda args: deploy_cluster_autoscaler(
            args["oidc_provider_arn"],
            args["cluster_oidc_provider_url"],
            cluster_auto_scaler,
            cluster_name,
        )
    )

def create_autoscaling_role(
    oidc_provider_arn,
    oidc_provider_url,
    oidc_iam_policy,
    cluster_autoscaler_iam_policy,
    cluster_name,
):
...
    deploy_cluster_autoscaler(cluster_name)
    return cluster_autoscaler_iam_role
b
see above, I think that’s really the issue, you’re creatring two helm release reosurces with the same name
n
Thank you @billowy-army-68599 - that was exactly it.