Terraform cannot find 1password module

357 Views Asked by At

I'm trying to use the 1Password provider with Terraform via:

 terraform {
   required_providers {
     onepassword = {
       source  = "milosbackonja/1password"
       version = "1.1.0"
     }
   }
   required_version = "~> 0.14"

   backend "remote" {
     organization = "my-co"

     workspaces {
       prefix = "my-"
     }
   }
 }

 provider "onepassword" {
   email      = "[email protected]"
   password   = var.onepassword_master_pass
   secret_key = var.onepassword_secret_key
   subdomain  = "mycompany"
 }

Terraform seems to find the provider and install it but I then get an error saying it cannot be found:

Initializing modules...
- onepassword in onepassword

Initializing the backend...

Successfully configured the backend "remote"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...
- Finding latest version of hashicorp/onepassword...
- Finding hashicorp/aws versions matching "3.30.0"...
- Finding milosbackonja/1password versions matching "1.1.0"...
- Installing hashicorp/aws v3.30.0...
- Installed hashicorp/aws v3.30.0 (signed by HashiCorp)
- Installing milosbackonja/1password v1.1.0...
- Installed milosbackonja/1password v1.1.0 (self-signed, key ID 5B6898F46775F746)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider
hashicorp/onepassword: provider registry registry.terraform.io does not have a
provider named registry.terraform.io/hashicorp/onepassword

If you have just upgraded directly from Terraform v0.12 to Terraform v0.14
then please upgrade to Terraform v0.13 first and follow the upgrade guide for
that release, which might help you address this problem.

Error: Terraform exited with code 1.
Error: Process completed with exit code 1.

Any suggestions?

1

There are 1 best solutions below

2
On BEST ANSWER

You seem to have another module in your configuration that is trying to use this provider without declaring the dependency for it.

You can run terraform providers to see which providers each module depends on. Note any that list hashicorp/1password instead of milosbackonja/1password and update each of them to include a similar required_providers block to the one you showed in your question here, although in shared modules we typically use >= version constraints rather than exact version constraints in order to avoid coordination problems if you need to upgrade the provider in future.