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

Hash for user_data in a 2nd apply is incorrect and not the same one as apply even if I changed nothing #4327

Closed
vsalama opened this issue Apr 24, 2018 · 2 comments

Comments

@vsalama
Copy link

vsalama commented Apr 24, 2018

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed:
Terraform v0.11.7

Affected Resource(s)

Please list the resources as a list, for example:
provider "aws" version = "1.15.0"
provider "local" version = "1.1.0"
provider "template" version = "1.0.0"

This issue is appears since provider "aws" version = "1.14.1".

Expected Behavior

the 2nd terraform apply to nothing.

Actual Behavior

the 2nd terraform apply try to recreate the launch configuration object because it detect a change in userdata because the hash is different. But that is wrong.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. create main.tf with the code (put the right value for ami and create a file dummy.txt):
terraform {
  required_version = ">= 0.10.6"
}

provider "aws" {
  region = "eu-west-1"
}

resource "aws_launch_configuration" "bastion_lc" {
  name = "test_bastion"
  image_id = "centos_ami_id"
  instance_type = "t2.nano"
  user_data = "${data.template_cloudinit_config.bastion_config_lc.rendered}"

  lifecycle {
    create_before_destroy = true
  }

}

data "template_cloudinit_config" "bastion_config_lc" {
  gzip = true
  base64_encode = true

  part {
    filename = "01-dummy.sh"
    content_type = "text/x-shellscript"
    content = "${data.template_file.dummy.rendered}"
  }
}


data "template_file" "dummy" {
  template = "${file("${path.module}/dummy.txt")}"
}
  1. terraform init
  2. terraform apply
  3. terraform apply
@catsby
Copy link
Contributor

catsby commented Apr 24, 2018

Hello!

I believe this is a duplicate of #4197 . It should be fixed in #4257 . I was able to reproduce your example on the current Provider version. I then compiled the master branch locally and was not able to reproduce the issue anymore.

I cannot promise when the next version (1.16.0) will ship, but I suspected it will be in the next few days.

I'm going to close this issue for now. Sorry for the trouble!

@catsby catsby closed this as completed Apr 24, 2018
@ghost
Copy link

ghost commented Apr 6, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants