This message was deleted.
# general
b
This message was deleted.
l
Thanks Hugo, what do the infracost logs show?
If you run with the env
INFRACOST_LOG_LEVEL: debug
that might help as well
a
Copy code
time="2021-12-30T13:12:22Z" level=info msg="Detected Terraform directory at ."
13
time="2021-12-30T13:12:23Z" level=debug msg="Creating temporary config file for Terraform credentials"
14
time="2021-12-30T13:12:23Z" level=debug msg="Writing Terraform credentials to temporary config file /tmp/2906425518"
15
time="2021-12-30T13:12:23Z" level=info msg="Starting: Running terraform plan"
16
time="2021-12-30T13:12:23Z" level=debug msg="Running command: /home/runner/work/_temp/2a830ff7-9b34-4011-aa71-1de2a9ede433/terraform plan -input=false -lock=false -no-color -out=/tmp/.tfplan-42933d1f-f12e-4c6b-a5d3-912dc3e5c3f7"
17
time="2021-12-30T13:12:23Z" level=debug binary=terraform
18
time="2021-12-30T13:12:23Z" level=debug binary=terraform msg="Error: Required plugins are not installed"
19
time="2021-12-30T13:12:23Z" level=debug binary=terraform
20
time="2021-12-30T13:12:23Z" level=debug binary=terraform msg="The installed provider plugins are not consistent with the packages selected"
21
time="2021-12-30T13:12:23Z" level=debug binary=terraform msg="in the dependency lock file:"

...

time="2021-12-30T13:12:23Z" level=debug binary=terraform msg="Terraform uses external plugins to integrate with a variety of different"
30
time="2021-12-30T13:12:23Z" level=debug binary=terraform msg="infrastructure services. You must install the required plugins before running"
31
time="2021-12-30T13:12:23Z" level=debug binary=terraform msg="Terraform operations."
32

33
  Terraform command failed with:
34
    Error: Required plugins are not installed
35
    The installed provider plugins are not consistent with the packages selected
Ran this with a terraform init after as well to see if it was just an issue where it was unneccessarily expecting an init before running it remotely but it then had issues with expecting all of the variables locally as well
Copy code
Terraform command failed with:
37
    Error: No value for required variable
l
Copy code
Terraform command failed with:
37
    Error: No value for required variable
This error was from the init or the plan?
a
that error is when i tried adding the init command before the infracost breakdown command to see if it would help but thats it trying to plan locally as it listed all of the variables as being unset, when the variables are all set in the cloud workspace and it plans normally with the same code if i just trigger a plan in terraform cloud directly
l
Can you try this? https://gist.github.com/aliscott/5fc75c3323abed465252c487d21910f8 I’ve changed it so it uses the Terraform CLI directly to trigger a speculative run and then pulls the plan JSON from the TFC API here: https://gist.github.com/aliscott/5fc75c3323abed465252c487d21910f8#file-test-yml-L20-L35 It then passes that plan JSON into Infracost, so Infracost is never uses the terraform binary directly: https://gist.github.com/aliscott/5fc75c3323abed465252c487d21910f8#file-test-yml-L45
a
Thank you very much for quick responses, tried this and had same sort of issue but issue may have been version discrepancy problem where one was setup for remote and the other for cloud as the terraform versions seemed off. Have forced an update on them locally and configured cloud one and seems to be working now
l
Great! Out of interest does this fix the old method as well or does it only work for you when you generate the plan JSON before running Infracost?
a
Old method does seem to work but it needs the terraform init command everytime to init with Terraform Cloud otherwise it complains
Copy code
Terraform command failed with:
    Error: Terraform Cloud initialization required: please run "terraform init"
l
Ah thank you! It looks like our auto init detection is missing that error message. I’ll add a fix for that for the next release.
a
Thank you very much for your quick help, was awesome and much appreciated 🙂
l
Thanks! We’ve just released the auto init fix in v0.9.16 (released about an hour ago).
🙌 1