Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Commit

Permalink
Ignore AMI updates on etcd/master nodes
Browse files Browse the repository at this point in the history
Currently if a new version of CoreOS comes out on a user's configured
channel after they've already deployed, and they re-run terraform apply,
Terraform will detect the new AMI, and when reconciling desired state,
it will attempt to destroy existing nodes to update the AMI.

In order to avoid this, I added a ignore_changes to both the etcd node
resource, and the master launch configuration resource, to avoid
updating masters/etcd nodes if the AMI changes.

Longer term, I would expect the Container Linux Update Operator, or a
terraform operator could resolve this, but this seems like a reasonable
change to prevent accidental destruction of a cluster.

Previously this change also set prevent_destroy, but that cannot be
parameterized with vars, so it was removed.
  • Loading branch information
Chance Zibolski committed Apr 26, 2017
1 parent cbe1d2c commit abb1aef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/aws/etcd/nodes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ resource "aws_instance" "etcd_node" {
user_data = "${ignition_config.etcd.*.rendered[count.index]}"
vpc_security_group_ids = ["${var.sg_ids}"]

lifecycle {
ignore_changes = ["ami"]
}

tags = "${merge(map(
"Name", "${var.cluster_name}-etcd-${count.index}",
"KubernetesCluster", "${var.cluster_name}"
Expand Down
1 change: 1 addition & 0 deletions modules/aws/master-asg/master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ resource "aws_launch_configuration" "master_conf" {

lifecycle {
create_before_destroy = true
ignore_changes = ["image_id"]
}

root_block_device {
Expand Down

0 comments on commit abb1aef

Please sign in to comment.