Skip to content
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

Terraform volume tags changes on alternate run if defined in both aws_instance and aws_ebs_volume resources #18713

Closed
saveshnshetty opened this issue Aug 20, 2018 · 2 comments

Comments

@saveshnshetty
Copy link

Hi team,
I've defined volume tags in aws_instance resource and aws_ebs_volume resource since I need to add tags to root volume also. But when I ran "terraform apply" second time. Ebs volumes tags got replaced with aws instance volume tags. On third run it got replaced with original ebs volume tags .
This tags changes alternatively . Can you please look into it .

syntax :
resource "aws_instance" "app" {
count = "1"
ami = "${lookup(var.ami,var.region)}"
ebs_optimized = "${var.ebs_optimized}"
instance_type = "${var.instance_type_app}"
monitoring = "${var.monitoring}"
key_name = "${var.key_name}"
user_data = "${data.template_file.userdata-app..rendered[count.index]}"
network_interface {
network_interface_id = "${element(aws_network_interface.network-interface-app.
.id, count.index)}"
device_index = 0
}
tags {
Name = "$app-${count.index + 1}"
Type = "app"
Env = "${var.env}"
Customer_id = "${var.customer_id}"
}

	root_block_device {
		volume_type           = "${var.root_volume_type}"
		volume_size           = "${var.root_volume_size}"
		delete_on_termination = "${var.root_delete_on_termination}"
	}


	volume_tags {
		Name                  = "${var.env}-s4hana-app-${count.index + 1}"
		Type                  = "root-volume"
		Env                   = "${var.env}"
        Customer_id           = "${var.customer_id}"
	}

}

resource "aws_ebs_volume" "ebs-app" {
count = "${var.app_count}"
availability_zone = "****"
size = "${var.ebs_volume_size[0]}"
type = "${var.ebs_volume_type[0]}"
tags {
Name = "app-tmp"
Type = "ebs-volume"
Env = "${var.env}"
Customer_id = "${var.customer_id}"
}
}

@ghost
Copy link

ghost commented Aug 20, 2018

This issue has been automatically migrated to hashicorp/terraform-provider-aws#5609 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-aws#5609.

@ghost
Copy link

ghost commented Apr 2, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants