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

template_cloudinit_config needs two applys to propagate a change #6899

Closed
wr0ngway opened this issue May 27, 2016 · 4 comments
Closed

template_cloudinit_config needs two applys to propagate a change #6899

wr0ngway opened this issue May 27, 2016 · 4 comments

Comments

@wr0ngway
Copy link

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

0.6.16

Affected Resource(s)

  • template_cloudinit_config

Terraform Configuration Files

resource "template_file" "test" {
  template = "# foo ${bar} baz"
  vars {
    bar = "howdy"
  }
}

resource "template_cloudinit_config" "test" {
  gzip = false
  base64_encode = false

  part {
    content_type = "text/cloud-config"
    content = "${template_file.test.rendered}"
    merge_type = "list(append)+dict(recurse_array)+str()"
  }
}

resource "aws_instance" "test" {
  ami = "ami-5c207736"
  instance_type = "m3.medium"

  user_data = "${template_cloudinit_config.test.rendered}"
}

Debug Output

Panic Output

Expected Behavior

The second terraform apply should change all three resources.

Actual Behavior

Running terraform apply the first time does the right thing. Then change the value of bar variable in template file. When doing the second terraform apply, only changes template_file and template_cloudinit_config, but change doesn't propagate to the aws_instance that is using the template_cloudinit_config. A third terraform apply picks up that change.

Steps to Reproduce

  1. terraform apply All three resources get created
  2. Change the value of bar variable in template_file
  3. terraform apply only changes template_file and template_cloudinit_config, but change doesn't propagate to the aws_instance that is using the template_cloudinit_config
  4. terraform apply The aws_instance finally gets modified

Important Factoids

References

@jrnt30
Copy link
Contributor

jrnt30 commented Jun 11, 2016

We too are seeing this behavior as well. We are using a bit different config, but same results.

Major differences are gzip/base64 & the lack of merge_type, neither of which should matter.

resource "template_cloudinit_config" "cloud_init" {
  gzip          = true
  base64_encode = true

  part {
    filename = "init.cfg"
    content  = "${template_file.cloud_config.rendered}"
  }
}

@ColinHebert
Copy link
Contributor

@jen20 I created a quick fix for this one. Would you mind trying to get it shipped with the 0.7 release?

@mitchellh
Copy link
Contributor

Fixed with data sources!

@ghost
Copy link

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

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

Successfully merging a pull request may close this issue.

5 participants