skip to Main Content

enter image description hereTerraform initialized in an empty directory!

The directory has no Terraform configuration files. You may begin working
with Terraform immediately by creating Terraform configuration files.

OS : windows

i have saved config files in aws cli but it is not getting from there.

I created a folder on desktop and inside that folder there is another folder which contain terraform file .

my terraform is located in C drive in terraform folder and stored the path in environment variable

then I installed the AWS cli and use aws configure command to configure the access key and secret key

then i came to my folder and terraform file which contain code

provider "aws" {
  region     = "us-east-1"
}

then I run terraform init and it said

Terraform initialized in an empty directory!
The directory has no Terraform configuration files. You may begin
working with Terraform immediately by creating Terraform configuration files.

then try to run terraform validate and it said

Success! The configuration is valid.

then try to run terraform plan and It said

Error: No configuration files │ │ Plan requires configuration to be
present. Planning without a configuration would mark everything for
destruction, which is normally not what is desired. If you would like
to destroy everything, run plan with the -destroy │ option.
Otherwise, create a Terraform configuration file (.tf file) and try
again.

2

Answers


  1. Chosen as BEST ANSWER

    So i tried move the file to outer folder and somehow it worked ...why I don't know.

    i don't understand how it worked in the outer folder not inner folder, why terraform is not working in folder inside folder.

    if anyone have answer let me know.


  2. This is because your TF file has wrong extension or is in the wrong folder. The TF files should have tf extention, e.g. resource.tf, variables.tf.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search