Terraform: aws_instance.volume_tags gets confused when > 1 volume attached

Created on 1 May 2017  ยท  16Comments  ยท  Source: hashicorp/terraform

It seems the new volume_tags (thanx btw!) gets confused when there's more than one volume attached to an instance.

Terraform Version

0.9.4

Affected Resource(s)

Please list the resources as a list, for example:

  • aws_instance

Terraform Configuration Files

resource "aws_instance" "instance" {
  root_block_device {
    volume_type               = "standard"
    volume_size               = 8
  }

  volume_tags {
    Name                      = "my-instance-root"
  }
}

resource "aws_ebs_volume" "instance" {
  tags {
    Name                      = "my-instance-db"
  }
}

resource "aws_volume_attachment" "instance" {
  instance_id                 = "${aws_instance.instance.id}"
  volume_id                   = "${aws_ebs_volume.instance.id}"
  device_name                 = "/dev/sdb"
}

Expected Behavior

Nothing.

Actual Behavior

Every other time it modified the aws_ebs_volume tags and every other on the aws_instance.

Steps to Reproduce

  1. terraform apply
bug provideaws

Most helpful comment

ok, as promised to @stack72 , confirming that this is not solved.

Example:

aws_instance has

volume_tags {
Name = "A"
}

and there is second aws_ebs_volume / aws_volume_attachment with

tags{
Name = "B"
}

First apply sets root volume with Name=A and second volume Name=B
second apply changes second volume tag to Name=A
third changes it to Name=B and so on.

Expected behaviour:
root volume gets tags from volume_tags
any additionally attached volumes can override those tags with tags block

All 16 comments

That is, it sometimes thinks that the tag on aws_ebs_volume is the root volume..

I have the same issue.

Looks like it is not matching this definition

A mapping of tags to assign to the devices created by the instance at launch time.

and trying to manage separately created and then attached volumes.

Hi @FransUrbo / @stumyp

I am currently looking into this now

Paul

I also confirm the issue.

I also confirm the issue.

Seems related to #14019?
I too, am affected by this issue.

We are seeing the same issue.

This is already fixed in 9.5

Thanks for letting us know, @ezalejski! Indeed it looks like this issue was addressed by #14007, which was included in the 0.9.5 release, so I'm going to close this.

I'm still seeing this issue with Terraform v0.9.5.

First time when the instance and ebs volumes are created it sets the correct tags - root volume gets the tags from volume_tags, ebs volumes get their own.
When I recreate the instance keeping the existing ebs volumes, all tags are replaced by the ones in volume_tags.

v0.9.5 Fixed the issue when the tags were just disappearing. Now it just sets the incorrect ones.

ok, as promised to @stack72 , confirming that this is not solved.

Example:

aws_instance has

volume_tags {
Name = "A"
}

and there is second aws_ebs_volume / aws_volume_attachment with

tags{
Name = "B"
}

First apply sets root volume with Name=A and second volume Name=B
second apply changes second volume tag to Name=A
third changes it to Name=B and so on.

Expected behaviour:
root volume gets tags from volume_tags
any additionally attached volumes can override those tags with tags block

https://github.com/hashicorp/terraform/issues/14107#issuecomment-302912704
same issue here.

commenting out volume_tags to work around issue.

@apparentlymart @stack72 Could someone please reopen this issue since it isn't solved?

@apparentlymart @stack72 FYI, though hashibot closed this a few months ago, it is still an issue as of terraform 0.11.1
I added a second volume to an existing instance with its own tags, and now aws_instance and aws_ebs_volume take turns performing an update in place to toggle the tags back and forth.

Hi @ddsdevon! This issue was migrated to terraform-providers/terraform-provider-aws#729 as part of splitting the AWS provider out into its own repository. The AWS provider is no longer developed in this repository.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rjinski picture rjinski  ยท  3Comments

ronnix picture ronnix  ยท  3Comments

zeninfinity picture zeninfinity  ยท  3Comments

franklinwise picture franklinwise  ยท  3Comments

pawelsawicz picture pawelsawicz  ยท  3Comments