kinvolk / lokomotive

🪦 DISCONTINUED Further Lokomotive development has been discontinued. Lokomotive is a 100% open-source, easy to use and secure Kubernetes distribution from the volks at Kinvolk
https://kinvolk.io/lokomotive-kubernetes/
Apache License 2.0
321 stars 49 forks source link

Error not shown when running without expected version of ct provider #989

Closed rata closed 4 years ago

rata commented 4 years ago

When running a cluster apply using latest master (5ba9d5cd3bf38854c38f538a1cac97bb1214b982, probably affects 0.4.1 too) it fails without a clear error:

$ ../lokoctl cluster apply 
INFO[0000] Executing step "initialize Terraform"         phase=infrastructure

You can find the logs in "lokomotive-assets/terraform/logs/1294502.log"

Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".

- Downloading plugin for provider "random" (hashicorp/random) 2.3.0...
- Downloading plugin for provider "local" (hashicorp/local) 1.4.0...
- Downloading plugin for provider "null" (hashicorp/null) 2.1.2...
- Downloading plugin for provider "template" (hashicorp/template) 2.1.2...
- Downloading plugin for provider "tls" (hashicorp/tls) 2.2.0...
- Downloading plugin for provider "packet" (terraform-providers/packet) 3.0.0...
- Downloading plugin for provider "aws" (hashicorp/aws) 3.3.0...

Warning: registry.terraform.io: For users on Terraform 0.13 or greater, this provider has moved to packethost/packet. Please update your source in required_providers.

Error: no provider exists with the given name

FATA[0009] Failed to initialize Terraform: failed checking execution status: exit status 1  args="[]" command="lokoctl cluster apply"

It doesn't fail which provider name doesn't exit, etc. If you run again, however, the error is shown:

$ ../lokoctl cluster apply 
INFO[0000] Executing step "initialize Terraform"         phase=infrastructure

You can find the logs in "lokomotive-assets/terraform/logs/1295598.log"
Provider "ct" not available for installation.

A provider named "ct" could not be found in the Terraform Registry.

This may result from mistyping the provider name, or the given provider may
be a third-party provider that cannot be installed automatically.

In the latter case, the plugin must be installed manually by locating and
downloading a suitable distribution package and placing the plugin's executable
file in the following directory:
    terraform.d/plugins/linux_amd64

Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".

Error: no provider exists with the given name

FATA[0000] Failed to initialize Terraform: failed checking execution status: exit status 1  args="[]" command="lokoctl cluster apply"

You can reproduce by just deleting the lokomotive-assets folder.

The error is always shown correctly if you use lokoctl cluster apply -v, though.

Im using terraform 0.12.24:

$ terraform -v
Terraform v0.12.24

I also do have the ct provider installed, just not the expected version by this release

invidian commented 4 years ago

@rata how does the error look like with latest version of Terraform (0.12.x)?

t-lo commented 4 years ago

Can confirm the issue for v0.4.1.

rata commented 4 years ago

Installing the proper ct provider version expected by the lokomotive release fixes the error

t-lo commented 4 years ago

Retried with terraform-ct-provider_v0.6.1 and it addresses the issue. Thanks for the workaround!

invidian commented 4 years ago

CT provider is now automatically pulled from the registry and manual installation is no longer needed BTW.

With Terraform 0.13, error looks good to me:

Initializing the backend...

Initializing provider plugins...
- Finding dmacvicar/libvirt versions matching "0.6.2, 0.6.2, 0.6.2, 0.6.2"...
- Finding hashicorp/null versions matching "2.1.2"...
- Finding hashicorp/template versions matching "2.1.2, 2.1.2"...
- Finding hashicorp/tls versions matching "2.2.0"...
- Finding hashicorp/local versions matching "1.4.0"...
- Finding poseidon/ct versions matching "0.6.1, 0.6.1, 0.6.1, 0.6.1, 0.6.1"...
- Finding hashicorp/random versions matching "3.0.0, 3.0.0, 3.0.0"...
- Finding tinkerbell/tinkerbell versions matching "0.1.0, 0.1.0, 0.1.0, 0.1.0, 0.1.0"...
- Using hashicorp/null v2.1.2 from the shared cache directory
- Using hashicorp/template v2.1.2 from the shared cache directory
- Using hashicorp/tls v2.2.0 from the shared cache directory
- Using hashicorp/local v1.4.0 from the shared cache directory
- Using poseidon/ct v0.6.1 from the shared cache directory
- Using hashicorp/random v3.0.0 from the shared cache directory
- Using tinkerbell/tinkerbell v0.1.0 from the shared cache directory

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider
dmacvicar/libvirt: provider registry registry.terraform.io does not have a
provider named registry.terraform.io/dmacvicar/libvirt

FATA[0002] Applying cluster failed: initializing: initializing Terraform: running 'terraform init': failed checking execution status: exit status 1  args="[]" command="lokoctl cluster apply"

@rata do you think we can close it?

rata commented 4 years ago

@invidian awesome. Closing then, thanks!