Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform provider schema -json requires fully configured backend #25228

Closed
jynolen opened this issue Jun 12, 2020 · 2 comments
Closed

terraform provider schema -json requires fully configured backend #25228

jynolen opened this issue Jun 12, 2020 · 2 comments

Comments

@jynolen
Copy link

jynolen commented Jun 12, 2020

Terraform Version

Terraform v0.12.26

Terraform Configuration Files

terraform {
    backend "local" {
    }
}
provider "random" { }
terraform {
    backend "s3" {
    }
}
provider "random" { }

Commands run

> terraform init -backend=false
> terraform providers schema -json

Expected Behavior

The schema operation runs only on provider binary and should not require a fully initiated backend.
In my example we got a s3 backend, Our build process run in a CICD pipeline (so the backend is fully initiated here).
Devs don't needs to have access to the s3/remote/whatever to get the schema of providers

Dans it don't work either for a local backend

Actual Behavior

The commands ask for a fullly initiated backend.

Additionnal Context

This is required for developppement with the terraform language server
https://github.com/hashicorp/terraform-ls
Reference Issues:

Steps to Reproduce

> cat test.tf

terraform {
    backend "local" {
    }
}
provider "random" { }
```

`>   terraform init -backend=false `
```
Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "random" (hashicorp/random) 2.2.1...

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, it is recommended to add version = "..." constraints to the
corresponding provider blocks in configuration, with the constraint strings
suggested below.

* provider.random: version = "~> 2.2"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
```

`>   terraform providers schema -json `

```
Backend reinitialization required. Please run "terraform init".
Reason: Initial configuration of the requested backend "local"

The "backend" is the interface that Terraform uses to store state,
perform operations, etc. If this message is showing up, it means that the
Terraform configuration you're using is using a custom configuration for
the Terraform backend.

Changes to backend configurations require reinitialization. This allows
Terraform to setup the new configuration, copy existing state, etc. This is
only done during "terraform init". Please run that command now then try again.

If the change reason above is incorrect, please verify your configuration
hasn't changed and try again. At this point, no changes to your existing
configuration or state have been made.

Error: Initialization required. Please see the error message above.
```
@mildwonkey
Copy link
Contributor

Hi @jynolen ! Thanks for opening this issue. We already have a feature request open for this new functionality, so I am going to close this issue in favor of #24261. Cheers

@ghost
Copy link

ghost commented Jul 13, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Jul 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants