Invoke actions in Terraform Developer Portal
Terraform Developer Portal lets application developers invoke Terraform actions on their applications and installed add-ons to run predefined maintenance tasks, such as invalidating a cache or restarting a virtual machine, and to review each action's invocation history.
Platform engineers can define Terraform actions in the no-code modules that back their templates and add-on definitions. Each provider defines its own actions for maintenance workflows. For example, a provider action can shut down a virtual machine. Terraform Developer Portal makes actions from the module available to application developers.
Refer to the action block reference for information on how to define actions in Terraform configuration.
Prerequisites
To trigger a Terraform action in a Terraform Developer Portal application or add-on, you must define an action in the no-code module used to deploy them.
Invoke an action
To invoke an action defined in the no-code module for an application or an add-on, complete the following steps:
- Sign in to HCP Terraform and select the organization where you want to invoke the action.
- In the navigation menu, click Developer Portal.
- Click Applications in the sidebar, then click on the application with the action or add-on action that you want to invoke.
- Optionally, if you are invoking an action on an installed add-on, click Installed add-ons in the left navigation panel, then click the name of the add-on with the action you want to invoke.
- Click Actions in the left navigation panel.
- Click the name of the action you want to invoke.
- Click the Invoke button.
- In the Select a run type dropdown, choose Plan and apply, then click Invoke.
Terraform Developer Portal redirects you to the Terraform run in the workspace backing your application or add-on. After HCP Terraform completes the plan operation, it automatically applies it to invoke the action and displays the result.
View action invocation history
To view an action's run history for an application or add-on, complete the following steps:
- Sign in to HCP Terraform and select the organization where you want to review the action history.
- In the navigation menu, click Developer Portal.
- Click Applications in the sidebar, then click on the application with the action or add-on action that you want to review.
- Optionally, to review the invocation history for an installed add-on, click Installed add-ons in the left navigation panel, then click the name of the add-on with the action history you want to review.
- Click Actions in the left navigation panel.
- In the action overview, Terraform Developer Portal displays the details for the latest invocation. To view the entire invocation history for the action, click View invocation history on workspace.