Open
Description
Terraform Configuration Files
Initial configuration:
resource "tfe_workspace" "test" {
name = "foo"
# VCS and other configurations
# [...]
}
resource "tfe_workspace_run" "test" {
workspace_id = tfe_workspace.test.id
destroy {
manual_confirm = false
}
}
Next iteration:
resource "tfe_workspace_run" "test" {
# Same as before
# [...]
apply {
manual_confirm = false
}
}
Expected Behavior
The tfe_workspace_run
resource would have been recreated (because of the ID change), and a run triggered.
Actual Behavior
- A Terraform run with the initial configuration adds the
workspace_run
resource to the state, with a random ID. - After adding an
apply
block to the configuration, the nextterraform apply
detects that theapply
block doesn't exist in the state, but doesn't check the new configuration. The resource is kept in the state with the same random ID, updated with the new (apply
) configuration, but nothing else is done as theresourceTFEWorkspaceRunUpdate()
does nothing. - Next Terraform run (without any config changes), finds the
apply
block in the state, but obviously fails to find a Run matching the random ID. Thus it drops the old state, and lets Terraform to create a new resource, now also triggering the run to the workspace.