This issue was originally opened by @kojiromike as hashicorp/terraform#14462. It was migrated here as part of the provider split. The original body of the issue is below.
Terraform Version
0.9.5
Affected Resource(s)
Please list the resources as a list, for example:
- aws_instance
- aws_ebs_volume
- aws_volume_attachment
Terraform Configuration Files
- A file in a non-root module:
resource "aws_instance" "test" {
ami = "ami-20328b40"
availability_zone = "us-west-2a"
instance_type = "t2.micro"
subnet_id = "subnet-850585e2"
key_name = "michaels_id_rsa"
tags {
Name = "test-instance"
}
volume_tags {
Name = "test-instance"
}
}
variable "vol_id" {}
resource "aws_volume_attachment" "test" {
device_name = "/dev/xvdf"
instance_id = "${aws_instance.test.id}"
volume_id = "${var.vol_id}"
}
- A root module referencing that file:
provider aws {
region = "us-west-2"
}
resource "aws_ebs_volume" "test" {
availability_zone = "us-west-2a"
size = "1"
type = "gp2"
tags {
Name = "test-vol"
}
}
module "test" {
source = "../../modules/bug"
vol_id = "${aws_ebs_volume.test.id}"
}
Expected Behavior
The tag for aws_ebs_volume.test should consistently be "Name=>vol" according to the tags specified in that resource.
Actual Behavior
The "Name" tag switches back and forth between the value supplied by the aws_ebs_volume and the aws_instance.volume_tags.
Steps to Reproduce
After each subsequent terraform plan/apply, then I do aws --region us-west-2 ec2 describe-volumes --volume-ids "$volid" | jq -c '.Volumes[].Tags' using the volume id grabbed from the first run:
Run 1: [{"Value":"test-vol","Key":"Name"}]
Run 2: [{"Value":"test-instance","Key":"Name"}]
Important Factoids
This is so similar to #729 I almost requested that be reopened, but when I tried to reproduce it in a very simple case without a non-root module, I couldn't. But when I put some components in a module, the problem was evident.
This issue was originally opened by @kojiromike as hashicorp/terraform#14462. It was migrated here as part of the provider split. The original body of the issue is below.
Terraform Version
0.9.5
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Expected Behavior
The tag for
aws_ebs_volume.testshould consistently be "Name=>vol" according to thetagsspecified in that resource.Actual Behavior
The "Name" tag switches back and forth between the value supplied by the
aws_ebs_volumeand theaws_instance.volume_tags.Steps to Reproduce
After each subsequent
terraform plan/apply, then I doaws --region us-west-2 ec2 describe-volumes --volume-ids "$volid" | jq -c '.Volumes[].Tags'using the volume id grabbed from the first run:Run 1:
[{"Value":"test-vol","Key":"Name"}]Run 2:
[{"Value":"test-instance","Key":"Name"}]Important Factoids
This is so similar to #729 I almost requested that be reopened, but when I tried to reproduce it in a very simple case without a non-root module, I couldn't. But when I put some components in a module, the problem was evident.