Open isdba opened 8 months ago
Thank you for reporting the issue. We observed the affected resources are not provided in the description or it's incorrect. We request you to add it in issue description as mentioned in below format. Example: affected_resources = oci_core_instance , oci_core_instances
If it's not related to any particular resource then mention affected resource as terraform. Example: affected_resources = terraform
As this works through automation, request you to follow exact syntax.
affected_resources = terraform
Same here when using oracle-terraform-modules/oke/oci
.
module "oke" {
source = "oracle-terraform-modules/oke/oci"
version = "5.1.3"
providers = { oci.home = oci } # Fix error: The child module requires an additional configuration for provider oracle/oci, with the local name "oci.home".
Also, I made a test configuring the required vars on provider. Same error will return:
terraform {
required_version = "1.7.1"
required_providers {
oci = {
source = "oracle/oci"
version = "5.33.0"
}
}
}
provider "oci" {
# config_file_profile = "will_be_ignored_by_provider_anyway"
tenancy_ocid = var.tenancy_ocid
user_ocid = var.user_ocid
fingerprint = var.fingerprint
private_key_path = var.private_key_path
region = var.region
}
β Error: Invalid provider configuration
β
β Provider "registry.terraform.io/oracle/oci" requires explicit configuration. Add a provider block to the root module and configure the
β provider's required arguments as described in the provider documentation.
β
β΅
β·
β Error: can not create client, bad configuration: did not find a proper configuration for tenancy
β
β with provider["registry.terraform.io/oracle/oci"],
β on <empty> line 0:
β (source code not available)
But, as said by @isdba, if I clone the profile to a [DEFAULT]
section on ~/.oci/config
, the apply works...
Plan: 68 to add, 0 to change, 0 to destroy.
... ignoring completelly the configuration made on provider.
Hey @tf-oci-pub why does this still have the label awaiting-affected-resources? I provided the affected resources or am I still missing something?
I have the same issue and solved the same way, by moving the profile info to DEFAULT.
But, I do think that the problem is different. For some reason, that I am yet to understand, when you use the oke module Terraform thinks that it needs the "hashicorp/oci" module as a provider (instead of "oracle/oci", notice the errors in this thread), even although we add the required_providers pointing to "oracle/oci" all over the place, but the "hashicorp/oci" is still there, coming not sure from where.
Because of this, you have to configure both providers, and the "hashicorp/oci" one does not give the error when you use the DEFAULT profile. I am not sure if you can pass a profile name to the deprecated provider, as docs are not around, but this has been very frustrating.
I am also facing the same issue, and was able to temporarily resolve it by explicitly adding provider oci block.
When i remove provider oci block and set config_file_profile value thru environment variables - it results in Error: configuration file did not contain profile: Prod
It would be nice to get this issue resolved soon, and switch back to previous approach of specifying with provider configuration to use.
I think issue is at resource manager side. On local it is working fine.
No, I don't use resource manager, I only use local terraform.
Community Note
Terraform Version and Provider Version
Affected Resource(s)
terraform
Terraform Configuration Files
The ~/.oci/config file looks like:
Debug Output
Panic Output
Expected Behavior
Terraform should use the the specified configuration.
Actual Behavior
Using the oci cli from the console works as expected.
When I rename the
[robotronde]
in the ~/.oci/config file to[DEFAULT]
I get the following errors:So this indicates for me that the oci provider is reading the correct config file. So when I copy over the
[DEFAULT]
to a new section with the name[robotronde]
everything works. But this means I alwas have to have a copy of my intended profile within the[DEFAULT]
section which is not what I expect this feature to work like.Steps to Reproduce
terraform plan
Important Factoids
References