Skip to content

AWS iops attribute is only valid for io1 and io2 type EBS volumes, not gp2, sc1 and st1 types. #157

@ghost

Description

General information:

Describe the bug:

A clear and concise description of what the bug is.

Description: When TerraCognita generates Terraform code for AWS EBS volume types gp2, sc1 and st1 the output includes an iops attribute which is invalid syntax for using with terraform apply.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ebs_volume
iops - (Optional) The amount of IOPS to provision for the disk. Only valid for type of io1 or io2.

Log message

Here you can paste the log message or paste the link to console logs. If the log message is too big, you can use a tool like https://pastebin.com/.

Additional context

Expected: Import AWS resources using TerraCognita and be able to use the resulting Terraform code without modification with terraform apply.

Actual: TerraCognita will output invalid Terraform code that cannot be used with terraform apply as-is.

Reproducing:

  1. Launch EC2 instance.
  2. Import via TerraCognita (example: terracognita aws -i aws_instance --access-key "$(awk '/aws_access_key_id/ {print $3}' ~/.aws/credentials)" --secret-key "$(awk '/aws_secret_access_key/ {print $3}' ~/.aws/credentials)" --region us-east-2 --hcl instance.tf)
  3. Terminate EC2 instance (or don't, it's not essential).
  4. Run terraform apply
  5. Get Error: error creating resource: iops attribute not supported for root_block_device with volume_type gp2
  6. The error is fatal; terrform apply will not not launched any resources.

Add any other context about the problem here.

Running terraform plan will not report the error in the Terraform code.

The iops = "100" (excerpted from /instance.tf generated above) is invalid syntax for terraform apply:

  root_block_device {
    delete_on_termination = true
    iops                  = 100
    volume_size           = 8
    volume_type           = "gp2"
  }

I tested with Terraform versions v0.12.29 and v0.14.2.

Metadata

Metadata

Assignees

Labels

Provider: AWSIssues related to the AWS ProviderType: BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions