-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to provide different Tag for Root and EBS device #9033
Comments
@bflad Any updates on the above issue ? |
I'm also seeing this issue. |
@Kundan123456 Have you tried breaking out additional volumes that aren't root from the resource "aws_vpc" "vpc_01" {
cidr_block = "10.0.0.0/16"
instance_tenancy = "default"
enable_dns_hostnames = true
enable_dns_support = true
tags = {
Name = "Project-vpc-01"
}
}
resource "aws_subnet" "subnet" {
vpc_id = "${aws_vpc.vpc_01.id}"
cidr_block = "10.0.1.0/24"
map_public_ip_on_launch = true
availability_zone = "us-east-2a"
tags = {
Name = "Project-sn-01"
}
}
resource "aws_security_group" "sg_all" {
name = "sg-01"
vpc_id = "${aws_vpc.vpc_01.id}"
tags = {
Name = "Project-sg-01"
}
}
resource "aws_instance" "my-instance" {
count = "2"
ami = "ami-00c79db59589996b9"
instance_type = "c5.large"
subnet_id = "${aws_subnet.subnet.id}"
vpc_security_group_ids = "${aws_security_group.sg_all.id}"
monitoring = true
root_block_device {
volume_size = "8"
volume_type = "gp2"
delete_on_termination = false
}
# Removed EBS block here
tags = {
Name = "Instance-01"
}
volume_tags = {
Name = "Volume-01"
}
}
# Added this
resource "aws_ebs_volume" "secondary" {
availability_zone = "us-east-2a"
size = 8
type = "gp2"
encrypted = true
tags = {
Name = "Volume-02"
}
}
# Added this
resource "aws_volume_attachment" "vol_2" {
device_name = "/dev/sdh" # or something
volume_id = aws_ebs_volume.secondary.id
instance_id = aws_instance.my-instance.id
} |
@cringham Thanks for the workaround. While that would work it seems to cause a different issue of the Having a separate tags block in the *_block_device as proposed in #4017 would be a much cleaner and preferred solution |
@FearlessHyena I have it separate and I do see the same issue. |
We have merged a fix to the Now that the fix is in place, if you find any problems with |
This has been released in version 3.24.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Headline
How do we achieve different tags for root and ebs device under same resource aws_instance ?
Terraform Version
Terraform v0.12.1
provider.aws v2.14.0
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
What I want is to have two different tags for root and ebs device. But volume_tag is giving same tag to both devices.
Something like this:
Root Device Tag: Volume-01-Root
EBS Device Tag: Volume-01-Data
Actual Behavior
It is creating same volume tag for both devices.
Steps to Reproduce
terraform plan
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: