# Error configuring import "tfplan/v2": error loading plan data: invalid character 'e' in literal true (expecting 'r')

**URL:** <https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187>\
**Category:** Sentinel\
**Created:** [January 29, 2024, 4:06am UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187 "2024-01-29T04:06:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxcellayim588](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@maxcellayim588](https://discuss.hashicorp.com/u/maxcellayim588)\
**Post date:** [January 29, 2024, 4:06am UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/1 "2024-01-29T04:06:12Z")

</div>

@hcrhall @rberlind I’d appreciate some help, i’m stock here

I got the above error when i run sentinel apply. here is how my directory looks like

├── compliance  
│ ├── aws-functions  
│ │ └── aws-functions.sentinel  
│ ├── config  
│ │ └── sentinel.hcl  
│ ├── policies  
│ │ └── mandatory-tag-policy.sentinel  
│ └── tfplan-functions  
│ └── tfplan-functions.sentinel  
└── terraform  
├── mock-plan.sentinel  
└── terra.tf

here is my mock data i copied and paste in my mock-plan.sentinel: [terraform-sentinel-policies/aws/test/enforce-mandatory-tags/mock-tfplan-pass.sentinel at main · hashicorp/terraform-sentinel-policies · GitHub](https://github.com/hashicorp/terraform-sentinel-policies/blob/main/aws/test/enforce-mandatory-tags/mock-tfplan-pass.sentinel)

policy: [terraform-sentinel-policies/aws/enforce-mandatory-tags.sentinel at main · hashicorp/terraform-sentinel-policies · GitHub](https://github.com/hashicorp/terraform-sentinel-policies/blob/main/aws/enforce-mandatory-tags.sentinel)

the error points to line 15 of the tfplan-functions,sentinel: [terraform-sentinel-policies/common-functions/tfplan-functions/tfplan-functions.sentinel at main · hashicorp/terraform-sentinel-policies · GitHub](https://github.com/hashicorp/terraform-sentinel-policies/blob/main/common-functions/tfplan-functions/tfplan-functions.sentinel)

“”/compliance/tfplan-functions/tfplan-functions.sentinel:15:1: Error configuring import “tfplan/v2”: error loading plan data: invalid character ‘e’ in literal true (expecting ‘r’)“”

---

<div class="post-metadata">

**Author:** ![maxcellayim588](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@maxcellayim588](https://discuss.hashicorp.com/u/maxcellayim588)\
**Post date:** [January 29, 2024, 4:54am UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/2 "2024-01-29T04:54:32Z")

</div>

// -------------------------------------------------------------  
// FEATURES  
// -------------------------------------------------------------  
sentinel {  
features = {  
apply-all = true  
terraform = true  
}  
}

// -------------------------------------------------------------  
// PLUGINS  
// -------------------------------------------------------------  
import “plugin” “tfplan/v2” {  
config = {  
“plan\_path”: “…/…/terraform/mock-plan.sentinel”  
}  
}

import “module” “aws\_functions” {  
source = “…/aws-functions/aws-functions.sentinel”  
}

import “module” “tfplan-functions” {  
source = “…/tfplan-functions/tfplan-functions.sentinel”  
}

// -------------------------------------------------------------  
// POLICIES  
// -------------------------------------------------------------  
policy “mandatory-tag-policy” {  
source = “…/policies/mandatory-tag-policy.sentinel”  
enforcement\_level = “advisory”  
}

test {  
rules = {  
main = true  
}  
}

---

<div class="post-metadata">

**Author:** ![cam-stitt](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/cam-stitt/32/6077_2.png) [@cam-stitt](https://discuss.hashicorp.com/u/cam-stitt)\
**Post date:** [January 29, 2024, 6:18am UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/3 "2024-01-29T06:18:01Z")

</div>

Hi @maxcellayim588, what version of Sentinel are you running. There was a similar error to the one you have noted in 0.24.0, which was fixed in 0.24.1. I recommend removing the `.sentinel` directory cache before you re-run apply also.

---

<div class="post-metadata">

**Author:** ![maxcellayim237](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@maxcellayim237](https://discuss.hashicorp.com/u/maxcellayim237)\
**Post date:** [January 29, 2024, 10:23am UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/4 "2024-01-29T10:23:04Z")

</div>

@cam-stitt i’m using 0.24.1

---

<div class="post-metadata">

**Author:** ![maxcellayim588](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@maxcellayim588](https://discuss.hashicorp.com/u/maxcellayim588)\
**Post date:** [January 29, 2024, 6:17pm UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/5 "2024-01-29T18:17:30Z")

</div>

@cam-stitt i added a step in my my .gitlab-ci.yaml file to remove .sentinel, but i still have the same error

**/compliance/tfplan-functions/tfplan-functions.sentinel:15:1: Error configuring import “tfplan/v2”: error loading plan data: invalid character ‘e’ in literal true (expecting ‘r’)**

 ![image](https://global.discourse-cdn.com/hashicorp/original/3X/8/7/8713370fc662491a4dd008cc51ecae4f2eaadd7f.png)

---

<div class="post-metadata">

**Author:** ![hcrhall](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/hcrhall/32/968_2.png) [@hcrhall](https://discuss.hashicorp.com/u/hcrhall)\
**Post date:** [January 29, 2024, 8:53pm UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/6 "2024-01-29T20:53:23Z")

</div>

> [@maxcellayim588](#):
>
> import “plugin” “tfplan/v2” {  
> config = {  
> “plan\_path”: “…/…/terraform/mock-plan.sentinel”  
> }  
> }

@maxcellayim237 can you try and change `plan_path` to point to the `plan.json` instead of the mock plan? The plugin expects a JSON document.

Alternatively, if you would like to use mock data, you will need to change your configuration to the following:

```auto
mock “tfplan/v2” {
  module {
    source = “../../terraform/mock-plan.sentinel”
  }
}

```

---

<div class="post-metadata">

**Author:** ![maxcellayim237](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@maxcellayim237](https://discuss.hashicorp.com/u/maxcellayim237)\
**Post date:** [January 30, 2024, 12:11am UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/7 "2024-01-30T00:11:05Z")

</div>

@hcrhall that fix the error. but gave another error.

**Installing modules…**  
\*\* Module aws\_functions marked as added\*\*  
\*\* Module tfplan-functions marked as added\*\*

**Module installation complete**  
**No plugins changed since last install**  
**No static imports changed since last install**  
**Installing policies…**  
\*\* Policy mandatory-tag-policy marked as added\*\*  
**Policy installation complete**  
**Execution trace. The information below will show the values of all**  
**the rules evaluated. Note that some rules may be missing if**  
**short-circuit logic was taken.**  
**Note that for collection types and long strings, output may be**  
**truncated; re-run “sentinel apply” with the -json flag to see the**  
**full contents of these values.**

**mandatory-tag-policy.sentinel - Runtime error while running the policy:**  
\*_mandatory-tag-policy.sentinel:10:1: import “aws-functions” is not available_

├── compliance  
│ ├── config  
│ │ ├── aws-functions  
│ │ │ └── aws-functions.sentinel  
│ │ ├── mandatory-tag-policy.sentinel  
│ │ └── sentinel.hcl  
│ └── tfplan-functions  
│ └── tfplan-functions.sentinel  
└── terraform  
├── mock-plan.sentinel  
└── terra.tf

---

<div class="post-metadata">

**Author:** ![maxcellayim237](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@maxcellayim237](https://discuss.hashicorp.com/u/maxcellayim237)\
**Post date:** [January 30, 2024, 12:12am UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/8 "2024-01-30T00:12:21Z")

</div>

_import “aws-functions” is not available_

---

<div class="post-metadata">

**Author:** ![hcrhall](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/hcrhall/32/968_2.png) [@hcrhall](https://discuss.hashicorp.com/u/hcrhall)\
**Post date:** [January 30, 2024, 2:17am UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/9 "2024-01-30T02:17:45Z")

</div>

The configuration that you have provided shows that the source paths are local files and start with `.../` instead of `../`

It might be worth changing these and see how you get on.

---

<div class="post-metadata">

**Author:** ![maxcellayim237](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@maxcellayim237](https://discuss.hashicorp.com/u/maxcellayim237)\
**Post date:** [January 30, 2024, 2:31pm UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/10 "2024-01-30T14:31:26Z")

</div>

@hcrhall works perfect as expected with mock fail and morck pass data. give the expected result for each scenario

---

<div class="post-metadata">

**Author:** ![maxcellayim237](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@maxcellayim237](https://discuss.hashicorp.com/u/maxcellayim237)\
**Post date:** [January 30, 2024, 2:49pm UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/11 "2024-01-30T14:49:34Z")

</div>

@hcrhall after running  
- export TFPLAN=$(terraform show -json tfplan \> tfplan.json )  
- ls  
terra.tf  
tfplan  
tfplan.json

i’m trying to point the tfplan.json which contain the output of my terraform plan in the sentinel.hcl file, it errors

import “plugin” “tfplan/v2” {  
config = {  
“plan\_path”: “…/…/terraform/tfplan.json”  
}  
}

sentinel.hcl:9,1-28: Plugin source not provided; plugin “tfplan/v2” is missing the required “source” attribute.

when i use:

import “plugin” “tfplan/v2” {  
source = “…/…/terraform/tfplan.json”  
}

/…/…/terraform/tfplan.json: no such file or directory

i just want to understand how will i apply sentinel directly to to the output of my terraform plan

---

<div class="post-metadata">

**Author:** ![hcrhall](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/hcrhall/32/968_2.png) [@hcrhall](https://discuss.hashicorp.com/u/hcrhall)\
**Post date:** [January 31, 2024, 1:06am UTC](https://discuss.hashicorp.com/t/error-configuring-import-tfplan-v2-error-loading-plan-data-invalid-character-e-in-literal-true-expecting-r/62187/12 "2024-01-31T01:06:39Z")

</div>

@maxcellayim237 the error you have provided is expected as `source` is not a valid config argument for the `tfplan/v2` plugin. It expects `plan_path`.

Just as a reminder I have a working example that you can reference when you get stuck: [sentinel-in-ci/compliance/config/sentinel.hcl at main · terraworx/sentinel-in-ci · GitHub](https://github.com/terraworx/sentinel-in-ci/blob/main/compliance/config/sentinel.hcl)
