hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
43.16k stars 9.58k forks source link

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

Closed saveshnshetty closed 6 years ago

saveshnshetty commented 6 years ago

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 commented 6 years ago

This issue has been automatically migrated to terraform-providers/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 terraform-providers/terraform-provider-aws#5609.

ghost commented 4 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.