Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support and documentation for creating, destroying, and importing run triggers.
Run trigger resources require:
Updating workspace_external_id or sourceable_id will force the creation of a new run trigger resource.
Testing plan
make build
main.tf
. You'll be modifying it in the steps below. Make sure you have a user token added to your~/.terraformrc
file for your TFC hostname.terraform init
.Happy path:
terraform apply
. This should succeed. Check that a run trigger has been created on workspace2 with a source workspace of workspace1. Check that a run trigger has been created on workspace3 with a source workspace of workspace2.Loops:
terraform apply
. This should fail with an error like the following:Workspace and sourceable using same workspace
run-trigger3
resource block and makeworkspace_external_id
andsourceable_id
both point to workspace1:terraform apply
. This should fail with an error like the following:run-trigger3
resource block from your config before moving on to the next section.Destroying run trigger
run-trigger2
resource block from your config.terraform apply
. This should succeed and should destroyrun-trigger2
. Check that the run trigger on workspace3 with a source workspace of workspace2 was destroyed.Changing
workspace_external_id
forces new run trigger:run-trigger1
resource block and makeworkspace_external_id
to point to workspace3terraform apply
. The output should show that one resource was added and 1 was destroyed.Changing
sourceable_id
forces new run trigger:run-trigger1
resource block and makesourceable_id
to point to workspace2terraform apply
. The output should show that one resource was added and 1 was destroyed.External links
Output from acceptance tests