CircleCI-Public / terraform-orb

Deploy your infrastructure via a CircleCI pipeline using the Terraform orb. Integrate Infrastructure-as-Code (IaC) to help provision and manage any cloud, infrastructure, or service of your choice.
https://circleci.com/orbs/registry/orb/circleci/terraform
MIT License
10 stars 44 forks source link

Terraform Airbyte Registry No compatible versions of provider registry.terraform.io/airbytehq/airbyte were found. #103

Closed EsauOlivaLeaoHelix closed 1 week ago

EsauOlivaLeaoHelix commented 8 months ago

Orb Version circleci/terraform@3.2.1

When trying to terraform init airbyte provider I got:

Error: Incompatible provider version │ │ No compatible versions of provider registry.terraform.io/airbytehq/airbyte were found.

Describe the bug

Circleci is unable to find airbyte provider for terraform

To Reproduce

Steps to reproduce the behavior:

  1. Add airbyte provider to your mainfile https://registry.terraform.io/providers/airbytehq/airbyte/latest/docs
  2. create a config.yml with terraform init command
  3. push the config.yml
  4. Circleci will Error: Incompatible provider version

│ No compatible versions of provider registry.terraform.io/airbytehq/airbyte were found.

Expected behavior

get provider installed

The registry is found when you terraform init

Add any other context about the problem here.

iknowcss-invenco commented 3 months ago

My build suffers from the same issue but with a different provider:

No compatible versions of provider registry.terraform.io/terraform-community-providers/neon were found.

This happens when I run terraform init. When I run locally, init runs fine. When I run in CI within the default executor of circleci/terraform@3.2.1, it gives me the error above :point_up:

Here is my provider setup:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.48.0"
    }

    auth0 = {
      source  = "alexkappa/auth0"
      version = "0.26.2"
    }

    neon = {
      source = "terraform-community-providers/neon"
      version = "0.1.6"
    }
  }

  required_version = ">= 0.13"
}

Things I have tried:

Run locally with terraform version 1.0.0 (same as build agent)

terraform init works fine locally

SSH into the build agent and ensure I can get the list of version from the host

Run this command locally and on the host:

wget -O - https://registry.terraform.io/v1/providers/terraform-community-providers/neon/versions 2> /dev/null

Output is the same (full output omitted to reduce clutter). Notice version 0.1.6 is the first one and the architecture is the same:

{
  "id": "terraform-community-providers/neon",
  "versions": [
    {
      "version": "0.1.6",
      "protocols": ["6.0"],
      "platforms": [
        { "os": "linux", "arch": "amd64" },

I'm really stumped :man_shrugging:

iknowcss-invenco commented 3 months ago

The solution to my issue was to follow the advice on this thread

Seems the arch for terraform is arm issuing amd64, erase the line executor and use a docker_image: that allow you to run a docker image with amd64 in my case:

// executor: terraform/default docker:

  • image: hashicorp/terraform:1.7.4

This was in one of my custom CircleCI orbs so I changed this:

description: >
  Sets up the terraform executor and credentials and runs terraform init, plan and apply.

executor:
  name: terraform/default

steps:
  - checkout
# ...

to this

description: >
  Sets up the terraform executor and credentials and runs terraform init, plan and apply.

executor:
  name: hashicorp/terraform:1.8.5

steps:
  - checkout
# ...

and everything worked :+1:

marboledacci commented 1 week ago

This looks like a problem with the docker image version, and the orb executor allows to change that.