terraform-aws-modules / terraform-aws-ec2-instance

Terraform module to create AWS EC2 instance(s) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws
Apache License 2.0
758 stars 1.88k forks source link

When using "root_block_device" tags a "ConflictsWith" volume_tags error is generated #224

Closed gitbrad closed 3 years ago

gitbrad commented 3 years ago

Description

When using "root_block_device" tags within an instance created by this module, I encounter the following error even though "volume_tags" are not defined.

Error: ConflictsWith

  on modules/terraform-aws-ec2-instance/main.tf line 89, in resource "aws_instance" "this":
  89:   tags = merge(
  90:     {
  91:       "Name" = var.instance_count > 1 || var.use_num_suffix ? format("%s${var.num_suffix_format}", var.name, count.index + 1) : var.name
  92:     },
  93:     var.tags,
  94:   )

"root_block_device.0.tags": conflicts with volume_tags

Versions

Terraform v0.14.9

Reproduction

Steps to reproduce the behavior:

Yes Yes With "volume_tags" not defined, using tags in the "root_block_device" section of an instance created by this module creates an error. ### Code Snippet to Reproduce ``` root_block_device = [ { volume_type = "gp2" volume_size = 250 tags = { snapshotsEnabled = true } }, ] ``` With "volume_tags" omitted ## Expected behavior Terraform is able to cleanly apply the "root_block_device" tags. ## Actual behavior Cannot apply tags to the "root_block_device" using this module with the above information.
argeljoseph commented 3 years ago

You need to set this: enable_volume_tags = false

gitbrad commented 3 years ago

Thanks @argeljoseph that was indeed the fix. Totally missed that!

antonbabenko commented 3 years ago

@argeljoseph Thanks for answering this issue!

github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.