I'm trying to implement AppMesh with ECS using terraform. Once I run terraform apply, during creation of aws_appmesh_gateway_route, I'm getting an error saying:
Error: error creating App Mesh gateway route: BadRequestException: VirtualGatewayName must match ^[a-zA-Z0-9-_]+$.
Here is the code block which I'm using:
resource "aws_appmesh_gateway_route" "test" {
name = "test"
mesh_name = "test-appmesh"
virtual_gateway_name = "aws_appmesh_virtual_gateway.test"
spec {
http_route {
action {
target {
virtual_service {
virtual_service_name = "aws_appmesh_virtual_service.servicea"
}
}
}
match {
prefix = "/"
}
}
}
You are providing a string to the
virtual_gateway_nameargument which has a dot:aws_appmesh_virtual_gateway . test
Just replace the dot with an underline:
aws_appmesh_virtual_gateway_testor with something else which adheres to this pattern^[a-zA-Z0-9-_]+$.