In the previous tutorial, you provisioned a DynamoDB instance by creating, configuring and applying a run in a workspace.
There are two ways to update your workspace deployments on Terraform Cloud — changing the configuration in VCS or updating variables in the Terraform Cloud UI.
This tutorial will walk you through the Terraform Cloud UI and both approaches.
»Explore your workspace
Within the Terraform Cloud UI, you will notice several menus and options for your workspace, including "Runs", "States", "Variables", "Settings", and the "Queue plan" interface you used to apply the example configuration.
- Runs shows a list of all of the plan and apply actions you have taken with this workspace.
- States shows a list of the entire tfstate file of your workspace after each successful run.
- Variables will let you configure Terraform variables and environment variables.
- Settings contains all of the other configuration for your workspace.
- Queue plan will let you start a new plan.
Since there haven't been any changes since the last successful run, you can safely queue a new plan, and you will see that there were no changes to apply.
One way to update the infrastructure managed by a workspace is by changing your Terraform Cloud variables.
In the Terraform Cloud interface, return to the "Variables" section of your workspace.
First, change the value of
1 and click the
purple "Save variable" button. Then, use the "Queue plan" interface to begin
another run. After the plan completes, the plan log should indicate that there
are "0 to add, 1 to change, 0 to destroy".
In this case, Terraform can make the change to the DynamoDB table without destroying and recreating it. Click the "Confirm & Apply" button, followed by the "Apply Change" button to apply the change.
In other cases, you might need to update infrastructure by directly changing your configuration files. Below, you will update your configuration by using a GitHub Pull Request (PR).
The repository you forked already includes a branch named
changes that you can use to create a pull request. In a normal workflow, you
would make the edits in your code, test them locally using the Terraform CLI,
push them to a branch, and make a pull request from changes you had personally
Visit your fork of the
tfc-guide-example project in
GitHub. From there, click "New pull request" button to create a pull
request. Set the base branch to the
master branch of your fork, and
the compare branch to the
Note: You must create the PR against your personal forked repository. You will need to merge the PR later on in the tutorial and you do not have merge permissions on the official example repo.
Once you have created the pull request, Terraform Cloud will trigger a speculative plan.
Speculative plans are
- plan-only runs - they show a set of possible changes that cannot be applied
- temporary - they won't appear in any log within Terraform Cloud
- individual - they can only be accessed from a direct link on GitHub PR
- non-destructive - no action is taken, no infrastructure is provisioned
You can view this plan by clicking on the "Details" link in the "Checks" portion of your pull request.
You will see that a new run was created, so you can review the plan before merging the pull request. This is another way that teams can collaborate on changes to their Terraform configuration before they are implemented.
Since speculative plans cannot be applied, you will need to merge the pull request before applying this change.
Return to the GitHub UI, and merge the pull request with the "Merge pull request" button.
Switch back to the "Runs" tab for your workspace in Terraform Cloud. You will see that Terraform Cloud picked up the change to your configuration and has started a new run.
Click on the new run in the Terraform Cloud UI, and you'll see the run details. Just as before, you can "Confirm & Apply" the run.
In this tutorial, you configured a new workspace, provisioned infrastructure, and updated that infrastructure. Now, you're ready to destroy it.
In the next tutorial, you will clean up the resources created by your configuration and decide on your next steps for learning and using Terraform Cloud.