runatlantis / atlantis

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

Failed to instantiate provider "registry.terraform.io/hashicorp/aws" to obtain schema: timeout while waiting for plugin to start #2424

Closed rlex closed 2 years ago

rlex commented 2 years ago

Community Note


Overview of the Issue

Can't run atlantis with AWS. I have two folders, one for hcloud, second for AWS. hcloud works with no issues. AWS works locally with "terraform plan" too.

Reproduction Steps

1) Load atlantis with AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from secret 2) Run arbitrary AWS terraform plan 3) Observe errors

Logs

running "/atlantis-data/bin/terraform1.2.5 plan -input=false -refresh -out \"/atlantis-data/repos/example/example-tf/11/default/example-aws/default.tfplan\"" in "/atlantis-data/repos/example/example-tf/11/default/example-aws": exit status 1
â•·
│ Error: failed to read schema for aws_cognito_user_pool_domain.k8s-app-de1 in registry.terraform.io/hashicorp/aws: failed to instantiate provider "registry.terraform.io/hashicorp/aws" to obtain schema: timeout while waiting for plugin to start
│ 
│ 
╵

Environment details

Atlantis server-side config file:

# config file

Repo atlantis.yaml file:

version: 3
projects:
  - dir: example-nbg1
    workflow: example-nbg1-workflow
    terraform_version: 1.2.5
  - dir: example-aws
    workflow: example-aws-workflow
    terraform_version: 1.2.5
workflows:
  example-nbg1-workflow:
    plan:
      steps:
        - init:
            extra_args:
              - -backend-config backend.vars
              - -backend-config access_key=$TFSTATE_ACCESS_KEY
              - -backend-config secret_key=$TFSTATE_SECRET_KEY
              - -var="hcloud_token=$hetzner_example"
        - plan:
            extra_args:
              - -var="hcloud_token=$hetzner_example"
    apply:
      steps:
        - apply
  example-aws-workflow:
    plan:
      steps:
        - init:
            extra_args:
              - -backend-config backend.vars
              - -backend-config access_key=$TFSTATE_ACCESS_KEY
              - -backend-config secret_key=$TFSTATE_SECRET_KEY
        - plan
    apply:
      steps:
        - apply

Additional Context

backend.vars:

bucket = "example-tf-state"
region = "eu-west-1"
key = "example-aws"
endpoint = "https://s3_endpoint"

and that's how i init provider:

terraform {
  backend "s3" {
    skip_credentials_validation = true
    skip_region_validation      = true
    bucket                      = var.tf_state_bucket
    key                         = var.project
    region                      = var.tf_state_region
    endpoint                    = var.tf_state_endpoint
    access_key                  = var.tf_state_access_key
    secret_key                  = var.tf_state_secret_key
  }
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "4.23.0"
    }
  }
}
rlex commented 2 years ago

Looks like i found issue - limits on pod with atlantis were too small. hcloud probably passed because it was really light on resources.

Still think that debug can be a bit more verbose on this

jamengual commented 2 years ago

this is not something we can do in atlantis, atlantis just runs terraform.