Skip to content

unavailable provider "registry.terraform.io/hashicorp/aws" #632

@glenthomas

Description

@glenthomas

Description

I'm not sure if I have done something wrong but am experiencing this error:

docker run --rm -v $(pwd):/target -i -t eerkunt/terraform-compliance --features ./ --planfile ./plan.out          
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
terraform-compliance v1.3.33 initiated

. Converting terraform plan file.
ERROR: Failed to convert terraform plan file to JSON format via terraform. Here is the error :
None
╷
│ Error: Failed to load plugin schemas
│ 
│ Error while loading schemas for plugin components: Failed to obtain
│ provider schema: Could not load the schema for provider
│ registry.terraform.io/hashicorp/aws: failed to instantiate provider
│ "registry.terraform.io/hashicorp/aws" to obtain schema: unavailable
│ provider "registry.terraform.io/hashicorp/aws"..

To Reproduce

I am using an M1 MacBook

Feature File:

  Scenario Outline: Ensure that specific tags are defined
    Given I have resource that supports tags_all defined
    When it has tags_all
    Then it must contain tags_all
    Then it must contain "<tags>"
    And its value must match the "<value>" regex

    Examples:
      | tags        | value               |
      | Name        | .+                  |
      | Team        | .+                  |
      | environment | ^(prod\|test\|dev)$ |

Plan File:

Sample Terraform Code:

provider "aws" {
  alias = "has_valid_tags"
  default_tags {
    Team = "Engineering 1"
  }
  profile = "core"
  region  = "eu-west-1"
}

provider "aws" {
  alias = "has_invalid_tags"
  default_tags {
    People = "Engineering 1"
  }
  profile = "core"
  region  = "eu-west-1"
}

provider "aws" {
  alias   = "has_no_tags"
  profile = "core"
  region  = "eu-west-1"
}

resource "aws_iam_policy" "policy" {
  provider = aws.has_no_tags
  name     = "test-policy"
  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Action = [
          "*",
        ]
        Effect   = "Allow"
        Resource = "*"
      },
    ]
  })
}

terraform {
  required_version = "~> 1.2"

  backend "s3" {
    bucket         = "terraform-state"
    key            = "terraform.tfstate"
    region         = "eu-west-1"
    encrypt        = true
    dynamodb_table = "terraform-state-lock"
    profile        = "core"
  }

  required_providers {
    aws = {
      version = "~> 4.2"
      source  = "hashicorp/aws"
    }
  }
}

Used terraform-compliance Parameters:

Running via Docker:

Error Output:

│ Error: Failed to load plugin schemas
│ 
│ Error while loading schemas for plugin components: Failed to obtain
│ provider schema: Could not load the schema for provider
│ registry.terraform.io/hashicorp/aws: failed to instantiate provider
│ "registry.terraform.io/hashicorp/aws" to obtain schema: unavailable
│ provider "registry.terraform.io/hashicorp/aws"..

Expected Behavior:

It runs my feature tests.

Tested Versions:

  • terraform-compliance version: v1.3.33
  • terraform version: 1.2.3
  • python version: N/A

Additional Context:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions