Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin reinitialization required, Please run "terraform init" #126

Open
akash05-sams opened this issue Dec 6, 2022 · 1 comment
Open

Comments

@akash05-sams
Copy link

akash05-sams commented Dec 6, 2022

I am trying to utilize the python-terraform to create an AWS resource. I was trying to create SQS with it, and for it, I have provided the provider as "aws" and tried to initialize the terraform. But, I am facing an error that I have attached below.

Please find the code I used for destroying the instance:

from python_terraform import *
enter = int(input('Enter the re-use period of the Queue: '))
tf = Terraform(working_dir='./terraform', variables={'re_use_period':enter})
tf.init('provider')
tf.plan(no_color=IsFlagged, refresh=False, capture_output=True)
approve = {"auto-approve": True}`

provider.tf file we have,

provider "aws" {
access_key = var.access_key
secret_key = var.secret_key
region = var.region
}

Error:

(1, '', '\nError: Could not satisfy plugin requirements\n\n\nPlugin reinitialization required. Please run "terraform init".\n\nPlugins are external binaries that Terraform uses to access and manipulate\nresources. The configuration provided requires plugins which can\'t be located,\ndon\'t satisfy the version constraints, or are otherwise incompatible.\n\nTerraform automatically discovers provider requirements from your\nconfiguration, including providers used in child modules. To see the\nrequirements and constraints from each module, run "terraform providers".\n\n\n\nError: provider.aws: no suitable version installed\n version requirements: "(any version)"\n versions installed: none\n\n\n')

Am I doing anything wrong, can anyone please help me in this?

@Shyamalenduojha17
Copy link

You facing this type of issue due to Terraform cannot find a suitable version of the provider that matches the version requirements specified in your configuration.
To solve this problem.

  • You have to specify version of AWS provider in provider.tf file / main.tf file.
  • Here an example:
    terraform {
    required_providers {
    aws = {
    source = "hashicorp/aws"
    version = "~> 4.0"
    }
    }
    }
    provider "aws" {
    access_key = var.access_key
    secret_key = var.secret_key
    region = var.region
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants