You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using a template to provide initial configuration data for my EC2 instances. Part of that configuration is to set a host name using a defined prefix and the counter as a suffix.
The result is all instances are getting the same name 0, as 0 is the first counter index. I use the same variable to set apply tags to the EC2 instance and node in chef and they increment just fine. The only place it doesn't is with the template.
On face value it appears that the template does not not reevaluate the passed variables after they are first set.
The temple resource is configured as
data "template_file" "file_server" {
template = "${file("userdata.txt")}"
vars {
admin_password="${var.administrator_pw}"
hostname = "${var.file_server.["hostname_prefix"]}-${count.index}"
}
}
This issue has been automatically migrated to hashicorp/terraform-provider-template#12 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.
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
locked and limited conversation to collaborators
Apr 8, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm using a template to provide initial configuration data for my EC2 instances. Part of that configuration is to set a host name using a defined prefix and the counter as a suffix.
The result is all instances are getting the same name 0, as 0 is the first counter index. I use the same variable to set apply tags to the EC2 instance and node in chef and they increment just fine. The only place it doesn't is with the template.
On face value it appears that the template does not not reevaluate the passed variables after they are first set.
The temple resource is configured as
It is applied against the AWS resource as
[user_data = "${data.template_file.file_server.rendered}"]
In the user data file I am referring to the variable with the following line
Rename-Computer -NewName "${hostname}" -Restart -Confirm:$False
I would expect that my servers are named fs-0, fs-1 ..... but the host name is set as fs-0 for every server.
This is on Terraform 0.9.6
The text was updated successfully, but these errors were encountered: