terraform: do not create new ec2 resource when `user_data` changes
authorConnor Sheehan <sheehan@mozilla.com>
Fri, 10 May 2019 13:17:38 -0400
changeset 7011 13f70d71ae3a90e43f3e1c481f2c68609e5bf226
parent 7010 342896d12d0932de756f4eb87205c04cbe460c10
child 7012 ca6924b0110d8f9b745afa16bbc43f59c5a20f7f
push id3491
push usercosheehan@mozilla.com
push dateMon, 13 May 2019 17:36:05 +0000
treeherderversion-control-tools@91edbf180dfb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
terraform: do not create new ec2 resource when `user_data` changes Changes to user data shouldn't create a new resource. Any user data changes will be manually applied to the extra mirrors as needed.
terraform/modules/hgweb-mirror/main.tf
--- a/terraform/modules/hgweb-mirror/main.tf
+++ b/terraform/modules/hgweb-mirror/main.tf
@@ -12,16 +12,20 @@ resource "aws_instance" "hgweb-mirror" {
   user_data = "${var.user_data}"
 
   root_block_device {
     delete_on_termination = true
     volume_size = 150
     volume_type = "standard"
   }
 
+  lifecycle {
+    ignore_changes = ["user_data"]
+  }
+
   tags {
     Name = "hgweb instance"
   }
 }
 
 resource "aws_lb_target_group_attachment" "mirror-attachment" {
   target_group_arn = "${var.elb_target_group_arn}"
   target_id = "${aws_instance.hgweb-mirror.id}"