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

Unable to init using remote backend and Terraform v1.1.0 #30129

Closed
dflook opened this issue Dec 10, 2021 · 1 comment · Fixed by #30142
Closed

Unable to init using remote backend and Terraform v1.1.0 #30129

dflook opened this issue Dec 10, 2021 · 1 comment · Fixed by #30142
Labels
backend/remote bug confirmed a Terraform Core team member has reproduced this issue new new issue not yet triaged
Milestone

Comments

@dflook
Copy link

dflook commented Dec 10, 2021

Terraform v1.1.0 will not initialize using a remote backend if there is no existing workspaces.

Terraform Version

Terraform v1.1.0
on darwin_amd64

Terraform Configuration Files

terraform {
  backend "remote" {
    organization = "xxxx"

    workspaces {
      prefix = "hello-"
    }
  }
}

Debug Output

$ terraform init

Initializing the backend...
╷
│ Error: No existing workspaces.
│ 
│ Use the "terraform workspace" command to create and select a new workspace.
│ If the backend already contains existing workspaces, you may need to update
│ the backend configuration.
│ 
│ 
╵

$ terraform workspace new hello
╷
│ Error: Backend initialization required, please run "terraform init"
│ 
│ Reason: Initial configuration of the requested backend "remote"
│ 
│ 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 set up the new configuration, copy existing state, etc. Please run
│ "terraform init" with either the "-reconfigure" or "-migrate-state" flags to
│ use the current configuration.
│ 
│ 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.
╵

https://gist.github.com/dflook/b43b0c303f3d8940eeab5dcafa1f7faa

Expected Behavior

Terraform should have initialized such that I can create a workspace

Steps to Reproduce

  1. terraform init

Additional Context

These commands are run by CI typically with -input=false, but that doesn't seem to make a difference.
Some workspaces are created for the duration of a build, some are created for the duration of a PR.

The error message appears with terraform <v1.1.0 but the backend would be successfully configured, so it could be easily ignored and a workspace created.

@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backend/remote bug confirmed a Terraform Core team member has reproduced this issue new new issue not yet triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants