oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
758 stars 676 forks source link

Error: can not create client, bad configuration: did not find a proper configuration for tenancy #987

Closed amarkel closed 4 years ago

amarkel commented 4 years ago

As I am trying to perform a 'terraform plan', I am getting the following error:

amarkel$ terraform plan -var-file=./myFile.tfvars -state=./myFile.tfstate
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

module.em.data.template_file.em_secret_dat_file: Refreshing state...
module.em.data.template_file.em_oracle_bashrc[0]: Refreshing state...
module.em.data.template_file.upd_cdb_keystore_passwd_sql[0]: Refreshing state...
module.em.data.template_file.db_secret_dat_file: Refreshing state...
module.em.data.template_file.em_jvm_resize[0]: Refreshing state...

Error: can not create client, bad configuration: did not find a proper configuration for tenancy

  on provider.tf line 1, in provider "oci":
   1: provider "oci" {

amarkel$ terraform -v
Terraform v0.12.20
+ provider.null v2.1.2
+ provider.oci v3.63.0
+ provider.template v2.1.2
+ provider.tls v2.1.1

provider_local.tf:

provider "oci" {
  alias            = "local"
  version          = ">= 3.59"
  tenancy_ocid     = var.tenancy_ocid
  user_ocid        = var.user_ocid
  fingerprint      = var.fingerprint
  private_key_path = var.private_key_path
  region           = var.region
}

I am not sure what I am doing wrong.

Environment is MacOS X.

Ideas/solutions will be welcome.

amarkel commented 4 years ago

provider.tf:

provider "oci" {
  version          = ">= 3.59"
}
afedorch commented 4 years ago

Hello @amarkel

Please take a look at example usage: https://www.terraform.io/docs/providers/oci/index.html#example-usage

This could help you verify provider configuration. Make sure that you have correct values for the variables. Thanks!

afedorch commented 4 years ago

@amarkel please let us know if you need anything else for this request, thanks!

amarkel commented 4 years ago

I verified again that my provider configuration is correct. (My teammates work with this setup and they do not fail ...)

afedorch commented 4 years ago

@amarkel The error you mentioned above is from GoSDK: https://github.com/oracle/oci-go-sdk/blob/master/common/configuration.go#L485

Please try to reproduce the problem with the Example Usage and share the configuration example. (just limit the scope to only oci provider with the simple configuration)

Make sure you are not getting unexpected values from the configuration file https://www.terraform.io/docs/providers/oci/index.html#using-the-sdk-and-cli-configuration-file

rajesh-chawla commented 4 years ago

What worked for is to change ~/.ssh in the path of the private key to a full path name.