Error: invalid value for name when creating a Lightsail instance

Hello all,

I’m trying to launch a Lightsail instance and I get the following error:

'Error: invalid value for name (must contain only alphanumeric characters, underscores, hyphens, and dots)

│ with aws_lightsail_instance.lightsail_instance,
│ on main.tf line 7, in resource “aws_lightsail_instance” “lightsail_instance”:
│ 7: name = “hello”

Here is my main.tf file

’ # Configure the AWS Provider
provider “aws” {
region = “us-east-2”
}
#creating the lightsail instance
resource “aws_lightsail_instance” “lightsail_instance” {
name = “hello”
availability_zone = “us-east-2a”
blueprint_id = “ubuntu_20_04”
bundle_id = “nano_1_0”
tags = {
name = “devops”
env = “dev”
}
} ’

I have modified the value on the name to no avail.
Need help please

Thanks

1 Like

Probably a bug in terraform-provider-aws.
Try fixing to 5.15.0 as a workaround.

terraform {
required_providers {
aws = {
source = “hashicorp/aws”
version = “5.15.0”
}
}
}