-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Add Timestamp Variable #3326
Add Timestamp Variable #3326
Conversation
Adds a timestamp variable, as "${timestamp}", similar to Packer. Can be useful for naming and other things
This is a great start, @grubernaut! However, I think this should be implemented as an interpolation function instead of a variable. The variable route made sense in Packer, since Packer does not have functions like we do. This also gives us the opportunity to add an optional strftime-style format argument if we'd like. |
Yeah an interpolation function would be a lot cleaner and smoother than this one :) |
Is this available in 0.7.4. however I got error
${timestamp()}
however name is set as "${ timestamp }" Can someone please help ? Am I missing something ? |
Hi @dattatrayakumbhar04! There's no Timestamp functionality currently in Terraform. Nowadays it would probably be implemented as a Data Source. We do have a good story for unique identifiers using the That would look something like this: data "random_id" "bastion" {
byte_length = 8
}
resource "openstack_compute_instance_v2" "bastion" {
name = "bastion-${data.random_id.bastion.hex}"
} |
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. |
Adds a timestamp variable, as "${timestamp}", similar to Packer.
Can be useful for naming and other things