Skip to content

error importing aws_instance with ebs_volume #337

@tparvu

Description

@tparvu

General information:

  • Operating System:

Archlinux

  • Terracognita version / tag:

v0.8.1

  • Did you build Terracognita from sources or did you use the Docker image:

Built from source, but docker image will error as well.

Describe the bug:

When importing a aws_instance resource that has an attached EBS volume Terracognita writes;

tags { instead of tags = {

Running a Terraform plan on results....
Using region = us-east-2
,╷
│ Error: Unsupported block type
│ 
│   on ec2_elastic_compute_cloud.tf line 37, in resource "aws_instance" "testbed":
│   37:     tags {
│ 
│ Blocks of type "tags" are not expected here. Did you mean to define argument "tags"? If so, use the equals sign to assign it a value.
╵
➜  terracognita git:(update-provider) ✗ 

Additional context

Original HCL;

resource "aws_instance" "testbed" {
  ami                         = data.aws_ami.debian.id
  instance_type               = var.instance_type
  subnet_id                   = aws_subnet.testbed_subnet.id
  associate_public_ip_address = true
  key_name                    = var.key_name
  vpc_security_group_ids      = [aws_security_group.allow_tests.id]

  tags = {
    Name        = var.instance_name
    Project     = var.project
    Desc        = var.description
    Contact     = var.contact
    Environment = var.environment
  }

  # root disk
  root_block_device {
    volume_size           = "16"
    volume_type           = "gp2"
    encrypted             = true
    delete_on_termination = true

    tags = {
      Name = "root disk"
      Desc = "Root disk for testbed"
    }
  }

  # data disk
  ebs_block_device {
    volume_size = "64"
    volume_type = "gp2"
    encrypted   = true
    device_name = "/dev/sdf"

    tags = {
      Name   = "testbed data disk"
      Desc   = "Inspire11 DevOps testbed data disk"
      Backup = "false"
    }
  }

}

Add any other context about the problem here.

Other maps are working fine, no idea what the issue is the ebs_block_device map.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions