Home > OS >  Cannot add "Wiz"(third-party) terraform provider
Cannot add "Wiz"(third-party) terraform provider

Time:05-14

I am intergrating Wiz for AWS resources scanning, and following the doc : enter image description here

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.

CodePudding user response:

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?

  • Related