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
Calling Delete -> Create when Update is empty will result in Delete operation done using new state, instead of old state. For example in the following script, Delete will run rm /tmp/shell/folder/test1 instead of rm /tmp/shell/folder/test (which surprisingly does not produce error even though the script return error due to file not exist) when updating environment.File.
$ ls /tmp/shell
ls: /tmp/shell: No such file or directory
$ terraform apply
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# null_resource.directory will be created
+ resource "null_resource""directory" {
+ id = (known after apply)
+ triggers = {
+ "path" = "/tmp/shell/folder"
}
}
# shell_script.github_repository will be created
+ resource "shell_script""github_repository" {
+ dirty = false
+ environment = {
+ "FILE" = "/tmp/shell/folder/test"
}
+ id = (known after apply)
+ output = (known after apply)
+ working_directory = "."
+ lifecycle_commands {
+ create = "touch $FILE"
+ delete = "rm $FILE"
+ read = "echo '{\"name\":\"'\"$FILE\"'\"}'"
}
}
Plan: 2 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
null_resource.directory: Creating...
null_resource.directory: Provisioning with 'local-exec'...
null_resource.directory (local-exec): Executing: ["/bin/sh""-c""mkdir -p /tmp/shell/folder"]
null_resource.directory: Creation complete after 0s [id=8706134334622958825]
shell_script.github_repository: Creating...
shell_script.github_repository: Creation complete after 0s [id=buchmouvvhfkg3qaorj0]
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
$ ls /tmp/shell/folder/
test
$ terraform apply
null_resource.directory: Refreshing state... [id=8706134334622958825]
shell_script.github_repository: Refreshing state... [id=buchmouvvhfkg3qaorj0]
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
# shell_script.github_repository will be updated in-place~ resource "shell_script""github_repository" {
dirty = false~ environment = {
~"FILE" = "/tmp/shell/folder/test" ->"/tmp/shell/folder/test1"
}
id = "buchmouvvhfkg3qaorj0"
output = {
"name" = "/tmp/shell/folder/test"
}
working_directory = "."
lifecycle_commands {
create = "touch $FILE"
delete = "rm $FILE"read = "echo '{\"name\":\"'\"$FILE\"'\"}'"
}
}
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
shell_script.github_repository: Modifying... [id=buchmouvvhfkg3qaorj0]
shell_script.github_repository: Modifications complete after 0s [id=buchmv6vvhfkgjj4kq20]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
Calling Delete -> Create when Update is empty will result in Delete operation done using new state, instead of old state. For example in the following script, Delete will run
rm /tmp/shell/folder/test1
instead of rm/tmp/shell/folder/test
(which surprisingly does not produce error even though the script return error due to file not exist) when updating environment.File.$ ls /tmp/shell/folder/ test
$ ls /tmp/shell/folder/ test test1
i suggest using CustomizeDiffFunc as such
The text was updated successfully, but these errors were encountered: