Skip to content

Empty tags on root_block_device #219

Closed
@andormarkus

Description

@andormarkus

Description

With V2.18.0 if I don't fill out the tags for the root_block_device then I will get the following error:

│ Error: Incorrect attribute value type
│ 
│   on .terraform/modules/ec2_this/main.tf line 38, in resource "aws_instance" "this":
│   38:       tags                  = lookup(root_block_device.value, "tags", null)
│ 
│ Inappropriate value for attribute "tags": map of string required.

My TF file looks like this:

module "ec2_this" {
  source  = "terraform-aws-modules/ec2-instance/aws"
  version = "2.18.0"

  name                        = "this"
  ami                         =  XXXXXXX
  instance_type               = "t3a.xlarge"
  monitoring                  = true
  vpc_security_group_ids      = XXXXXXX
  subnet_id                   = XXXXXXX

  root_block_device = [
    {
      volume_type = "gp2"
      volume_size = 100
    },
  ]
}

If I put there some placeholder tags I got this error:

│ Error: Invalid value for module argument
│ 
│   on ec2.tf line 109, in module "ec2_this":
│  109:   root_block_device = [
│  110:     {
│  111:       volume_type = "gp2"
│  112:       volume_size = 100
│  113:       tags        = {
│  114:         Name = "fooo"
│  115:       }
│  116:     },
│  117:   ]
│ 
│ The given value is not suitable for child module variable
│ "root_block_device" defined at
│ .terraform/modules/ec2_powerbi_gateway_2/variables.tf:154,1-29: element 0:
│ element "tags": string required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions