runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.73k stars 1.05k forks source link

Terragrunt: Error: Required plugins are not installed #4866

Open vitali-federau-monite opened 1 month ago

vitali-federau-monite commented 1 month ago

Community Note


Overview of the Issue

Atlantis working with terragrunt still gives me Error: Required plugins are not installed, even though I have TERRAGRUNT_PROVIDER_CACHE: 1 and ATLANTIS_USE_TF_PLUGIN_CACHE: "false"

Reproduction Steps

Terragrunt verision: TG_VERSION="v0.64.1 Atlantis version 5.4.4 Terraform version: Terraform v1.8.5

I have tried a lot of ways that were discussed in docs, I dont have a lot of projects and in my pod in folders like /atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/xxx/rds/.terragrunt-cache/xoKOqiNukmpPRo3mBEmvkolrMgE/z_FacxGUMEuXC2vfXmG-YmYzcss I can see the folder terraform/providers/hashicorp/aws and random, so all in place, but I still get

running "terragrunt plan --terragrunt-non-interactive -no-color -out=$PLANFILE $(printf '%s' $COMMENT_ARGS | sed 's/,/ /' | tr -d '\\\\')" in "/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/erebus/rds": exit status 1: running "terragrunt plan --terragrunt-non-interactive -no-color -out=$PLANFILE $(printf '%s' $COMMENT_ARGS | sed 's/,/ /' | tr -d '\\\\')" in "/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/erebus/rds": 
time=2024-08-21T23:34:17Z level=info msg=Terragrunt Cache server is listening on 127.0.0.1:41481
time=2024-08-21T23:34:17Z level=info msg=Start Terragrunt Cache server

Error: Required plugins are not installed

The installed provider plugins are not consistent with the packages selected
in the dependency lock file:
  - registry.terraform.io/hashicorp/random: there is no package for registry.terraform.io/hashicorp/random 3.6.2 cached in .terraform/providers
  - registry.terraform.io/hashicorp/aws: there is no package for registry.terraform.io/hashicorp/aws 5.63.1 cached in .terraform/providers

Terraform uses external plugins to integrate with a variety of different
infrastructure services. To download the plugins required for this
configuration, run:
  terraform init
time=2024-08-21T23:34:43Z level=error msg=terraform invocation failed in /atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/xxx/rds/.terragrunt-cache/xoKOqiNukmpPRo3mBEmvkolrMgE/z_FacxGUMEuXC2vfXmG-YmYzcss error=[/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/xxx/rds/.terragrunt-cache/xoKOqiNukmpPRo3mBEmvkolrMgE/z_FacxGUMEuXC2vfXmG-YmYzcss] exit status 1 prefix=[/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/xxx/rds] 
time=2024-08-21T23:34:43Z level=info msg=Shutting down Terragrunt Cache server...
time=2024-08-21T23:34:43Z level=info msg=Terragrunt Cache server stopped
time=2024-08-21T23:34:43Z level=error msg=1 error occurred:
    * [/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/xxx/rds/.terragrunt-cache/xoKOqiNukmpPRo3mBEmvkolrMgE/z_FacxGUMEuXC2vfXmG-YmYzcss] exit status 1

Logs

running "terragrunt plan --terragrunt-non-interactive -no-color -out=$PLANFILE $(printf '%s' $COMMENT_ARGS | sed 's/,/ /' | tr -d '\\\\')" in "/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/erebus/rds": exit status 1: running "terragrunt plan --terragrunt-non-interactive -no-color -out=$PLANFILE $(printf '%s' $COMMENT_ARGS | sed 's/,/ /' | tr -d '\\\\')" in "/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/erebus/rds": 
time=2024-08-21T23:34:17Z level=info msg=Terragrunt Cache server is listening on 127.0.0.1:41481
time=2024-08-21T23:34:17Z level=info msg=Start Terragrunt Cache server

Error: Required plugins are not installed

