Terraform
import function reference overview
This topic provides an overview of the Sentinel import
function, which you can use to import Sentinel libraries into your custom Sentinel policies. Refer to Define custom Sentinel policies for additional information about how to use the import
function.
Functions for Terraform
You can add Sentinel the import
function, which enables a policy to access reusable libraries, external data, and other functions. Refer to the Sentinel imports documentation for more details.
HCP Terraform provides the following importable libraries to define policy rules for the plan, configuration, state, and run associated with a policy check.
tfplan
: Provides access to a Terraform plan, which is the file created when you run theterraform plan
command. This library is deprecated. Usetfplanv/2
instead.tfplan/v2
: Provides access to a Terraform plan, which is the file created when you run theterraform plan
command.tfconfig
: Provides access to a Terraform configuration. The configuration is the set of.tf
files that describe the desired infrastructure state. This library is deprecated. Usetfconfig/v2
instead.tfconfig/v2
: Provides access to a Terraform configuration. The configuration is the set of.tf
files that describe the desired infrastructure state. This library is deprecated. Usetfconfig/v2
instead.tfstate
: Provides access to the Terraform state. Terraform uses state to map real-world resources to your configuration. This library is deprecated. Usetfstate/v2
instead.tfstate/v2
: Provides access to the Terraform state. Terraform uses state to map real-world resources to your configuration.tfrun
: Provides access to data associated with a run in HCP Terraform. For example, you could retrieve the run's workspace.
Test import
functions
You can create mocks of these functions and test them using the Sentinel CLI. Refer to the following topics for additional information: