https://pulumi.com logo
Title
p

polite-kite-18322

10/26/2021, 12:44 AM
New to Pulumi. Any assistance appreciated. Trying to automate deployment of a kubernetes Deployment to aws-eks cluster that already exists. When I run
pulumi up
with this:
// Connect to an EKS cluster
const clusterState: aws.eks.ClusterState = {
	arn:  "arn:aws:eks:us-west-2:xxxxxxxxxx:cluster/prod-eks-cluster",
	roleArn: "arn:aws:iam::xxxxxxxxxx:role/prod-eks-role"
};
const cluster = aws.eks.Cluster.get("prod-eks-cluster", "arn:aws:eks:us-west-2:xxxxxxxxxx:cluster/prod-eks-cluster", clusterState);
I get this error:
aws:eks:Cluster (prod-eks-cluster):
    error: Preview failed: refreshing urn:pulumi:credit-queue-consumer::credit-queue-consumer::aws:eks/cluster:Cluster::prod-eks-cluster: 1 error occurred:
        * error reading EKS Cluster (arn:aws:eks:us-west-2:xxxxxxxxxx:cluster/prod-eks-cluster): InvalidParameterException: The name parameter contains invalid characters. It should begin with letter or digit and can have any of the following characters: the set of Unicode letters, digits, hyphens and underscores.
    {
      RespMetadata: {
        StatusCode: 400,
        RequestID: "ff224265-9991-4840-9a91-91bd4a010dc1"
      },
      ClusterName: "arn:aws:eks:us-west-2:xxxxxxxxxx:cluster/prod-eks-cluster",
      Message_: "The name parameter contains invalid characters. It should begin with letter or digit and can have any of the following characters: the set of Unicode letters, digits, hyphens and underscores."
    }
The documentation for
aws.eks.Cluster.get
suggests that
id
is the unique provider id of the resource to lookup, but this error response looks like it's being interpreted as the
ClusterName
. What format should the
id
take?
b

billowy-army-68599

10/26/2021, 2:29 AM
EKS/kubernetes clusters are sort of unique in that, you don't need to retrieve them, you just need to build a kubeconfig. You know the name of cluster, so build a kubeconfig using that and go from there
f

fast-easter-23401

10/26/2021, 3:18 PM
p

polite-kite-18322

10/26/2021, 6:01 PM
That sounds helpful - so the
aws.eks.Cluster
class is not useful for this?
@alert-eve-30860 my question here ^^
b

billowy-army-68599

10/26/2021, 6:02 PM
@polite-kite-18322 there's the
aws.eks.Cluster
resource which is part of the aws provider, but we also have pulumi-eks which will set up all of the nodes and iam roles and provision you a kubeconfig
we strongly recommend using pulumi-eks
p

polite-kite-18322

10/26/2021, 6:03 PM
well we have an existing eks cluster created via terraform - don't want to mess with it
b

billowy-army-68599

10/26/2021, 6:12 PM
then just grab the cluster name
p

polite-kite-18322

10/26/2021, 6:59 PM
tried that:
* error reading EKS Cluster (arn:aws:eks:us-west-2:xxxxxxxxxx:cluster/prod-eks-cluster): InvalidParameterException: The name parameter contains invalid characters. It should begin with letter or digit and can have any of the following characters: the set of Unicode letters, digits, hyphens and underscores.
(repeated from the start of the thread)
found it:
pulumi config set kubernetes:context my-context
thanks!
🙌 1