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 the- terraform plancommand. This library is deprecated. Use- tfplanv/2instead.
- tfplan/v2: Provides access to a Terraform plan, which is the file created when you run the- terraform plancommand.
- tfconfig: Provides access to a Terraform configuration. The configuration is the set of- .tffiles that describe the desired infrastructure state. This library is deprecated. Use- tfconfig/v2instead.
- tfconfig/v2: Provides access to a Terraform configuration. The configuration is the set of- .tffiles that describe the desired infrastructure state.
- tfstate: Provides access to the Terraform state. Terraform uses state to map real-world resources to your configuration. This library is deprecated. Use- tfstate/v2instead.
- 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: