0
votes

I have an existing manually created fargate cluster named "test-cluster" in us-west-1

In terraform configuration file i created

resource "aws_ecs_cluster" "mycluster" {

}

I run terraform command to import the files

terraform import aws_ecs_cluster.mycluster test-cluster

I receive this error message

Error: Cannot import non-existent remote object

While attempting to import an existing object to aws_ecs_cluster.cluster, the provider detected that no object exists with the given id. Only pre-existing objects can be imported; check that the id is correct and that it is associated with the provider's configured region or endpoint, or use "terraform apply" to create a new remote object for this resource.

I've also ran aws configure adding the correct region.

1
You need to define required parameters at minimum and the values have to match the ones you're trying to import, e.g. name = "your-cluster-name".Marko E
If the region is correct, maybe account is not?Marcin
It turns out it was looking at the wrong account.manoman687
Just like I suspected. If you don't mind, I will provide an answer for future reference.Marcin

1 Answers

0
votes

Based on the comments.

The issue was caused by using wrong account in terraform and/or AWS console.

The solution was to use correct account.