I have a Terraform template file which uses some externally sourced modules (Stored in a Git repo) and I am trying to import my ECS cluster and I have tried to run
terraform import module.module_name arn::here
But I get an error regarding resource addressing and that the resource address must contain a full resource spec.
To start the process of importing a resource ensure that the remote backend configuration is set up in the Terraform configuration. Run terraform init to initialize the backend. Initializing the backend... Initializing provider plugins... - Finding latest version of hashicorp/aws...
Currently there are 15 modules available (all include the process to work with Terraform Cloud): terraform-aws-vpc. terraform-aws-ecs-cluster. terraform-aws-ecs-fargate.
Run a terraform plan
first, and you will see all of the resources that your module will be attempting to create.
Find the ECS cluster referenced in there - it will likely show up as Terraform trying to create a new resource (Because that's what it should do :-))
Now that is the name of the Terraform resource you want to address, it'll be much longer than just module.module_name
it'll be something like module.module_name.ecs_cluster.your_ecs_cluster_resource_name
or something.
And then rather than using the ARN as the second argument, you just want to use the cluster name as the documentation states.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With