Although I gave correct resource name and type it is giving error as below , what could be wrong
You can see from the syntax highlighting that PowerShell is interpreting the command somehow, and messing up the arguments before they get to Terraform.
Don’t use PowerShell for running other commands. It has these unexpected edge cases that catch people out.
Indeed… PowerShell on Windows has an unfortunate habit of corrupting the command line when running external software, rather than its own “cmdlets”.
In this case I think PowerShell has transformed your single
-target=... option into two separate arguments by inserting an argument separator just before the dot in the resource address. I’ve seen it do a similar thing with the
.tfvars suffix in a
-var-file=... option too.
I recommend running external programs like Terraform with the Windows Command Prompt instead, because it does not corrupt the command line when running external commands.
Alternatively you may be able to persuade PowerShell to pass this properly by writing the argument in quotes, but I’m not totally sure and so I recommend Windows Command Prompt as the most reliable way to run software like Terraform.