How to use dynamic resource names in Terraform? : <p>I would like to use the same terraform template for several dev and production environments. </p>

<p>My approach: 
As I understand it, the resource name needs to be unique, and terraform stores the state of the resource internally. I therefore tried to use variables for the resource names - but it seems to be not supported. I get an error message:</p>

<pre><code>$ terraform plan
var.env1
  Enter a value: abc

Error asking for user input: Error parsing address 'aws_sqs_queue.SqsIntegrationOrderIn${var.env1}': invalid resource address "aws_sqs_queue.SqsIntegrationOrderIn${var.env1}"
</code></pre>

<p>My terraform template:</p>

<pre><code>variable "env1" {}

provider "aws" {
        region = "ap-southeast-2"
}

resource "aws_sqs_queue" "SqsIntegrationOrderIn${var.env1}" {
        name = "Integration_Order_In__${var.env1}"
        message_retention_seconds = 86400
        receive_wait_time_seconds = 5
}
</code></pre>

<p>I think, either my approach is wrong, or the syntax. Any ideas?</p>
