New to Pulumi. Any assistance appreciated. Trying ...
# getting-started
p
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:
Copy code
// 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:
Copy code
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
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
p
That sounds helpful - so the
aws.eks.Cluster
class is not useful for this?
@alert-eve-30860 my question here ^^
b
@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
well we have an existing eks cluster created via terraform - don't want to mess with it
b
then just grab the cluster name
p
tried that:
Copy code
* 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:
Copy code
pulumi config set kubernetes:context my-context
thanks!
🙌 1