From d925abef8d33c2ad296461a0ce8288f62aa965da Mon Sep 17 00:00:00 2001 From: Chance Zibolski Date: Wed, 26 Apr 2017 11:00:07 -0700 Subject: [PATCH 1/2] Ignore AMI changing on worker launch config Prevents terraform from recreating the resource when a new CoreOS release comes out. This an extension of the same changes done to etcd and masters in #367 --- modules/aws/worker-asg/worker.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/aws/worker-asg/worker.tf b/modules/aws/worker-asg/worker.tf index 23bdbbd5a2..a821ff94ad 100644 --- a/modules/aws/worker-asg/worker.tf +++ b/modules/aws/worker-asg/worker.tf @@ -33,6 +33,10 @@ resource "aws_launch_configuration" "worker_conf" { lifecycle { create_before_destroy = true + # Ignore changes in the AMI which force recreation of the resource. This + # avoids accidental deletion of nodes whenever a new CoreOS Release comes + # out. + ignore_changes = ["image_id"] } root_block_device { From d604aa3cd5aa5d983d0f5d4f2de2ff4e05b5e36c Mon Sep 17 00:00:00 2001 From: Chance Zibolski Date: Wed, 26 Apr 2017 11:01:08 -0700 Subject: [PATCH 2/2] Document why image_id changes are ignored in etcd/master launch config --- modules/aws/etcd/nodes.tf | 3 +++ modules/aws/master-asg/master.tf | 6 +++++- modules/aws/worker-asg/worker.tf | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/aws/etcd/nodes.tf b/modules/aws/etcd/nodes.tf index 343f35301e..224e98a67c 100644 --- a/modules/aws/etcd/nodes.tf +++ b/modules/aws/etcd/nodes.tf @@ -33,6 +33,9 @@ resource "aws_instance" "etcd_node" { vpc_security_group_ids = ["${var.sg_ids}"] lifecycle { + # Ignore changes in the AMI which force recreation of the resource. This + # avoids accidental deletion of nodes whenever a new CoreOS Release comes + # out. ignore_changes = ["ami"] } diff --git a/modules/aws/master-asg/master.tf b/modules/aws/master-asg/master.tf index b28e28e653..bc4b79a045 100644 --- a/modules/aws/master-asg/master.tf +++ b/modules/aws/master-asg/master.tf @@ -63,7 +63,11 @@ resource "aws_launch_configuration" "master_conf" { lifecycle { create_before_destroy = true - ignore_changes = ["image_id"] + + # Ignore changes in the AMI which force recreation of the resource. This + # avoids accidental deletion of nodes whenever a new CoreOS Release comes + # out. + ignore_changes = ["image_id"] } root_block_device { diff --git a/modules/aws/worker-asg/worker.tf b/modules/aws/worker-asg/worker.tf index a821ff94ad..8f5e4fdca0 100644 --- a/modules/aws/worker-asg/worker.tf +++ b/modules/aws/worker-asg/worker.tf @@ -33,10 +33,11 @@ resource "aws_launch_configuration" "worker_conf" { lifecycle { create_before_destroy = true + # Ignore changes in the AMI which force recreation of the resource. This # avoids accidental deletion of nodes whenever a new CoreOS Release comes # out. - ignore_changes = ["image_id"] + ignore_changes = ["image_id"] } root_block_device {