# Terraform init not consistently generating files

**URL:** <https://discuss.hashicorp.com/t/terraform-init-not-consistently-generating-files/42058>\
**Category:** Terraform\
**Created:** [July 16, 2022, 6:15pm UTC](https://discuss.hashicorp.com/t/terraform-init-not-consistently-generating-files/42058 "2022-07-16T18:15:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![independentid](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/independentid/32/28448_2.png) [@independentid](https://discuss.hashicorp.com/u/independentid)\
**Post date:** [July 16, 2022, 6:15pm UTC](https://discuss.hashicorp.com/t/terraform-init-not-consistently-generating-files/42058/1 "2022-07-16T18:15:24Z")

</div>

When running terraform init, the lock file or .terraform directory is not consistently created or updated.  
terraform init -upgrade will download the providers generate the .terraform directory but is not generating the lock file.  
terraform init says it is downloading the providers but is actually doing nothing (including not generating the lock file)

Randomly the lock file is created, but I have not discovered when that happens.

```auto
pjdhunt@pjhmbp20 gcp-iap-k8s % terraform init

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hexaorg/hexa...
- Finding hashicorp/kubernetes versions matching ">= 2.12.1"...
- Finding latest version of hashicorp/google...
- Finding latest version of hashicorp/google-beta...
- Installing hashicorp/kubernetes v2.12.1...
- Installed hashicorp/kubernetes v2.12.1 (signed by HashiCorp)
- Installing hashicorp/google v4.28.0...
- Installed hashicorp/google v4.28.0 (signed by HashiCorp)
- Installing hashicorp/google-beta v4.28.0...
- Installed hashicorp/google-beta v4.28.0 (signed by HashiCorp)
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider hexaorg/hexa: provider registry registry.terraform.io does not have a provider named registry.terraform.io/hexaorg/hexa
│ 
│ All modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are currently depending on hexaorg/hexa, run the following command:
│ terraform providers
╵

pjdhunt@pjhmbp20 gcp-iap-k8s % ls
gke.tf main.tf terraform-example.tfvars terraform.tfvars vpc.tf
pjdhunt@pjhmbp20 gcp-iap-k8s % ls -a
. .. .terraform gke.tf main.tf terraform-example.tfvars terraform.tfvars vpc.tf
pjdhunt@pjhmbp20 gcp-iap-k8s % terraform -version
Terraform v1.2.5
on darwin_amd64

```

---

<div class="post-metadata">

**Author:** ![independentid](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/independentid/32/28448_2.png) [@independentid](https://discuss.hashicorp.com/u/independentid)\
**Post date:** [July 16, 2022, 6:16pm UTC](https://discuss.hashicorp.com/t/terraform-init-not-consistently-generating-files/42058/2 "2022-07-16T18:16:27Z")

</div>

Note: I am developing a plugin (hexaorg/hexa) and have played with setting .terraformrc and removing it. No difference to effect of terraform init.

---

<div class="post-metadata">

**Author:** ![independentid](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/independentid/32/28448_2.png) [@independentid](https://discuss.hashicorp.com/u/independentid)\
**Post date:** [July 16, 2022, 6:48pm UTC](https://discuss.hashicorp.com/t/terraform-init-not-consistently-generating-files/42058/3 "2022-07-16T18:48:11Z")

</div>

If I remove references to the plugin under development from my .tf files, I notice that terraform init now returns green text stating “Terraform has been successfully initialized!”

When a local development plugin is in use, terraform init notices the plugin and puts a warning out, but does nothing. No errors and no success message.

In order to develop a plugin, you must first load other providers first (with terraform init) then add references back into .tf.

It seems an error message at minimum would be appropriate.
