This message was deleted.
# atlantis-community
s
This message was deleted.
l
I’m also having this log:
Copy code
{"level":"info","ts":"2023-12-22T13:41:48.529Z","caller":"terraform/terraform_client.go:442","msg":"could not find terraform version 1.5.5 in PATH o │
│ r /atlantis/bin, downloading from <https://releases.hashicorp.com>","json":{}}
I’m trying to run policy_checks but getting this error:
Copy code
- Unsupported state file format: The state file could not be parsed as JSON:
syntax error at byte offset 1.
- Unsupported state file format: The state file does not have a "version"
attribute, which is required to identify the format version.

Plan read error: plan file was created by Terraform 1.5.5, but this is 1.3.5;
plan files cannot be transferred between different Terraform versions
my repos.yaml file:
Copy code
repos:
  - id: "/.*/"
    apply_requirements: [approved, mergeable]
    pre_workflow_hooks:
      - run: |
          find . -name '.terragrunt-cache' | xargs rm -rf
          terragrunt-atlantis-config generate --output atlantis.yaml --autoplan --automerge --parallel --num-executors 5 --terraform-version v1.5.5
    workflow: terragrunt
policies:
  owners:
    users:
      - luizandrends
workflows:
  terragrunt:
    plan:
      steps:
        - env:
            name: TERRAGRUNT_TFPATH
            command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
        - env:
            name: TF_IN_AUTOMATION
            value: "true"
        - run: terragrunt plan -input=false -out=$PLANFILE
        - run: terragrunt show -json $PLANFILE > $SHOWFILE
    policy_check:
      steps:
        - policy_check:
            extra_args:
              [
                "--update",
                "my-s3-bucket",
                "--all-namespaces",
              ]
        - run: terragrunt show -no-color -json $PLANFILE > $SHOWFILE
        - run: conftest test $SHOWFILE
    apply:
      steps:
        - env:
            name: TERRAGRUNT_TFPATH
            command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
        - env:
            name: TF_IN_AUTOMATION
            value: "true"
        - run: terragrunt apply -input=false $PLANFILE
c
What's giving you that message, terraform -version?
The DEFAULT_TF_VERSION is a little deceptive -- that is the version Atlantis will use if there is no other version constraint on terraform for a specific project. If there's any other Terraform version constraints -- if the
terraform
block or one of the included modules requires a version, even if it's something like
~> 1.5
, it will use the newest version that fulfills the versioning requirement.
I am not sure what Terraform you get if you log in to the container...but Terraform will pull different versions to fulfill whatever, so I don't know if the default version installed in the root is the same as the one Terraform will use.
l
I’m trying to run policy_checks, and the Atlantis is outputing this message
but I noticed that in the atlantis initialization, he’s looking for 1.5.5 and it’s not finding, when I log in the container and run
terraform -v
it outputs 1.3.5
I have a versions.tf file in my module and it looks like this:
Copy code
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.27"
    }
  }
  required_version = "1.5.5"
}
c
Hrm. It should download whatever version it needs, I would think, though I'm not using any of the policy stuff
l
The problem is on this step:
Copy code
- run: terragrunt show -no-color -json $PLANFILE > $SHOWFILE
c
Hrm. This rubbing up against a lot of stuff I haven't played with 😕
l
No worries @Chastity Blackwell, thanks anyway 🙂
c
Good luck! There's a ton of other smarter people here who I'm sure can give you a hand 🙂
t
The policy_check sections looks to be missing the environment variables to tell it which terraform binary to use, could it be that?
Copy code
policy_check:
      steps:
        - env:
            name: TERRAGRUNT_TFPATH
            command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
        - env:
            name: TF_IN_AUTOMATION
            value: "true"
        - policy_check:
            extra_args:
              [
                "--update",
                "my-s3-bucket",
                "--all-namespaces",
              ]
        - run: terragrunt show -no-color -json $PLANFILE > $SHOWFILE
        - run: conftest test $SHOWFILE