# │ Error: Unsupported attribute - This object has no argument, nested block, or exported attribute named "Name"

**URL:** <https://discuss.hashicorp.com/t/error-unsupported-attribute-this-object-has-no-argument-nested-block-or-exported-attribute-named-name/31765>\
**Category:** AWS\
**Created:** [November 10, 2021, 9:28pm UTC](https://discuss.hashicorp.com/t/error-unsupported-attribute-this-object-has-no-argument-nested-block-or-exported-attribute-named-name/31765 "2021-11-10T21:28:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdubb123](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/tdubb123/32/5511_2.png) [@tdubb123](https://discuss.hashicorp.com/u/tdubb123)\
**Post date:** [November 10, 2021, 9:28pm UTC](https://discuss.hashicorp.com/t/error-unsupported-attribute-this-object-has-no-argument-nested-block-or-exported-attribute-named-name/31765/1 "2021-11-10T21:28:18Z")

</div>

trying to run this simple terraform script

```auto
variable "instance_count" {
    default = "1"
}

provider "aws" {
  region = "us-west-1"
}

resource "aws_instance" "example" {
  ami = "ami-0cf4a2d03d1a3d62c"
  instance_type = "t2.micro"
  key_name = "t2micro-1"
  subnet_id = "subnet-0d9d37440a2265163"
  security_groups = ["${aws_security_group.allow_rdp.Name}"]
}

resource "aws_security_group" "allow_rdp" {
  name = "allow_rdp"
  description = "Allow ssh traffic"
  vpc_id = "vpc-013c7c9a647b7342b"

  ingress {

    from_port = 3389 # By default, the windows server listens on TCP port 3389 for RDP
    to_port = 3389
    protocol = "tcp"

    cidr_blocks = ["0.0.0.0/0"]
  }
}

```

but ghetting the error

```auto
Error: Unsupported attribute
│ 
│ on ec2.tf line 14, in resource "aws_instance" "example":
│ 14: security_groups = ["${aws_security_group.allow_rdp.Name}"]
│ 
│ This object has no argument, nested block, or exported attribute named "Name". Did you mean "name"?
╵

```

---

<div class="post-metadata">

**Author:** ![tdubb123](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/tdubb123/32/5511_2.png) [@tdubb123](https://discuss.hashicorp.com/u/tdubb123)\
**Post date:** [November 10, 2021, 9:47pm UTC](https://discuss.hashicorp.com/t/error-unsupported-attribute-this-object-has-no-argument-nested-block-or-exported-attribute-named-name/31765/2 "2021-11-10T21:47:55Z")

</div>

i changed it to

```auto
resource "aws_instance" "example" {
  ami = "ami-0cf4a2d03d1a3d62c"
  instance_type = "t2.micro"
  key_name = "t2micro-1"
  subnet_id = "subnet-0d9d37440a2265163"
  security_groups = ["allow_rdp"]

```

but then got another error

```auto
Error: Error launching source instance: InvalidGroup.NotFound: The security group 'allow_rdp' does not exist in VPC 'vpc-013c7c9a647b7342b'
│ status code: 400, request id: e747fc43-28e1-4291-bee9-2d7bf01bd1ee
│ 
│ with aws_instance.example,
│ on ec2.tf line 9, in resource "aws_instance" "example":
│ 9: resource "aws_instance" "example" {

```

---

<div class="post-metadata">

**Author:** ![apparentlymart](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/apparentlymart/32/702_2.png) [@apparentlymart](https://discuss.hashicorp.com/u/apparentlymart)\
**Post date:** [November 12, 2021, 2:13am UTC](https://discuss.hashicorp.com/t/error-unsupported-attribute-this-object-has-no-argument-nested-block-or-exported-attribute-named-name/31765/3 "2021-11-12T02:13:56Z")

</div>

Hi @tdubb123,

I think the typo mentioned in the error message is the main problem here: you need to write `name` with a lowercase `n`, not with an uppercase `N`:

```auto
  security_groups = [aws_security_group.allow_rdp.name]

```

(I also removed the `"${` and `}"` syntax because that is only needed when you are combining multiple values together using a string template; there’s no need for that when you just want to use a single string value directly.

With that said, if I recall correctly security group _names_ are only for EC2-Classic and so unless you have a very old AWS account you’ll probably need to use the `vpc_security_group_ids` argument instead, like this:

```auto
  vpc_security_group_ids = [aws_security_group.allow_rdp.id]

```

(Notice that for this argument we need to use the `id` attribute of the security group, rather than the `name` attribute. This is just a quirk of the differences between the legacy EC2-Classic and modern EC2; for modern EC2, security groups are always identified by a server-assigned ID rather than by the name you specified.)
