# Invalid value for name on lightsail import

**URL:** <https://discuss.hashicorp.com/t/invalid-value-for-name-on-lightsail-import/58063>\
**Category:** AWS\
**Created:** [September 8, 2023, 8:27am UTC](https://discuss.hashicorp.com/t/invalid-value-for-name-on-lightsail-import/58063 "2023-09-08T08:27:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronholt1066](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/aaronholt1066/32/16863_2.png) [@aaronholt1066](https://discuss.hashicorp.com/u/aaronholt1066)\
**Post date:** [September 8, 2023, 8:27am UTC](https://discuss.hashicorp.com/t/invalid-value-for-name-on-lightsail-import/58063/1 "2023-09-08T08:27:46Z")

</div>

Hi, i created a couple of lightsail instances manually and now trying to import them to the state file but get the below:

│ Error: invalid value for name (must contain only alphanumeric characters, underscores, hyphens, and dots)  
│  
│ with aws\_lightsail\_instance.totb-learning,  
│ on lightsail.tf line 27, in resource “aws\_lightsail\_instance” “totb-learning”:  
│ 27: name = “totb-learning-01”

even if i just give it a plain text signal name it comes up with the error. I can import the resource into an empty lightsail resource and then do a state show that gives me all the info i need for the required fields, but running a plan/apply just throws this error despite it being the correct name.

any ideas?

---

<div class="post-metadata">

**Author:** ![TakashiAihara](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/takashiaihara/32/37858_2.png) [@TakashiAihara](https://discuss.hashicorp.com/u/TakashiAihara)\
**Post date:** [September 10, 2023, 4:12am UTC](https://discuss.hashicorp.com/t/invalid-value-for-name-on-lightsail-import/58063/2 "2023-09-10T04:12:08Z")

</div>

Probably a bug in terraform-provider-aws.  
We have requested a fix.  
Try fixing to 5.15.0 as a workaround.

terraform {  
required\_providers {  
aws = {  
source = “hashicorp/aws”  
version = “5.15.0”  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![aaronholt1066](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/aaronholt1066/32/16863_2.png) [@aaronholt1066](https://discuss.hashicorp.com/u/aaronholt1066)\
**Post date:** [September 10, 2023, 5:45am UTC](https://discuss.hashicorp.com/t/invalid-value-for-name-on-lightsail-import/58063/3 "2023-09-10T05:45:19Z")

</div>

Sorry - i should have put the provider ver i was using as well but you were spot on, 5.16.0 has the bug but 5.15.0 worked fine.

Thanks for the help
