hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.17k forks source link

Ensure that you are using an AMI that is enabled for ENA. #38897

Open Nida1998 opened 2 months ago

Nida1998 commented 2 months ago

Description

data "aws_ebs_snapshot" "sftp-s1" {
  most_recent = true
  owners = ["self"]

  filter {
    name   = "tag:DeviceName"
    values = ["/dev/sdf"]
  }

  filter {
    name   = "tag:Name"
    values = ["server"]
  }
}

resource "aws_ami" "custom_ami" {
  name                = "custom-ami"
  virtualization_type = "hvm"
  root_device_name    = "/dev/sdf"

  ebs_block_device {
    device_name = "/dev/sdf"
    snapshot_id = data.aws_ebs_snapshot.sftp-s1.id
    volume_size = 5
  }

}

resource "aws_instance" "server-sftp" {
  ami           = aws_ami.sftp_ami.id
  instance_type = "t3.medium"
  subnet_id     = var.public_subnet_2a
  root_block_device {
    volume_size = 20
    volume_type = "gp2"  # You can specify the type of volume, e.g., gp2, gp3, io1, io2, etc.
  }
}

I am trying to initiate instance, having ami creating in same terraform script by picking up specific snapshot. but getting below error:

terraform error: Error launching source instance: InvalidParameterCombination: Enhanced networking with the Elastic Network Adapter (ENA) is required for the 't3.large' instance type. Ensure that you are using an AMI that is enabled for ENA.

anywork around is highly appreciated, I need to create multiple instances of size t3.medium.

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 2 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

stefanfreitag commented 2 months ago

Hi @Nida1998!

I was going through your explanation, let me recap what I understood.

When registering an AMI with AWS you need to specify if it supports ENA or not. On a Terraform aws_ami resource there is the attribute ena_support that you could look into.