Error when trying to hit "terraform init"

this is the error am getting when am trying to do “terraform init” initialization

can any 1 give me the solution for this

can you share your required_providers stanza please?

aws is my provider and am trying to create keypair

@danielkumar9287, It appears you are using a very old release of Terraform. If you are unable to upgrade to the latest, make sure you are at least using the latest patch release from that version.

Thank you all for your response, but I need your help/guidance on this. how to delete present terraform and to recreate it with latest version of it? Help me on this.

You can find all Terraform releases here: Terraform Versions | HashiCorp Releases
The Terraform CLI is a single binary, so you can unpack the one which corresponds to your OS+architecture, and replace the existing binary in your path.

I would start with the latest patch for your release to ensure it’s working properly. In order to upgrade major releases, you should consult the upgrade guides here

If you don’t mind, can you please provide me with commands for doing this… to unpack current one and replace the existing latest one

After upgradig terraform latest version, Getting error like this “too many command line arguments. Did you mean to use -chdir?” what does it mean and what actions I should suppose to do now?

Terraform v1.0 removed the legacy positional directory argument, and now uses an explicit -chdir flag when you need to use a different working directory. Since the . was redundant anyway, you can just remove that argument from your command.

“Too many command line arguments. Did you mean to use -chdir?” - error appeared when running terraform init

Please show the exact input and output you are seeing. Entering the command

terraform init

is not adding any arguments, so I’m not sure why you would be seeing that error.

see, am giving like this “terraform init .”

see, am giving like this “terraform init .”
then am getting this error “Too many command line arguments. Did you mean to use -chdir?”

As mentioned above, remove the . – positional arguments are no longer supported, and the . was redundant and made no difference in the command.

thank you so much sir, now its working fine.

Yes, I did as you said to me and it worked. Thank you so much and if I found any doubts I will contact you sir.