Search code examples
amazon-web-servicesterraformterraform-provider-awsamazon-eks

Cannot add "Wiz"(third-party) terraform provider


I am intergrating Wiz for AWS resources scanning, and following the doc : https://docs.wiz.io/wiz-docs/docs/auto-connect-clusters, wherein when I added wiz provider in terraform, it is giving following error,

In providers.tf, I added following code :

terraform {
  required_providers {
  wiz = {
      version = " ~> 1.0"
      source = "tf.app.wiz.io/wizsec/wiz"
    }
  aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }

Also, for Wiz integration, there is pre-requisite to have K8 provider and wiz client and secret added, for that I added :

provider "kubernetes" {
  config_context   = //context
  config_path      = //path
}
provider "wiz" {
    client_id = //clientid
    secret = //secret.id
}

Thanks in advance.


Solution

  • Okay, I could fetch wiz plugin from tf.app.wiz.io registry. The above terraform init should work.

    The only case where I think it can fail is when you are using a module which expects wiz provider & you haven't defined the source tf.app.wiz.io/wizsec/wiz in all the modules you are sourcing. If you don't specify in each module, terraform assumes it needs to fetch from default registry registry.terraform.io & fails with above message.

    You could specify the provider like below in each module & let the calling module specify the version you desire to have.

    terraform {
      required_providers {
        wiz = {
          source  = "tf.app.wiz.io/wizsec/wiz"
        }    
      }
    } 
    

    Are you calling a module which relies on wiz provider?