-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Closed
Description
Terraform Version
Terraform v0.12.6
+ provider.aws v2.23.0
+ provider.random v2.2.0
Terraform Configuration Files
resource "aws_lightsail_instance" "test" {
name = "test-${formatdate("YYYYMMDD", timestamp())}"
availability_zone = "eu-west-1a"
blueprint_id = "ubuntu_18_04"
bundle_id = "small_2_0"
}Expected Behavior
Resource replacement every day due to formatdate() interpolation with YYYYMMDD.
Actual Behavior
Resource replacement on every run.
Steps to Reproduce
terraform initterraform apply
Additional Context
I also tried the same code using random_id with the code example below ;
resource "random_id" "test" {
keepers = {
date = formatdate("YYYYMMDD", timestamp())
}
byte_length = 8
}
resource "aws_lightsail_instance" "test" {
name = "test-${random_id.test}"
availability_zone = "eu-west-1a"
blueprint_id = "ubuntu_18_04"
bundle_id = "small_2_0"
}same problem. Whenever timestamp() is used, a new resource creation is triggered.
The only way I could fix this problem is to define a date variable and pass it via -var on the CLI.
References
Couldn't find any reference specific to this problem.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels