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

lifecycle with aws_instance causes diffs didn't match during apply #3739

Closed
davedash opened this issue Nov 3, 2015 · 4 comments
Closed

lifecycle with aws_instance causes diffs didn't match during apply #3739

davedash opened this issue Nov 3, 2015 · 4 comments

Comments

@davedash
Copy link
Contributor

davedash commented Nov 3, 2015

When I add the following lifecycle to an instance:

resource "aws_instance" "instance" {
  ami = "${var.ami}"  # Ubuntu HVM
  instance_type = "${var.instance_type}"

  tags {
    Name = "${var.env}-${var.name}${var.name_suffix}"
    env = "${var.env}"
    role = "${var.env}-${var.name}"
  }

  ebs_block_device {
    encrypted = 1
    device_name = "/dev/sdf"
    volume_type = "gp2"
    volume_size = 50
  }

  security_groups = ["${split(",", var.security_groups)}"]

  subnet_id = "${element(split(",", var.subnets), var.number)}"

  iam_instance_profile = "${var.env}-${var.name}"
  ebs_optimized = "${var.ebs_optimized}"
  user_data = "${file(var.user_data)}"
  key_name = "davedash"

  lifecycle {
    ignore_changes =["user_data"]
  }

}

I get the following after a terraform plan/apply:

Error applying plan:

1 error(s) occurred:

* aws_instance.instance: diffs didn't match during apply. This is a bug with Terraform and should be reported.

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

I'll branch my code so I can pull out any other relevant details.

@phinze
Copy link
Contributor

phinze commented Nov 4, 2015

This might be related to #2627

@spiffxp
Copy link

spiffxp commented Jan 22, 2016

Running into this exact problem as well with terraform 0.6.8

@phinze
Copy link
Contributor

phinze commented Mar 14, 2016

Hi folks! Some causes of diffs didn't match during apply were fixed up in #4965 - I'm attempting to tackle the remainder of known issues in #5627, so head there if you are still seeing troubles with ignore_changes in v0.6.12.

@phinze phinze closed this as completed Mar 14, 2016
omeid pushed a commit to omeid/terraform that referenced this issue Mar 30, 2018
…-scaling_adjustment

resource/autoscaling_policy: fix conditional logic based on policy type
omeid pushed a commit to omeid/terraform that referenced this issue Mar 30, 2018
@ghost
Copy link

ghost commented Apr 27, 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.

@hashicorp hashicorp locked and limited conversation to collaborators Apr 27, 2020
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

3 participants