Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Error: Backend initialization required, please run "terraform init"

Prateek Tripathi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 1, 2024

Hi all,

I keep getting following error when running terraform apply:

│ Error: Backend initialization required, please run "terraform init"
4
5
│ Reason: Initial configuration of the requested backend "s3"
6
7
│ The "backend" is the interface that Terraform uses to store state,
8
│ perform operations, etc. If this message is showing up, it means that the
9
│ Terraform configuration you're using is using a custom configuration for
10
│ the Terraform backend.
11
12
│ Changes to backend configurations require reinitialization. This allows
13
│ Terraform to set up the new configuration, copy existing state, etc. Please
14
│ run
15
│ "terraform init" with either the "-reconfigure" or "-migrate-state" flags
16
│ to
17
│ use the current configuration.
18
19
│ If the change reason above is incorrect, please verify your configuration
20
│ hasn't changed and try again. At this point, no changes to your existing
21
│ configuration or state have been made.

The terraform init and terraform plan executes successfully with the pipeline. Also, there is absolutely no error when running terraform apply locally, issue only occurs when I perform ci/cd with bitbucket pipeline and it reaches to the terraform apply part.
It's a new s3 bucket that I am using as backend. there is no existing object in it.
I've already tried "-reconfigure" and "-migrate-state" but it still is a no go.
Looking for an urgent suggestions to fix this.

1 answer

0 votes
Brant Schroeder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2024

@Prateek Tripathi Welcome to the Atlassian community

I think this should be able to help you out https://stackoverflow.com/questions/68985429/backend-initialization-required-please-run-terraform-init 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events