The installed provider plugins are not consistent with the packages selected
in the dependency lock file:
  - registry.terraform.io/hashicorp/random: there is no package for registry.terraform.io/hashicorp/random 3.6.2 cached in .terraform/providers
  - registry.terraform.io/hashicorp/aws: there is no package for registry.terraform.io/hashicorp/aws 5.63.1 cached in .terraform/providers

Terraform uses external plugins to integrate with a variety of different
infrastructure services. To download the plugins required for this
configuration, run:
  terraform init
time=2024-08-21T23:34:43Z level=error msg=terraform invocation failed in /atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/xxx/rds/.terragrunt-cache/xoKOqiNukmpPRo3mBEmvkolrMgE/z_FacxGUMEuXC2vfXmG-YmYzcss error=[/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/xxx/rds/.terragrunt-cache/xoKOqiNukmpPRo3mBEmvkolrMgE/z_FacxGUMEuXC2vfXmG-YmYzcss] exit status 1 prefix=[/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/xxx/rds] 
time=2024-08-21T23:34:43Z level=info msg=Shutting down Terragrunt Cache server...
time=2024-08-21T23:34:43Z level=info msg=Terragrunt Cache server stopped
time=2024-08-21T23:34:43Z level=error msg=1 error occurred:
    * [/atlantis-data/repos/xxx/infra/infrastructure-as-code/11/default/aws-terraform/production/eu-central-1/xxx/rds/.terragrunt-cache/xoKOqiNukmpPRo3mBEmvkolrMgE/z_FacxGUMEuXC2vfXmG-YmYzcss] exit status 1

Environment details

ATLANTIS_CONTAINER: true ATLANTIS_REPO_CONFIG: /etc/atlantis/repos.yaml ATLANTIS_WRITE_GIT_CREDS: true # to enable cloning of private tf modules ATLANTIS_HIDE_PREV_PLAN_COMMENTS: true ATLANTIS_ENABLE_DIFF_MARKDOWN_FORMAT: true ATLANTIS_SILENCE_NO_PROJECTS: true ATLANTIS_QUIET_POLICY_CHECKS: true ATLANTIS_SILENCE_VCS_STATUS_NO_PLANS: true ATLANTIS_SKIP_CLONE_NO_CHANGES: true ATLANTIS_EMOJI_REACTION: ":eyes:" ATLANTIS_ALLOW_COMMANDS: "all" ATLANTIS_USE_TF_PLUGIN_CACHE: "false"

ATLANTIS_SLACK_TOKEN: placeholder

# Terragrunt
# https://terragrunt.gruntwork.io/docs/features/provider-cache/
TERRAGRUNT_PROVIDER_CACHE: 1

Atlantis server-side config file:

{{- $ENV := "development" -}}
plan:
  steps:
    - env:
        name: AWS_ACCESS_KEY_ID
        command: echo $DEVELOPMENT_AWS_ACCESS_KEY_ID
    - env:
        name: AWS_SECRET_ACCESS_KEY
        command: echo $DEVELOPMENT_AWS_SECRET_ACCESS_KEY
    - env:
        name: TERRAGRUNT_TFPATH
        command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
    - run: terragrunt plan --terragrunt-non-interactive -no-color -out=$PLANFILE $(printf '%s' $COMMENT_ARGS | sed 's/,/ /' | tr -d '\\')
    - run: terragrunt show -json $PLANFILE > $SHOWFILE
apply:
  steps:
    - env:
        name: AWS_ACCESS_KEY_ID
        command: echo $DEVELOPMENT_AWS_ACCESS_KEY_ID
    - env:
        name: AWS_SECRET_ACCESS_KEY
        command: echo $DEVELOPMENT_AWS_SECRET_ACCESS_KEY
    - env:
        name: TERRAGRUNT_TFPATH
        command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
    - run: terragrunt apply --terragrunt-non-interactive -no-color $PLANFILE
{{- /* */ -}}

Repo atlantis.yaml file:

# config file

Any other information you can provide about the environment/deployment (efs/nfs, aws/gcp, k8s/fargate, etc) --->

Additional Context