You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reacted by Kevin Behrens, William Miller, Matteo Gazzetta, VEBER Arnaud, Pavel Brodsky, Brian Anstett, Brandon Hartshorn, Thomas G Henry, Jonathan Pirro, Taylor Geery and 2 more
@Anton-Shutik, I can only reproduce this if none of the .tf files in the github directory have a required_providers section that refers to integrations/github (either because there is no required_providers section at all, or it uses the old terraform syntax of github = "X.Y.Z"). This makes the module implicitly refer to hashicorp/github.
Note: Only provider configurations are inherited by child modules, not provider source or version requirements. Each module must declare its own provider requirements. This is especially important for non-HashiCorp providers.
Can you try adding a section like the following to a file in the github module directory?
terraform {
required_providers {
github={
source ="integrations/github"
version =">= 4.4.0"// or whatever version range you wish
}
}
}
Bumping this, as we're running into a similar issue and can demonstrate it in a different way:
Our original config that made this come up:
versions.tf file in a top directory, referencing a specific version number for integrations/github (and nothashicorp/github)
a .terraform.lock.hcl file, with hashes for integrations/github at the version specified in versions.tf
In terraform/modules:
a directory, my_module, whose main.tf contains a data source, data "github_ip_ranges" "ips"
In terraform/myapp/module:
in main.tf, a data source data "github_ip_ranges" "ips"
in module.tf, a module resource whose source is ../modules/my_module
.terraform.lock.hcl andversions.tf, symlinked from the top-directory files
With this config, running init would cause Terraform to look for both integrations/github AND hashicorp/github -- despite the fact that the latter is not referenced anywhere in our codebase (it's also not in any local cache/plugin-cache directories, at least not before init runs and pulls it down):
Initializing provider plugins...
- Reusing previous version of integrations/github from the dependency lock file
- Finding latest version of hashicorp/github...
[...deletia...]
- Using previously-installed integrations/github v4.19.1
- Installing hashicorp/github v4.19.2...
- Installed hashicorp/github v4.19.2 (signed by HashiCorp)
Neither versions.tf nor .terraform.lock.hcl references hashicorp/github, and we run Terraform commands with -lockfile=readonly so that the same lock file can be used across our directories, so init complains that it can't update said lock file:
│ Warning: Additional provider information from registry
│
│ The remote registry returned warnings for registry.terraform.io/hashicorp/github:
│ - For users on Terraform 0.13 or greater, this provider has moved to integrations/github.
│ Please update your source in required_providers.
│
│
│ Error: Provider dependency changes detected
│
│ Changes to the required provider dependencies were detected, but the lock file is read-only.
│ To use and record these requirements, run "terraform init" without the "-lockfile=readonly"
│ flag.
This turned out to be because we had two (conflicting, apparently) data.github_ip_ranges.ips sources:
We updated my_module to use a variable -- instead of its own data.github_ip_ranges.ips source -- and then passed in the main-level data.github_ip_ranges.ips value into my_module via that variable. As soon as this change was put in place, subsequent init operations only downloaded integrations/github, and hashicorp/github was no longer sought out.
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
Activity
thekbb commentedon Feb 8, 2021
I'm seeing the same - with terraform 13.5, I cannot replace the references with:
tibbes commentedon Mar 22, 2021
@Anton-Shutik, I can only reproduce this if none of the
.tffiles in thegithubdirectory have arequired_providerssection that refers tointegrations/github(either because there is norequired_providerssection at all, or it uses the old terraform syntax ofgithub = "X.Y.Z"). This makes the module implicitly refer tohashicorp/github.The Terraform documentation mentions in a note the following:
Can you try adding a section like the following to a file in the
githubmodule directory?bleachbyte commentedon Jan 27, 2022
Bumping this, as we're running into a similar issue and can demonstrate it in a different way:
Our original config that made this come up:
versions.tffile in a top directory, referencing a specific version number forintegrations/github(and nothashicorp/github).terraform.lock.hclfile, with hashes forintegrations/githubat the version specified inversions.tfterraform/modules:my_module, whosemain.tfcontains a data source,data "github_ip_ranges" "ips"terraform/myapp/module:main.tf, a data sourcedata "github_ip_ranges" "ips"module.tf, amoduleresource whose source is../modules/my_module.terraform.lock.hclandversions.tf, symlinked from the top-directory filesWith this config, running
initwould cause Terraform to look for bothintegrations/githubANDhashicorp/github-- despite the fact that the latter is not referenced anywhere in our codebase (it's also not in any local cache/plugin-cache directories, at least not beforeinitruns and pulls it down):Neither
versions.tfnor.terraform.lock.hclreferenceshashicorp/github, and we run Terraform commands with-lockfile=readonlyso that the same lock file can be used across our directories, soinitcomplains that it can't update said lock file:This turned out to be because we had two (conflicting, apparently)
data.github_ip_ranges.ipssources:module.main.data.github_ip_ranges.ipsmodule.main.module.my_module.data.github_ip_ranges.ipsWe updated
my_moduleto use a variable -- instead of its owndata.github_ip_ranges.ipssource -- and then passed in themain-leveldata.github_ip_ranges.ipsvalue intomy_modulevia that variable. As soon as this change was put in place, subsequentinitoperations only downloadedintegrations/github, andhashicorp/githubwas no longer sought out.In
treeform:Problematic config:
Fixed:
github-actions commentedon Dec 4, 2022
👋 Hey Friends, this issue has been automatically marked as
stalebecause it has no recent activity. It will be closed if no further activity occurs. Please add theStatus: Pinnedlabel if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!github-actions commentedon Apr 23, 2024
👋 Hey Friends, this issue has been automatically marked as
stalebecause it has no recent activity. It will be closed if no further activity occurs. Please add theStatus: Pinnedlabel if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!