Skip to content

Address Timing Issue during Workspace Destroy #1692

@josephpohlmann

Description

@josephpohlmann

Use-cases

When we create a workspace using this provider, we follow the process:

  1. Create the "tfe_workspace" object
  2. Create the "tfe_variable" objects, using the workspace ID from above (effectively triggering an implicit dependency).

However, due to Terraform destroy rules, the "tfe_variable" objects are destroyed before the "tfe_workspace" destroy is triggered. This results in that workspace unable to be destroyed, as "mandatory workspace variables" are missing. Effectively, we have a chicken-and-egg issue that stops during "destroy planning".

Attempted Solutions

At present there is really no workaround we have found. In general, the only way around this situation is to manually add the variables back into the "workspace to be destroyed" and re-run the "terraform apply" (which skips by the variable deletion because it happened on the previous execution).

Proposal

The fact that the "tfe_variable" object has an implicit dependency upon "tfe_workspace", the only solution I can come up with is to allow the variables to be an inherent class member (similar to tags) that can reside directly within the "tfe_workspace" object. Then, the provider can create the workspace and variables during its provisioning activity, but SKIP the destruction of the variables when running the destroy of the "tfe_workspace".

Alternatively, maybe there is a better answer that I'm unaware of.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions